All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: update the dlease for the hashed dentry when removing
@ 2022-03-30  5:49 xiubli
  2022-03-30 10:39 ` Jeff Layton
  0 siblings, 1 reply; 3+ messages in thread
From: xiubli @ 2022-03-30  5:49 UTC (permalink / raw)
  To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li

From: Xiubo Li <xiubli@redhat.com>

The MDS will always refresh the dentry lease when removing the files
or directories. And if the dentry is still hashed, we can update
the dentry lease and no need to do the lookup from the MDS later.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 64b341f5e7bc..8cf55e6e609e 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1467,10 +1467,12 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
 			} else if (have_lease) {
 				if (d_unhashed(dn))
 					d_add(dn, NULL);
+			}
+
+			if (!d_unhashed(dn) && have_lease)
 				update_dentry_lease(dir, dn,
 						    rinfo->dlease, session,
 						    req->r_request_started);
-			}
 			goto done;
 		}
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ceph: update the dlease for the hashed dentry when removing
  2022-03-30  5:49 [PATCH] ceph: update the dlease for the hashed dentry when removing xiubli
@ 2022-03-30 10:39 ` Jeff Layton
  2022-03-30 10:42   ` Xiubo Li
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2022-03-30 10:39 UTC (permalink / raw)
  To: xiubli; +Cc: idryomov, vshankar, ceph-devel

On Wed, 2022-03-30 at 13:49 +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> The MDS will always refresh the dentry lease when removing the files
> or directories. And if the dentry is still hashed, we can update
> the dentry lease and no need to do the lookup from the MDS later.
> 
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/inode.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index 64b341f5e7bc..8cf55e6e609e 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -1467,10 +1467,12 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
>  			} else if (have_lease) {
>  				if (d_unhashed(dn))
>  					d_add(dn, NULL);
> +			}
> +
> +			if (!d_unhashed(dn) && have_lease)
>  				update_dentry_lease(dir, dn,
>  						    rinfo->dlease, session,
>  						    req->r_request_started);
> -			}
>  			goto done;
>  		}
>  

I think this makes sense, since we can have a lease for a negative
dentry.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ceph: update the dlease for the hashed dentry when removing
  2022-03-30 10:39 ` Jeff Layton
@ 2022-03-30 10:42   ` Xiubo Li
  0 siblings, 0 replies; 3+ messages in thread
From: Xiubo Li @ 2022-03-30 10:42 UTC (permalink / raw)
  To: Jeff Layton; +Cc: idryomov, vshankar, ceph-devel


On 3/30/22 6:39 PM, Jeff Layton wrote:
> On Wed, 2022-03-30 at 13:49 +0800, xiubli@redhat.com wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> The MDS will always refresh the dentry lease when removing the files
>> or directories. And if the dentry is still hashed, we can update
>> the dentry lease and no need to do the lookup from the MDS later.
>>
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>   fs/ceph/inode.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
>> index 64b341f5e7bc..8cf55e6e609e 100644
>> --- a/fs/ceph/inode.c
>> +++ b/fs/ceph/inode.c
>> @@ -1467,10 +1467,12 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
>>   			} else if (have_lease) {
>>   				if (d_unhashed(dn))
>>   					d_add(dn, NULL);
>> +			}
>> +
>> +			if (!d_unhashed(dn) && have_lease)
>>   				update_dentry_lease(dir, dn,
>>   						    rinfo->dlease, session,
>>   						    req->r_request_started);
>> -			}
>>   			goto done;
>>   		}
>>   
> I think this makes sense, since we can have a lease for a negative
> dentry.

Yeah, from the logs there really has many case will do that.

Thanks Jeff.

>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-30 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30  5:49 [PATCH] ceph: update the dlease for the hashed dentry when removing xiubli
2022-03-30 10:39 ` Jeff Layton
2022-03-30 10:42   ` Xiubo Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.