f2fs: fix deadlock in add_link failure
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 7 Jun 2016 21:34:22 +0000 (14:34 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 13 Jun 2016 18:55:25 +0000 (11:55 -0700)
mkdir                        sync_dirty_inode
 - init_inode_metadata
   - lock_page(node)
   - make_empty_dir
                             - filemap_fdatawrite()
                              - do_writepages
                              - lock_page(data)
                              - write_page(data)
                               - lock_page(node)
   - f2fs_init_acl
    - error
   - truncate_inode_pages
    - lock_page(data)

So, we don't need to truncate data pages in this error case, which will
be done by f2fs_evict_inode.

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

index f6ab3c2f814508ad030868091b85991a453e63f2..486482468abbdb74ed91653e47873a68062c510f 100644 (file)
@@ -450,9 +450,6 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
        return page;
 
 put_error:
-       /* truncate empty dir pages */
-       truncate_inode_pages(&inode->i_data, 0);
-
        clear_nlink(inode);
        update_inode(inode, page);
        f2fs_put_page(page, 1);