Skip to contentSkip to conversation

ext4: using matching invalidatepage in ext4_writepage

PATCH Applied yangerkun 4 participants 5 messages Feb 26, 2020 – Apr 10, 2020 ext4 file system

lore
Share & tools
lore

yangerkun

author
#0 lore raw

PATCH 1/1 ext4: using matching invalidatepage in ext4_writepage

Run generic/388 with journal data mode sometimes may trigger the warning in ext4_invalidatepage. Actually, we should use the matching invalidatepage in ext4_writepage.

---
 fs/ext4/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
index fa0ff78dc033..78e805d42ada 100644
@@ -1974,7 +1974,7 @@ static int ext4_writepage(struct page *page,
 	bool keep_towrite = false;
 
 	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
-		ext4_invalidatepage(page, 0, PAGE_SIZE);
+		inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
 		unlock_page(page);
 		return -EIO;
 	}
Signature · 1 line
2.23.0.rc2.8.gff66981f45
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · yangerkun

Run generic/388 with journal data mode sometimes may trigger the warning in ext4_invalidatepage. Actually, we should use the matching invalidatepage in ext4_writepage.

generic/388 still fails, but the patch makes sense to me and also avoids kernel warning.

Quoted 18 lines
---
  fs/ext4/inode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
index fa0ff78dc033..78e805d42ada 100644
@@ -1974,7 +1974,7 @@ static int ext4_writepage(struct page *page,
  	bool keep_towrite = false;
 
  	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
-		ext4_invalidatepage(page, 0, PAGE_SIZE);
+		inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
  		unlock_page(page);
  		return -EIO;
  	}
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to yangerkun
Quoted 5 lines · yangerkun

Run generic/388 with journal data mode sometimes may trigger the warning in ext4_invalidatepage. Actually, we should use the matching invalidatepage in ext4_writepage.

Thanks for the patch! It looks good to me. You can add:

Honza

Quoted 16 lines
fs/ext4/inode.c +1 -1
index fa0ff78dc033..78e805d42ada 100644
@@ -1974,7 +1974,7 @@ static int ext4_writepage(struct page *page,
 	bool keep_towrite = false;
 
 	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
-		ext4_invalidatepage(page, 0, PAGE_SIZE);
+		inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
 		unlock_page(page);
 		return -EIO;
 	}
Signature · 1 line
2.23.0.rc2.8.gff66981f45
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author
#3 lore raw
In reply to yangerkun

Hi, Ted, can you consider to apply this patch.

Quoted 22 lines · yangerkun

Run generic/388 with journal data mode sometimes may trigger the warning in ext4_invalidatepage. Actually, we should use the matching invalidatepage in ext4_writepage.

---
  fs/ext4/inode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
index fa0ff78dc033..78e805d42ada 100644
@@ -1974,7 +1974,7 @@ static int ext4_writepage(struct page *page,
  	bool keep_towrite = false;
 
  	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
-		ext4_invalidatepage(page, 0, PAGE_SIZE);
+		inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
  		unlock_page(page);
  		return -EIO;
  	}
maintainer Applied
#4 lore raw
In reply to yangerkun
Quoted 5 lines · yangerkun

Run generic/388 with journal data mode sometimes may trigger the warning in ext4_invalidatepage. Actually, we should use the matching invalidatepage in ext4_writepage.

Applied, thanks. Apologies for overlooking this patch earlier.

- Ted