Skip to contentSkip to conversation

f2fs: add f2fs_bug_on() in f2fs_quota_read()

PATCH In review Chao Yu 2 participants 2 messages May 13, 2025 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v2 2/2 f2fs: add f2fs_bug_on() in f2fs_quota_read()

mapping_read_folio_gfp() will return a folio, it should always be uptodate, let's check folio uptodate status to detect any potenial bug.

---
v2:
- just add f2fs_bug_on(), get rid of error handling.

 fs/f2fs/super.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/f2fs/super.c +6 -0
index 0ee783224953..8c77a625427c 100644
@@ -2973,6 +2973,12 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data,
 			goto repeat;
 		}
 
+		/*
+		 * should never happen, just leave f2fs_bug_on() here to catch
+		 * any potential bug.
+		 */
+		f2fs_bug_on(sbi, !folio_test_uptodate(folio));
+
 		memcpy_from_folio(data, folio, offset, tocopy);
 		f2fs_folio_put(folio, true);
 
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 16 lines · Chao Yu

mapping_read_folio_gfp() will return a folio, it should always be uptodate, let's check folio uptodate status to detect any potenial bug.

---
v2:
- just add f2fs_bug_on(), get rid of error handling.

 fs/f2fs/super.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/f2fs/super.c +0 -0
index 0ee783224953..8c77a625427c 100644

fs/f2fs/super.c static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data, · line 2980

Quoted 8 lines
fs/f2fs/super.c +5 -0
@@ -2973,6 +2973,12 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data,
 			goto repeat;
 		}
 
+		/*
+		 * should never happen, just leave f2fs_bug_on() here to catch
+		 * any potential bug.
+		 */
+		f2fs_bug_on(sbi, !folio_test_uptodate(folio));

Applied with F2FS_SB(sb)

Quoted 6 lines
fs/f2fs/super.c +1 -0
+
 		memcpy_from_folio(data, folio, offset, tocopy);
 		f2fs_folio_put(folio, true);
 
Signature · 1 line
2.49.0