Skip to contentSkip to conversation

is the renewal in dentry_lease_is_valid necessary?

DISCUSSION Jeff Layton 4 participants 7 messages Jun 27, 2016 – Jun 29, 2016

lore
Share & tools
lore
#0 lore raw

I'm eyeballing how to make ceph dentry revalidation occur in rcu-walk mode in the kernel cephfs client. It looks fairly straightforward, but for one thing:

dentry_lease_is_valid queues an asynchronous lease renewal if we're halfway to the next lease renewal time:

        if (session) {
                ceph_mdsc_lease_send_msg(session, dir, dentry, CEPH_MDS_LEASE_RENEW, seq); ceph_put_mds_session(session);
        }

That can sleep, so we have to drop out of rcu walk mode in that case.

Is this lease renewal strictly necessary? I can make the code drop out of rcuwalk mode and try again in that case, but if this is just an opportunistic thing, then it may be better for performance to take a pass on renewing the lease early if we're still in RCU walk mode.

Signature · 6 lines
Jeff Layton <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 13 lines · Jeff Layton

I'm eyeballing how to make ceph dentry revalidation occur in rcu-walk mode in the kernel cephfs client. It looks fairly straightforward, but for one thing:

dentry_lease_is_valid queues an asynchronous lease renewal if we're halfway to the next lease renewal time:

        if (session) {
                ceph_mdsc_lease_send_msg(session, dir, dentry,
                                         CEPH_MDS_LEASE_RENEW, seq);
                ceph_put_mds_session(session);
        }
Quoted 6 lines

That can sleep, so we have to drop out of rcu walk mode in that case.

Is this lease renewal strictly necessary? I can make the code drop out of rcuwalk mode and try again in that case, but if this is just an opportunistic thing, then it may be better for performance to take a pass on renewing the lease early if we're still in RCU walk mode.

I'm just guessing based on the function names (and what I know of the algorithms), but as long as something *else* will do the renewal, it shouldn't need to be done here. There's nothing magic about half the lease time.
-Greg

#2 lore raw
In reply to Jeff Layton
Quoted 13 lines · Jeff Layton

I'm eyeballing how to make ceph dentry revalidation occur in rcu-walk mode in the kernel cephfs client. It looks fairly straightforward, but for one thing:

dentry_lease_is_valid queues an asynchronous lease renewal if we're halfway to the next lease renewal time:

        if (session) {
                ceph_mdsc_lease_send_msg(session, dir, dentry,
                                         CEPH_MDS_LEASE_RENEW, seq);
                ceph_put_mds_session(session);
        }
Quoted 7 lines

That can sleep, so we have to drop out of rcu walk mode in that case.

Is this lease renewal strictly necessary? I can make the code drop out of rcuwalk mode and try again in that case, but if this is just an opportunistic thing, then it may be better for performance to take a pass on renewing the lease early if we're still in RCU walk mode.

dentry_lease_is_valid is the only place that renew lease. I think it's better to drop out of rcuwalk and try again

Regards
Yan, Zheng

Quoted 7 lines

--
Jeff Layton <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 22 lines · Zheng
Quoted 14 lines · Jeff Layton

I'm eyeballing how to make ceph dentry revalidation occur in rcu-walk mode in the kernel cephfs client. It looks fairly straightforward, but for one thing:

dentry_lease_is_valid queues an asynchronous lease renewal if we're halfway to the next lease renewal time:

        if (session) {
                ceph_mdsc_lease_send_msg(session, dir, dentry, CEPH_MDS_LEASE_RENEW, seq); ceph_put_mds_session(session);
        }

Quoted 7 lines

That can sleep, so we have to drop out of rcu walk mode in that case.

Is this lease renewal strictly necessary? I can make the code drop out of rcuwalk mode and try again in that case, but if this is just an opportunistic thing, then it may be better for performance to take a pass on renewing the lease early if we're still in RCU walk mode.

Quoted 6 lines

dentry_lease_is_valid is the only place that renew lease. I think it's better to drop out of rcuwalk and try again

Regards
Yan, Zheng

That seems really odd to me.

That call is only ever done in the d_revalidate codepath, so you'll only get a lease renewal when you have repeated path-based access to an existing dentry.

Maybe this means that I don't really understand ceph leases. More questions...

What exactly does the lease cover here?

Shouldn't we be renewing it even if we're _not_ doing any path-based access? For instance, if I open a file and issue reads and writes against it, that doesn't involve pathnames and the lease doesn't get an explicit renewal. Doesn't it still need to be renewed though?

Signature · 5 lines
Jeff Layton <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 39 lines · Jeff Layton
Quoted 22 lines · Zheng
Quoted 14 lines · Jeff Layton

I'm eyeballing how to make ceph dentry revalidation occur in rcu-walk mode in the kernel cephfs client. It looks fairly straightforward, but for one thing:

dentry_lease_is_valid queues an asynchronous lease renewal if we're halfway to the next lease renewal time:

        if (session) {
                ceph_mdsc_lease_send_msg(session, dir, dentry,
                                         CEPH_MDS_LEASE_RENEW, seq);
                ceph_put_mds_session(session);
        }
Quoted 7 lines

That can sleep, so we have to drop out of rcu walk mode in that case.

Is this lease renewal strictly necessary? I can make the code drop out of rcuwalk mode and try again in that case, but if this is just an opportunistic thing, then it may be better for performance to take a pass on renewing the lease early if we're still in RCU walk mode.

Quoted 6 lines

dentry_lease_is_valid is the only place that renew lease. I think it's better to drop out of rcuwalk and try again

Regards
Yan, Zheng

That seems really odd to me.

That call is only ever done in the d_revalidate codepath, so you'll only get a lease renewal when you have repeated path-based access to an existing dentry.

Maybe this means that I don't really understand ceph leases. More questions...

Quoted 6 lines

What exactly does the lease cover here?

Shouldn't we be renewing it even if we're _not_ doing any path-based access? For instance, if I open a file and issue reads and writes against it, that doesn't involve pathnames and the lease doesn't get an explicit renewal. Doesn't it still need to be renewed though?

Ah. Leases cover the dentries, and are separate from the capabilities covering file IO and the inode itself. So actually, no, if nobody is doing dentry operations (directory listing, name resolution, etc) we don't care.

This isn't a part of the protocol I'm very familiar with (it doesn't really come up in userspace code), but that might mean it's easier to understand if you look at the userspace version of it...? -Greg

#5 lore raw
In reply to Jeff Layton
Quoted 35 lines · Jeff Layton
Quoted 22 lines · Zheng
Quoted 14 lines · Jeff Layton

I'm eyeballing how to make ceph dentry revalidation occur in rcu-walk mode in the kernel cephfs client. It looks fairly straightforward, but for one thing:

dentry_lease_is_valid queues an asynchronous lease renewal if we're halfway to the next lease renewal time:

        if (session) {
                ceph_mdsc_lease_send_msg(session, dir, dentry,
                                         CEPH_MDS_LEASE_RENEW, seq);
                ceph_put_mds_session(session);
        }
Quoted 7 lines

That can sleep, so we have to drop out of rcu walk mode in that case.

Is this lease renewal strictly necessary? I can make the code drop out of rcuwalk mode and try again in that case, but if this is just an opportunistic thing, then it may be better for performance to take a pass on renewing the lease early if we're still in RCU walk mode.

Quoted 6 lines

dentry_lease_is_valid is the only place that renew lease. I think it's better to drop out of rcuwalk and try again

Regards
Yan, Zheng

That seems really odd to me.

Quoted 8 lines

That call is only ever done in the d_revalidate codepath, so you'll only get a lease renewal when you have repeated path-based access to an existing dentry.

Maybe this means that I don't really understand ceph leases. More questions...

What exactly does the lease cover here?

Lease covers dentry. MDS revoke release before changing dentry’s linkage. If client access a dentry frequently, it should renew the dentry lease when necessary. If dentry lease expires, client need to send a lookup request if it want to access the dentry.

Yan, Zheng

Quoted 8 lines

Shouldn't we be renewing it even if we're _not_ doing any path-based access? For instance, if I open a file and issue reads and writes against it, that doesn't involve pathnames and the lease doesn't get an explicit renewal. Doesn't it still need to be renewed though?

Signature · 1 line
Jeff Layton <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 52 lines · Zheng
Quoted 52 lines · Jeff Layton
Quoted 34 lines · Zheng
Quoted 22 lines · Jeff Layton

I'm eyeballing how to make ceph dentry revalidation occur in rcu-walk
mode in the kernel cephfs client. It looks fairly straightforward, but
for one thing:

dentry_lease_is_valid queues an asynchronous lease renewal if we're
halfway to the next lease renewal time:

        if (session) { ceph_mdsc_lease_send_msg(session, dir, dentry, CEPH_MDS_LEASE_RENEW, seq);
                ceph_put_mds_session(session);
        }

That can sleep, so we have to drop out of rcu walk mode in that case.

Quoted 9 lines

Is this lease renewal strictly necessary? I can make the code drop out
of rcuwalk mode and try again in that case, but if this is just an
opportunistic thing, then it may be better for performance to take a
pass on renewing the lease early if we're still in RCU walk mode.

Quoted 7 lines

dentry_lease_is_valid is the only place that renew lease. I think it's
better to drop out of rcuwalk and try again

Regards
Yan, Zheng

That seems really odd to me.

That call is only ever done in the d_revalidate codepath, so you'll only get a lease renewal when you have repeated path-based access to an
existing dentry.

Quoted 9 lines
Quoted 4 lines

Maybe this means that I don't really understand ceph leases. More questions...

What exactly does the lease cover here?

Lease covers dentry. MDS revoke release before changing dentry’s linkage. If client access a dentry frequently, it should renew the dentry lease when necessary. If dentry lease expires, client need to send a lookup request if it want to access the dentry.

Ok, got it, thanks. In that case, what might be better is to queue the lease renewal to a workqueue and stay in RCU lookup mode. It's not like we're planning to wait around on the reply so dropping out of RCU mode is probably not what we want. I'll take a look at whether it makes sense to embed a work_struct in the ceph_dentry_info.

Signature · 6 lines
Jeff Layton <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html