Skip to content

Commit 45b6764

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 caf4494 commit 45b6764

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
@@ -893,7 +893,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
893893
goto fail_gunlock4;
894894

895895
mark_inode_dirty(inode);
896-
d_instantiate(dentry, inode);
896+
d_instantiate_new(dentry, inode);
897897
/* After instantiate, errors should result in evict which will destroy
898898
* both inode and iopen glocks properly. */
899899
if (file) {
@@ -905,7 +905,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
905905
gfs2_glock_dq_uninit(&gh);
906906
gfs2_glock_put(io_gl);
907907
gfs2_qa_put(dip);
908-
unlock_new_inode(inode);
909908
return error;
910909

911910
fail_gunlock4:

0 commit comments

Comments
 (0)