mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fix: release unused ceph cap reservation on readdir error
@ 2026-07-15 18:16 deepakroag
  2026-07-16 17:24 ` Viacheslav Dubeyko
  0 siblings, 1 reply; 2+ messages in thread
From: deepakroag @ 2026-07-15 18:16 UTC (permalink / raw)
  To: Ilya Dryomov, Alex Markuze, Viacheslav Dubeyko, ceph-devel, linux-kernel

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].

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;
-- 
Deepak Rao Gaikwad


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix: release unused ceph cap reservation on readdir error
  2026-07-15 18:16 [PATCH] fix: release unused ceph cap reservation on readdir error deepakroag
@ 2026-07-16 17:24 ` Viacheslav Dubeyko
  0 siblings, 0 replies; 2+ messages in thread
From: Viacheslav Dubeyko @ 2026-07-16 17:24 UTC (permalink / raw)
  To: deepakroag, Ilya Dryomov, Alex Markuze, ceph-devel, linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-16 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-15 18:16 [PATCH] fix: release unused ceph cap reservation on readdir error deepakroag
2026-07-16 17:24 ` Viacheslav Dubeyko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox