public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "max.kellermann@ionos.com" <max.kellermann@ionos.com>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>,
	"idryomov@gmail.com" <idryomov@gmail.com>,
	Alex Markuze <amarkuze@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: RE: [PATCH] ceph: fix hanging __ceph_get_caps() with stale `mds_wanted`
Date: Wed, 29 Apr 2026 19:07:38 +0000	[thread overview]
Message-ID: <8f415e00b3a990ee7733ff9339a5f72ff3689dd3.camel@ibm.com> (raw)
In-Reply-To: <CAKPOu+8Yumexe=Athx_fjtoNbTBgP2ENQrXx=idmkNeUwE9v4w@mail.gmail.com>

On Wed, 2026-04-29 at 06:27 +0200, Max Kellermann wrote:
> On Tue, Apr 28, 2026 at 8:46 PM Viacheslav Dubeyko
> <Slava.Dubeyko@ibm.com> wrote:
> > >                       flags |= NON_BLOCKING;
> > >                       while (!(ret = try_get_cap_refs(inode, need, want,
> > >                                                       endoff, flags, &_got))) {
> > > +                             static const unsigned long wait_timeout = 5 * HZ;
> > 
> > Why exactly 5 * HZ? What is the basis for this timeout? Could we re-use any
> > available timeouts in CephFS declarations?
> 
> It is an arbitrary timeout, long enough to avoid unnecessary wakeups
> in regular situations where we're really waiting for a capability, but
> short enough to avoid disrupting the service. If you prefer another
> number, say it, and I'll change it.
> 
> On our servers, this hang bug occurs very rarely. Sometimes, weeks go
> by without a hang, and sometimes twice a day, but no more. When it
> happens, I thought it's fine to wait 5 seconds before attempting to
> recover.
> 
> Note that this is still a minimal workaround, not a proper fix, as I
> wrote. The proper fix would be much more intrusive (and of course go
> without any hard-coded timeouts and arbitrary wakeups).

I have nothing in mind as another value. I think it will be good to introduce
the declaration of timeout:

#define CEPH_GET_CAPS_WAIT_TIMEOUT (5 * HZ)

And, probably, we need to introduce it with other timeouts [1].

> 
> > >                       if (ret == -EUCLEAN) {
> > > -                             /* session was killed, try renew caps */
> > > -                             ret = ceph_renew_caps(inode, flags);
> > > +                             /* session was killed or a waited cap
> > > +                              * request needs a retry */
> > > +                             ret = ceph_renew_caps(inode, flags & CEPH_FILE_MODE_MASK);
> > 
> > Frankly speaking, I don't quite follow why do we need to add flags &
> > CEPH_FILE_MODE_MASK?
> 
> Oh, this is an unrelated fix.  This "flags" variable contains internal
> flags that are not understood by ceph_renew_caps() (i.e.
> CHECK_FILELOCK and NON_BLOCKING) and shouldn't really be passed there.
> 
> I'll remove that change from the patch for v2 because while I believe
> it's correct, it has nothing to do with this bug.  I'll post v2 when
> we agree on the rest of the patch.

I assume that flags & CEPH_FILE_MODE_MASK cleans the NON_BLOCKING flag. Am I
correct? So, it looks like this fix also necessary. Am I right?

The patch make sense to me.

Thanks,
Slava.

[1]
https://elixir.bootlin.com/linux/v7.0.1/source/include/linux/ceph/libceph.h#L72

      reply	other threads:[~2026-04-29 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 15:58 [PATCH] ceph: fix hanging __ceph_get_caps() with stale `mds_wanted` Max Kellermann
2026-04-28 18:46 ` Viacheslav Dubeyko
2026-04-29  4:27   ` Max Kellermann
2026-04-29 19:07     ` Viacheslav Dubeyko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f415e00b3a990ee7733ff9339a5f72ff3689dd3.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.kellermann@ionos.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox