f2fs: fix to avoid deadlock when merging inline data
[deliverable/linux.git] / fs / f2fs / node.c
index 7b613dd16e77bd567ae296197884032acbee23d9..d714b607bf468bca43f9e3423b7cbc40c3400d84 100644 (file)
@@ -1203,10 +1203,13 @@ 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_LOCK|FGP_NOWAIT, 0);
+       page = pagecache_get_page(inode->i_mapping, 0, FGP_NOWAIT, 0);
        if (!page)
                goto iput_out;
 
+       if (!trylock_page(page))
+               goto release_out;
+
        if (!PageUptodate(page))
                goto page_out;
 
@@ -1221,7 +1224,9 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)
        else
                set_page_dirty(page);
 page_out:
-       f2fs_put_page(page, 1);
+       unlock_page(page);
+release_out:
+       f2fs_put_page(page, 0);
 iput_out:
        iput(inode);
 }
This page took 0.025259 seconds and 5 git commands to generate.