f2fs: fix to avoid deadlock in f2fs_read_inline_dir()
[linux-2.6-block.git] / fs / f2fs / inline.c
index a1381d05956b380a238ac402b0465195c84a6c89..bb6a152310ef437109a3a2b03a6c5413411e4308 100644 (file)
@@ -659,6 +659,12 @@ int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx,
        if (IS_ERR(ipage))
                return PTR_ERR(ipage);
 
+       /*
+        * f2fs_readdir was protected by inode.i_rwsem, it is safe to access
+        * ipage without page's lock held.
+        */
+       unlock_page(ipage);
+
        inline_dentry = inline_data_addr(inode, ipage);
 
        make_dentry_ptr_inline(inode, &d, inline_dentry);
@@ -667,7 +673,7 @@ int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx,
        if (!err)
                ctx->pos = d.max;
 
-       f2fs_put_page(ipage, 1);
+       f2fs_put_page(ipage, 0);
        return err < 0 ? err : 0;
 }