Skip to content

Commit

Permalink
ceph: update ceph_dentry_info::lease_session when necessary
Browse files Browse the repository at this point in the history
Current code does not update ceph_dentry_info::lease_session once
it is set. If auth mds of corresponding dentry changes, dentry lease
keeps in an invalid state.

Signed-off-by: "Yan, Zheng" <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
ukernel authored and idryomov committed Jul 7, 2017
1 parent 1d8f836 commit 481f001
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/ceph/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand All @@ -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;
}

Expand Down

0 comments on commit 481f001

Please sign in to comment.