* [PATCH 1/2] ceph: update ceph_dentry_info::lease_session when necessary
@ 2017-07-06 8:02 Yan, Zheng
2017-07-06 13:21 ` Jeff Layton
0 siblings, 1 reply; 2+ messages in thread
From: Yan, Zheng @ 2017-07-06 8:02 UTC (permalink / raw)
To: ceph-devel; +Cc: jlayton, Yan, Zheng
Current code does not update ceph_dentry_info::lease_session once
it is set. If auth mds of corresponding dentry changes, dentry lease
stays in invalid state.
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
---
fs/ceph/inode.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 53f23c9..220dfd8 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1016,6 +1016,7 @@ static void update_dentry_lease(struct dentry *dentry,
long unsigned ttl = from_time + (duration * HZ) / 1000;
long unsigned half_ttl = from_time + (duration * HZ / 2) / 1000;
struct inode *dir;
+ struct ceph_mds_session *old_lease_session = NULL;
/*
* Make sure dentry's inode matches tgt_vino. NULL tgt_vino means that
@@ -1051,8 +1052,10 @@ static void update_dentry_lease(struct dentry *dentry,
time_before(ttl, di->time))
goto out_unlock; /* we already have a newer lease. */
- if (di->lease_session && di->lease_session != session)
- goto out_unlock;
+ if (di->lease_session && di->lease_session != session) {
+ old_lease_session = di->lease_session;
+ di->lease_session = NULL;
+ }
ceph_dentry_lru_touch(dentry);
@@ -1065,6 +1068,8 @@ static void update_dentry_lease(struct dentry *dentry,
di->time = ttl;
out_unlock:
spin_unlock(&dentry->d_lock);
+ if (old_lease_session)
+ ceph_put_mds_session(old_lease_session);
return;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] ceph: update ceph_dentry_info::lease_session when necessary
2017-07-06 8:02 [PATCH 1/2] ceph: update ceph_dentry_info::lease_session when necessary Yan, Zheng
@ 2017-07-06 13:21 ` Jeff Layton
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2017-07-06 13:21 UTC (permalink / raw)
To: Yan, Zheng, ceph-devel
On Thu, 2017-07-06 at 16:02 +0800, Yan, Zheng wrote:
> Current code does not update ceph_dentry_info::lease_session once
> it is set. If auth mds of corresponding dentry changes, dentry lease
> stays in invalid state.
>
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> ---
> fs/ceph/inode.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index 53f23c9..220dfd8 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -1016,6 +1016,7 @@ static void update_dentry_lease(struct dentry *dentry,
> long unsigned ttl = from_time + (duration * HZ) / 1000;
> long unsigned half_ttl = from_time + (duration * HZ / 2) / 1000;
> struct inode *dir;
> + struct ceph_mds_session *old_lease_session = NULL;
>
> /*
> * Make sure dentry's inode matches tgt_vino. NULL tgt_vino means that
> @@ -1051,8 +1052,10 @@ static void update_dentry_lease(struct dentry *dentry,
> time_before(ttl, di->time))
> goto out_unlock; /* we already have a newer lease. */
>
> - if (di->lease_session && di->lease_session != session)
> - goto out_unlock;
> + if (di->lease_session && di->lease_session != session) {
> + old_lease_session = di->lease_session;
> + di->lease_session = NULL;
> + }
>
> ceph_dentry_lru_touch(dentry);
>
> @@ -1065,6 +1068,8 @@ static void update_dentry_lease(struct dentry *dentry,
> di->time = ttl;
> out_unlock:
> spin_unlock(&dentry->d_lock);
> + if (old_lease_session)
> + ceph_put_mds_session(old_lease_session);
> return;
> }
>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-06 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 8:02 [PATCH 1/2] ceph: update ceph_dentry_info::lease_session when necessary Yan, Zheng
2017-07-06 13:21 ` Jeff Layton
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.