From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796304285; b=eSmlp86seBRulgKQnfGNulElWouihXrEg/aQF+EQ9sX7bgBSMcUfcks1/3EEvifgy3nI riLe5MGWNOiLCmIy8tV4Qlryjab1YsAa5JqEXVi2MLGvJpL6VUuZN+ELdxomKqAVj92Sv s7QKXILr+j+VgCLDFlx14c6mPvUJd78teIbtKb7m4oFWHiA1EcTg1rZGewXQ3pIdNFttm UBnoWFlOL583q7TRmuF+QnCMebqsWf8xD/y/ykownq7amXbrQEY32mbqgixKtUiaV1y6r NZm+NBq+ROtUUrFyktA5Aalt1oNBIf9MUDwYeabhKH/l7NiWXFPd9PPBCzjsTfSHanA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796304285; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=TUrZpyvqZesX62L4iybusfiVPsMNxJ1CD7AopAggyps=; b=nfqL4Up+EVsFcY1dSqs2m4UOfkhkjSFo6DW93TEomZQrz7yqe1fhzJrUZViAqHx2Yanh VXQFVzYzCYFYuXFuEuzSdFOFD5MTCfBKhqkRwYkJ1dshUMD2WOQFtLTftefFkpaGfykYo Ok/W/lW366FvY7Potc3kDouMeFn5VQw+mg0u5kvrqWYwhci9o/6qMsjl83fJTqYm4APGw XP6Z2lW/QU+LEdB4LPPOCySCnA8U8aBUeMc+XCYmXAerHEjwjLUy/9QfdxMGp84fnkNOq cTWFlfjmbVbXJQm4+nf33u9ORQmPa2AGYdQIgeS3lo4jE27qtw2C+20BolQMyPjm3Kw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="O1/L3QhV"; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2F52606A335; Thu, 3 Dec 2026 13:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O1/L3QhV Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796304284; b=VV3cEbXrPaBCc0fSy6RuyQjc+4kxeRxGgeBlLQf4SNcT5BFWQBvsNDHpHzjVU4dAbqci koJxGuKHN6awjsWSoC7kRmGULKP/MalIIVQqqva3dpLsVjcSua+Ub+eJ38wdSnAik6RR6 DX86FiDkeSISG6BHe6DxlLP1StO3wWCePDOIQMskDC62pDxjosBD8CpK3jAgz+qXqBgnj V+lIuWeNAGGUCykdgqNZCg90JV9/v2qBEF/zt2xSeoHnARTzllW5sqBfJYhZgx0oO3Vlm fI7gGoBvSjEem54NGZ7FcdjrHwK6u0lXTLDNDdjVdltE4uzTfyl7V4Wg7iMToz/wnSA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796304284; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=TUrZpyvqZesX62L4iybusfiVPsMNxJ1CD7AopAggyps=; b=DJFVhcbHveAudF85VXQrsm05Nrv26z8P0+mqpUKp/4S5w9ECcPaoCLymElJlmGUGltbc kltvJwrKx4UBiA1R6NPHyQIoIHRbZi+6SYu2vz6b5MAuOMyDBHGoK6BP1nl6NtWGRkbzN bT9YuRowKofv7Ovb2a5EbQEAkOQkS/o08F8GFqEPlG1TUR51rV1bv/6r5LesMZTXO742/ Lv+8qvmLpIqRROW29TnH+5wJc9Vsf8rQT6Rij5VGo/eDESWGAFB7lIEEec/tB+Yo5ujq6 cXKGy/D6E3mY6N+OciTxiQ8yNIj5mpFw05HVpa+JbxogcjEBTeUV0r788HCkOFxL6fg== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 69D0E1F00898; Thu, 3 Dec 2026 13:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796304284; bh=TUrZpyvqZesX62L4iybusfiVPsMNxJ1CD7AopAggyps=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=O1/L3QhV5y19cT6OKTRcursEbE3fIk+wBAnKoNUY2XgXGk9I7tThXk3ejvs179geH oQUjX0VWqnTwvWpk10pPaf3zqpWIJNA8bvFmley9qdLOhx1d7Y0X/5pP+NPj2vPwl1 K/R3HPhv0fMObO+F9XLts0Xs0rh90QaQ4dVKSil37uUR+G5UDOzAh4wEFD5l8Re7kr NPAIOy6FcFqyX+dD9ELfMX8/pL296UHD+iDmT6WucOdUYksP6vKvevzFf/uC8fSd55 0tRHKwH5rcHAOz9jNi5/GinP04XdP4bZY8Bv2jDzOWKH0grSFx0ubOToabZAZUOBXQ 7zdEwocDSzgIA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id E74914F98D; Thu, 3 Dec 2026 13:24:42 +0000 (UTC) From: Xiubo Li via B4 Relay Date: Thu, 03 Dec 2026 14:24:20 +0100 Subject: [PATCH v2 1/4] libceph: resend replica reads on a new interval X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261203-b4-libceph-upmap-primary-v2-1-8a15d2fc7318@clyso.com> References: <20261203-b4-libceph-upmap-primary-v2-0-8a15d2fc7318@clyso.com> In-Reply-To: <20261203-b4-libceph-upmap-primary-v2-0-8a15d2fc7318@clyso.com> To: Ilya Dryomov , Alex Markuze , Viacheslav Dubeyko Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Xiubo Li X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796304272; l=2952; i=xiubo.li@clyso.com; s=20260625; h=from:subject:message-id; bh=y3JOiQp5pg0rUHBDn/rFj8dUzDOzJWdEslq2wIPqiMQ=; b=9lCT8qtDYrmr72hmI1bV42LnjNb7nC7TNvnUWeofm75f1ktfY4MRPK7RthsQXe46REGAF2Y1P +DKdMjL5NKGCLiyzA0mBlzTgj/ViDNTRM4VZ6N1snH86hyjfNP9i+Jm X-Developer-Key: i=xiubo.li@clyso.com; a=ed25519; pk=V3NGr0AgAopiUhaLY51ipBkLN5LlcLhjOEfLEq1RoZ8= X-Endpoint-Received: by B4 Relay for xiubo.li@clyso.com/20260625 with auth_id=840 X-Original-From: Xiubo Li Reply-To: xiubo.li@clyso.com Content-Transfer-Encoding: 7bit From: Xiubo Li 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 Link: https://lore.kernel.org/all/20261202131101.582425-1-amarkuze@redhat.com/ Signed-off-by: Xiubo Li --- 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