mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiubo Li via B4 Relay <devnull+xiubo.li.clyso.com@kernel.org>
To: Ilya Dryomov <idryomov@gmail.com>,
	Alex Markuze <amarkuze@redhat.com>,
	 Viacheslav Dubeyko <slava@dubeyko.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Xiubo Li <xiubo.li@clyso.com>
Subject: [PATCH v2 1/4] libceph: resend replica reads on a new interval
Date: Thu, 03 Dec 2026 14:24:20 +0100	[thread overview]
Message-ID: <20261203-b4-libceph-upmap-primary-v2-1-8a15d2fc7318@clyso.com> (raw)
In-Reply-To: <20261203-b4-libceph-upmap-primary-v2-0-8a15d2fc7318@clyso.com>

From: Xiubo Li <xiubo.li@clyso.com>

A replica drops a balanced or localized read that was sent before its
current interval started (PG::can_discard_op()), on the assumption
that the client resends such a read on every interval change.
calc_target() resends a read that went to a replica only when the
acting set or the primary changes, though, and an interval also ends
when only the up set changes, e.g. when pg_upmap_items,
pg_upmap_primary or a CRUSH change moves the up set while a pg_temp
keeps the acting set for a backfill, or when the pool's size or
min_size changes.  The dropped read is never answered and waits until
the acting set changes for some other reason.

Check for a new interval for requests that went to a replica too, as
is done for linger requests.

Tested with read_from_replica=balance on a 5-OSD cluster: with
nobackfill set and a pg_upmap_items entry, a PG had up [4,2,0] and
acting [4,2,1] (pg_temp).  Its up set was then moved to [4,2,3], the
acting set staying the same, and 40 4K O_DIRECT reads, one per object
of the PG, were issued from a krbd device before the client had the
new map:

  +----------------------------------+--------+-------+
  |                                  | before | after |
  +----------------------------------+--------+-------+
  | reads not completed after 14 s   |  28/40 |  0/40 |
  | reads resent on the new interval |      0 |    16 |
  +----------------------------------+--------+-------+

Before, all of the stuck reads were on the two replicas, and they
completed only once nobackfill was unset and the acting set changed.

Fixes: 117d96a04f00 ("libceph: support for balanced and localized reads")
Reported-by: Alex Markuze <amarkuze@redhat.com>
Link: https://lore.kernel.org/all/20261202131101.582425-1-amarkuze@redhat.com/
Signed-off-by: Xiubo Li <xiubo.li@clyso.com>
---
 net/ceph/osd_client.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 22a793a4bdc8..81da34869d5a 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1640,7 +1640,16 @@ static enum calc_target_result calc_target(struct ceph_osd_client *osdc,
 	last_pgid.seed = ceph_stable_mod(pgid.seed, t->pg_num, t->pg_num_mask);
 
 	ceph_pg_to_up_acting_osds(osdc->osdmap, pi, &pgid, &up, &acting);
-	if (any_change &&
+	/*
+	 * A replica drops a balanced or localized read that was sent
+	 * before the current interval started (PG::can_discard_op()),
+	 * and the interval also changes with the up set or the pool's
+	 * size alone, while the acting set stays the same.  Resend such
+	 * a read on any new interval, not only when the acting set
+	 * changes.  The primary does not drop requests that way, so
+	 * this is only needed for the ones sent to a replica.
+	 */
+	if ((any_change || t->used_replica) &&
 	    ceph_is_new_interval(&t->acting,
 				 &acting,
 				 &t->up,

-- 
2.53.0



  reply	other threads:[~2026-12-03 13:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 13:24 [PATCH v2 0/4] libceph: support pg_upmap_primary (the read balancer) Xiubo Li via B4 Relay
2026-12-03 13:24 ` Xiubo Li via B4 Relay [this message]
2026-12-03 13:24 ` [PATCH v2 2/4] libceph: get a full osdmap after failing to apply an incremental Xiubo Li via B4 Relay
2026-12-03 13:24 ` [PATCH v2 3/4] libceph: decode and apply pg_upmap_primary mappings Xiubo Li via B4 Relay
2026-12-03 13:24 ` [PATCH v2 4/4] libceph: advertise SERVER_REEF Xiubo Li via B4 Relay

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=20261203-b4-libceph-upmap-primary-v2-1-8a15d2fc7318@clyso.com \
    --to=devnull+xiubo.li.clyso.com@kernel.org \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.com \
    --cc=xiubo.li@clyso.com \
    /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®