ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock

Use of dget() after we'd dropped ->d_lock is too late - dentry might
be gone by that point.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2023-09-14 21:55:29 -04:00
parent 1939316bf9
commit dc32464a5f

View File

@ -861,8 +861,8 @@ int ceph_wait_on_conflict_unlink(struct dentry *dentry)
if (!d_same_name(udentry, pdentry, &dname))
goto next;
found = dget_dlock(udentry);
spin_unlock(&udentry->d_lock);
found = dget(udentry);
break;
next:
spin_unlock(&udentry->d_lock);