diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index d635c58cf5a3..89fc5a943569 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -736,12 +736,12 @@ int f2fs_add_regular_entry(struct inode *dir, const struct f2fs_filename *fname, f2fs_wait_on_page_writeback(dentry_page, DATA, true, true); if (inode) { - f2fs_down_write(&F2FS_I(inode)->i_sem); page = f2fs_init_inode_metadata(inode, dir, fname, NULL); if (IS_ERR(page)) { err = PTR_ERR(page); goto fail; } + f2fs_down_write(&F2FS_I(inode)->i_sem); } make_dentry_ptr_block(NULL, &d, dentry_blk);