A question about "lease issued to client" in ceph mds
Hi:
I want to ask a question about "lease issued to client".
In ceph source, src/mds/Locker.cc: Locker::issue_client_lease:
if(... &&
(!diri->filelock.can_lease(client) &&
(diri->get_client_cap_pending(client) & (CEPH_CAP_FILE_SHARED | CEPH_CAP_FILE_EXCL)) == 0) &&
dn->lock.can_lease(client)) {
...
// issue a dentry lease
ClientLease *l = dn->add_client_lease(client, session);
...
LeaseStat e;
...
e.duration_ms = (int)(1000 * mdcache->client_lease_durations[pool]);
...
} else {
// null lease
LeaseStat e;
...
e.duration_ms = 0;
...
}
So my understanding is:
If parent directory has no lease, but has CEPH_CAP_FILE_SHARED mask, then the dentry can get a lease of 30s(caculated from duration_ms).
Else if in other conditions, then the dentry get a lease of 0s.
I am confused here, in what situation does the parent directory and the child dentry share a lease?
And in what situation does the child dentry have no lease(lease of zero seconds?)?
Could you please explain further?Thank you for your reading, I really appreciate your response. Thanks.