Skip to content

Commit 43ba56a

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix to return correct error number in f2fs_sync_node_pages()
If __write_node_folio() failed, it will return AOP_WRITEPAGE_ACTIVATE, the incorrect return value may be passed to userspace in below path, fix it. - sync_filesystem - sync_fs - f2fs_issue_checkpoint - block_operations - f2fs_sync_node_pages - __write_node_folio : return AOP_WRITEPAGE_ACTIVATE Cc: [email protected] Reported-by: Christoph Hellwig <[email protected]> Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 0427e81 commit 43ba56a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/f2fs/node.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,10 +2092,14 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
20922092

20932093
ret = __write_node_folio(folio, false, &submitted,
20942094
wbc, do_balance, io_type, NULL);
2095-
if (ret)
2095+
if (ret) {
20962096
folio_unlock(folio);
2097-
else if (submitted)
2097+
folio_batch_release(&fbatch);
2098+
ret = -EIO;
2099+
goto out;
2100+
} else if (submitted) {
20982101
nwritten++;
2102+
}
20992103

21002104
if (--wbc->nr_to_write == 0)
21012105
break;

0 commit comments

Comments
 (0)