[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ceph-devel
Subject:    Re: [PATCH] ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock
From:       Xiubo Li <xiubli () redhat ! com>
Date:       2023-10-30 2:29:55
Message-ID: 209b187c-f471-6921-4cda-7293e362d729 () redhat ! com
[Download RAW message or body]


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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic