f2fs: use PGP_LOCK to check its truncation
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 30 Mar 2016 18:25:31 +0000 (11:25 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 15 Apr 2016 15:49:47 +0000 (08:49 -0700)
Previously, after trylock_page is succeeded, it doesn't check its mapping.
In order to fix that, we can just give PGP_LOCK to pagecache_get_page.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c

index 1a33de9d84b16a68202ee410cafc4f9ba1353e11..ade221c9756b3fb8dfdcd171114c6e1041e55180 100644 (file)
@@ -1202,13 +1202,10 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)
        if (!inode)
                return;
 
-       page = pagecache_get_page(inode->i_mapping, 0, FGP_NOWAIT, 0);
+       page = pagecache_get_page(inode->i_mapping, 0, FGP_LOCK|FGP_NOWAIT, 0);
        if (!page)
                goto iput_out;
 
-       if (!trylock_page(page))
-               goto release_out;
-
        if (!PageUptodate(page))
                goto page_out;
 
@@ -1223,9 +1220,7 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)
        else
                set_page_dirty(page);
 page_out:
-       unlock_page(page);
-release_out:
-       f2fs_put_page(page, 0);
+       f2fs_put_page(page, 1);
 iput_out:
        iput(inode);
 }
This page took 0.026976 seconds and 5 git commands to generate.