Skip to content

Commit

Permalink
gfs2: Handle -EBUSY result of insert_inode_locked4
Browse files Browse the repository at this point in the history
When creating a new inode, there is a small chance that an inode lookup
for a previous version of the same inode is still in progress.  In that
case, that previous lookup will eventually fail, but we may still need
to retry here.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
  • Loading branch information
Andreas Gruenbacher committed Dec 5, 2022
1 parent 38552ff commit 4ec3c19
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,12 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
goto fail_free_inode;
gfs2_cancel_delete_work(io_gl);

retry:
error = insert_inode_locked4(inode, ip->i_no_addr, iget_test, &ip->i_no_addr);
BUG_ON(error);
if (error == -EBUSY)
goto retry;
if (error)
goto fail_gunlock2;

error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT | GL_NOPID,
&ip->i_iopen_gh);
Expand Down

0 comments on commit 4ec3c19

Please sign in to comment.