mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <slava@dubeyko.com>
To: deepakroag <gaikwad.dcg@gmail.com>,
	Ilya Dryomov <idryomov@gmail.com>,
	 Alex Markuze <amarkuze@redhat.com>,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix: release unused ceph cap reservation on readdir error
Date: Thu, 16 Jul 2026 10:24:38 -0700	[thread overview]
Message-ID: <544d89dcd4303cde366537744fb2182ebc1622ba.camel@dubeyko.com> (raw)
In-Reply-To: <20260715181612.18192-1-gaikwad.dcg@gmail.com>

On Wed, 2026-07-15 at 23:46 +0530, deepakroag wrote:
> Return unused reserved caps to the MDS client pool when
> ceph_readdir_prepopulate() exits with an error.
> 
> Corrected standalone submission: this patch was mistakenly
> sent earlier as [PATCH 4/4] in an unrelated multi-subsystem
> series.  It is ceph-only and resubmitted here as [PATCH 1/1].

Frankly speaking, it will be better to explain the issue detection and
analysis here.

> 
> Link:
> https://lore.kernel.org/ceph-devel/20260715143646.15828-4-gaikwad.dcg@gmail.com/
> 
> Signed-off-by: deepakroag <gaikwad.dcg@gmail.com>
> ---
>  fs/ceph/inode.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index 61d7c0b81..2d6a80054 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -2188,6 +2188,8 @@ int ceph_readdir_prepopulate(struct
> ceph_mds_request *req,
>  		dput(dn);
>  	}
>  out:
> +	if (err)
> +		ceph_unreserve_caps(req->r_mdsc, &req-
> >r_caps_reservation);
>  	if (err == 0 && skipped == 0) {
>  		set_bit(CEPH_MDS_R_DID_PREPOPULATE, &req-
> >r_req_flags);
>  		req->r_readdir_cache_idx = cache_ctl.index;

OK. So, we need to do this because handle_reply() [1] execute this
after ceph_readdir_prepopulate():

  if (err == 0) {
      ...
      ceph_unreserve_caps(mdsc, &req->r_caps_reservation);
  }

However, we are missing another execution branch [2]:

  if (test_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags))
      return readdir_prepopulate_inodes_only(req, session);

I believe that we need to improve the patch.

Thanks,
Slava.

[1]
https://elixir.bootlin.com/linux/v7.2-rc3/source/fs/ceph/mds_client.c#L4186
[2]
https://elixir.bootlin.com/linux/v7.2-rc3/source/fs/ceph/inode.c#L2017

      reply	other threads:[~2026-07-16 17:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 18:16 deepakroag
2026-07-16 17:24 ` 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=544d89dcd4303cde366537744fb2182ebc1622ba.camel@dubeyko.com \
    --to=slava@dubeyko.com \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=gaikwad.dcg@gmail.com \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®