]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: return the errno to the caller to avoid using a wrong page
authorYunlong Song <yunlong.song@huawei.com>
Thu, 26 May 2016 11:40:29 +0000 (19:40 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 3 Jun 2016 01:05:22 +0000 (18:05 -0700)
commit6edcf0df86b2c0997bf23e9190f706387b5307a7
tree4bfa8b93bca932f3643bef2c69e19af40564baa5
parente776f778faa6b96a0b40836179b0a26af262d278
f2fs: return the errno to the caller to avoid using a wrong page

Commit cc7a8ce11f1462ad98ee4e35d5ff46fd8e7899d5 ("f2fs: check node page
contents all the time") pointed out that "sometimes it was reported that
its contents was missing", so it checks the page's mapping and contents.
When "nid != nid_of_node(page)", ERR_PTR(-EIO) will be returned to the
caller. However, commit 8a53d61d63bf606c11261c454e2a3bcf9b715add ("f2fs:
clean up node page updating flow") moves "nid != nid_of_node(page)" test
to "f2fs_bug_on(sbi, nid != nid_of_node(page))", this will return a
wrong page to the caller when F2FS_CHECK_FS is off when "sometimes it
was reported that its contents was missing" happens.

This patch restores to check node page contents all the time, and
returns the errno to make the caller known something is wrong and avoid
to use the page. This patch also moves f2fs_bug_on to its proper location.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c