Skip to content

Commit 2ff7cf7

Browse files
author
Andreas Gruenbacher
committed
gfs2: Call unlock_new_inode before d_instantiate
As Neil Brown describes in detail in the link referenced below, new inodes must be unlocked before they can be instantiated. An even better fix is to use d_instantiate_new(), which combines d_instantiate() and unlock_new_inode(). Fixes: 3d36e57 ("gfs2: gfs2_create_inode rework") Reported-by: syzbot+0ea5108a1f5fb4fcc2d8@syzkaller.appspotmail.com Link: https://lore.kernel.org/linux-fsdevel/177153754005.8396.8777398743501764194@noble.neil.brown.name/ Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 7141433 commit 2ff7cf7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/gfs2/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
892892
goto fail_gunlock4;
893893

894894
mark_inode_dirty(inode);
895-
d_instantiate(dentry, inode);
895+
d_instantiate_new(dentry, inode);
896896
/* After instantiate, errors should result in evict which will destroy
897897
* both inode and iopen glocks properly. */
898898
if (file) {
@@ -904,7 +904,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
904904
gfs2_glock_dq_uninit(&gh);
905905
gfs2_glock_put(io_gl);
906906
gfs2_qa_put(dip);
907-
unlock_new_inode(inode);
908907
return error;
909908

910909
fail_gunlock4:

0 commit comments

Comments
 (0)