f2fs: allow to read node block after shutdown
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 9 Nov 2022 01:59:34 +0000 (17:59 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:58:47 +0000 (11:58 +0100)
commit e6ecb142429183cef4835f31d4134050ae660032 upstream.

If block address is still alive, we should give a valid node block even after
shutdown. Otherwise, we can see zero data when reading out a file.

Cc: stable@vger.kernel.org
Fixes: 83a3bfdb5a8a ("f2fs: indicate shutdown f2fs to allow unmount successfully")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/node.c

index 0e6e73b..f810c6b 100644 (file)
@@ -1357,8 +1357,7 @@ static int read_node_page(struct page *page, int op_flags)
                return err;
 
        /* NEW_ADDR can be seen, after cp_error drops some dirty node pages */
-       if (unlikely(ni.blk_addr == NULL_ADDR || ni.blk_addr == NEW_ADDR) ||
-                       is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN)) {
+       if (unlikely(ni.blk_addr == NULL_ADDR || ni.blk_addr == NEW_ADDR)) {
                ClearPageUptodate(page);
                return -ENOENT;
        }