* [PATCH] ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock
@ 2023-10-26 2:21 Al Viro
2023-10-27 13:38 ` Jeff Layton
2023-10-30 2:29 ` Xiubo Li
0 siblings, 2 replies; 3+ messages in thread
From: Al Viro @ 2023-10-26 2:21 UTC (permalink / raw)
To: Xiubo Li; +Cc: linux-fsdevel, ceph-devel
[at the moment in viro/vfs.git#fixes]
Use of dget() after we'd dropped ->d_lock is too late - dentry might
be gone by that point.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/ceph/mds_client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 615db141b6c4..293b93182955 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -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);
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock
2023-10-26 2:21 [PATCH] ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock Al Viro
@ 2023-10-27 13:38 ` Jeff Layton
2023-10-30 2:29 ` Xiubo Li
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2023-10-27 13:38 UTC (permalink / raw)
To: Al Viro, Xiubo Li; +Cc: linux-fsdevel, ceph-devel
On Thu, 2023-10-26 at 03:21 +0100, Al Viro wrote:
> [at the moment in viro/vfs.git#fixes]
> Use of dget() after we'd dropped ->d_lock is too late - dentry might
> be gone by that point.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> fs/ceph/mds_client.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 615db141b6c4..293b93182955 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -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);
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock
2023-10-26 2:21 [PATCH] ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock Al Viro
2023-10-27 13:38 ` Jeff Layton
@ 2023-10-30 2:29 ` Xiubo Li
1 sibling, 0 replies; 3+ messages in thread
From: Xiubo Li @ 2023-10-30 2:29 UTC (permalink / raw)
To: Al Viro; +Cc: linux-fsdevel, ceph-devel
On 10/26/23 10:21, Al Viro wrote:
> [at the moment in viro/vfs.git#fixes]
> Use of dget() after we'd dropped ->d_lock is too late - dentry might
> be gone by that point.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> fs/ceph/mds_client.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 615db141b6c4..293b93182955 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -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);
Good catch.
Thanks Al.
- Xiubo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-30 2:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-26 2:21 [PATCH] ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock Al Viro
2023-10-27 13:38 ` Jeff Layton
2023-10-30 2:29 ` Xiubo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).