Skip to content

Commit 232d679

Browse files
Andreas Gruenbachergregkh
authored andcommitted
gfs2: Call unlock_new_inode before d_instantiate
[ Upstream commit 2ff7cf7 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 18216b8 commit 232d679

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
@@ -805,7 +805,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
805805
goto fail_gunlock4;
806806

807807
mark_inode_dirty(inode);
808-
d_instantiate(dentry, inode);
808+
d_instantiate_new(dentry, inode);
809809
/* After instantiate, errors should result in evict which will destroy
810810
* both inode and iopen glocks properly. */
811811
if (file) {
@@ -817,7 +817,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
817817
gfs2_glock_dq_uninit(&gh);
818818
gfs2_glock_put(io_gl);
819819
gfs2_qa_put(dip);
820-
unlock_new_inode(inode);
821820
return error;
822821

823822
fail_gunlock4:

0 commit comments

Comments
 (0)