From: Xiubo Li Subject: Re: [PATCH v4] ceph: skip checking the caps when session reconnecting and releasing reqs Date: Wed, 27 May 2020 20:45:21 +0800 Message-ID: <32467f5a-26e3-4042-84de-dfaf57bf1977@redhat.com> References: <1590562634-29610-1-git-send-email-xiubli@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44119 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728513AbgE0Mpc (ORCPT ); Wed, 27 May 2020 08:45:32 -0400 In-Reply-To: Content-Language: en-US Sender: ceph-devel-owner@vger.kernel.org List-ID: To: Jeff Layton , idryomov@gmail.com, zyan@redhat.com Cc: pdonnell@redhat.com, ceph-devel@vger.kernel.org On 2020/5/27 20:19, Jeff Layton wrote: > On Wed, 2020-05-27 at 02:57 -0400, xiubli@redhat.com wrote: >> From: Xiubo Li >> >> It make no sense to check the caps when reconnecting to mds. And >> for the async dirop caps, they will be put by its _cb() function, >> so when releasing the requests, it will make no sense too. >> >> URL: https://tracker.ceph.com/issues/45635 >> Signed-off-by: Xiubo Li >> --- >> >> Changed in V2: >> - do not check the caps when reconnecting to mds >> - switch ceph_async_check_caps() to ceph_async_put_cap_refs() >> >> Changed in V3: >> - fix putting the cap refs leak >> >> Changed in V4: >> - drop ceph_async_check_caps() stuff. >> >> > Sigh. I guess this will fix the original issue, but it's just more > evidence that the locking in this code are an absolute shitshow, > particularly when it comes to the session mutex. > > Rather than working around it like this, we ought to be coming up with > ways to reduce the need for the session mutex altogether, particularly > in the cap handling code. Doing that means that we need to identify what > the session mutex actually protects of course, and so far I've not been > very successful in determining that. > > Mostly, it looks like it's used to provide high-level serialization much > like the client mutex in libcephfs, but it's per-session, and ends up > having to be inverted wrt the mdsc mutex all over the place. > > Maybe instead of this, we ought to look at getting rid of the session > mutex altogether -- fold the existing usage of it into the mdsc->mutex. > We'd end up serializing things even more that way, but the session mutex > is already so coarse-grained that it'd probably not affect performance > that much. It would certainly make the locking a _lot_ simpler. Yeah, this sound good, but it will be a great amount of work IMO. [...] >> >> -void ceph_mdsc_release_dir_caps(struct ceph_mds_request *req) >> +void ceph_mdsc_release_dir_caps(struct ceph_mds_request *req, >> + bool skip_checking_caps) > Can we add a ceph_mdsc_release_dir_caps_no_check() instead of a boolean > argument? That at least better communicates what the function does to > someone reading the code. > > Those can just be wrappers around the function that does take a boolean > if need be (similar to ceph_put_cap_refs[_no_check_caps]). Yeah, sure. Will fix it. Thanks BRs Xiubo