Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5226570ybl; Tue, 27 Aug 2019 01:07:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxN2Uy3QLp7inuuBtQH8yoN+sEHjNvl+tem7gtLz1k5dnOIRUgY8Vg/2gG5gXh2DRt9VKqz X-Received: by 2002:a17:90a:de11:: with SMTP id m17mr13671993pjv.38.1566893252393; Tue, 27 Aug 2019 01:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893252; cv=none; d=google.com; s=arc-20160816; b=uGTys8jUkLsuCAONJEVIZo07y3trHQgZkgYQ1lXXWMzIX1UTah0HgOmXWIi0UP1U8y TF4Nh4j6MN/gNX04rRE1hGWJLQ2QNepEK1++HbPeEwcbk1u6tcry0y3CNZTEq/M5Lyua 7rHQq+qMPwHvO4F+0X+pmCuqrTy0MSk0pqO9VbE8KeDkKODKw7Prvk77gNvacVzLRuf4 RkklFu1a0EwEBZMbrU4YEo/C55jd5/pExQ4CiNsiL0D2M8qLOCeoDQoVWwUXxyNXYrOQ Ac4wDthDW08O3IL/o/Z9IeQsUGfHEDEn7BRAvMXnuL1BVAtg46RMIO6968MAiPLsAhTP M+tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IpKtQWp4rFpR7fVtxBZhf6H29EiSzNPdPzYpG1Iu48Q=; b=09pUWrRIYg9zpXf9cI7FgKpG5hU94fIbVF+/tW2W4KOVN4k2HxvQ7O8RJzQNIgbHnE ytVFT639Uvtv47HiAH7QvylwuLdYSt3yheQ27xLh8zO02WNFyM9m2zqJlPFKhj6PyoMz 2Ejpy/HBPwbKBkzuY7aeq8emNAZCtv05ce9n1UoNATtV/5Gs1wxdBLMxWhaGVhQk3oRE 6tCbUgECyvrz62n53RE20QJMdlmUFiDS0LZgb+PZf9bCQd5e1cErWI7oqGjvJipfZ4H9 KakIjuomVaLcHE7+wlw64bTf/hilOx4BohgV9gZduUylJ8wE42LBcatt190Wbc3V4MUR T8Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2I64tZ9r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si11763940ply.133.2019.08.27.01.07.17; Tue, 27 Aug 2019 01:07:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2I64tZ9r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731426AbfH0IEx (ORCPT + 99 others); Tue, 27 Aug 2019 04:04:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:34456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732640AbfH0IEv (ORCPT ); Tue, 27 Aug 2019 04:04:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F082206BF; Tue, 27 Aug 2019 08:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566893090; bh=Qw77gmRiSKJzRYk3kAqM2t382LGrq//S+kz8qBIaXEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2I64tZ9r4BIZCv6CZV70vjZdyPsyw9Vdz+am+w2nnCWsJxBW2HgiASuD9FEBjYXgF JxoIL36yZ3tWa0annxRyZUgsL4JeMGDEdCpan+6JZwqAHho5MRyIwJ5Gw9uOsFNsIS AHfNNYN5g9wtEjRoRKALfj0V/4JWW15JReL9LGss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerry Lee , Ilya Dryomov , Jeff Layton Subject: [PATCH 5.2 118/162] libceph: fix PG split vs OSD (re)connect race Date: Tue, 27 Aug 2019 09:50:46 +0200 Message-Id: <20190827072742.543963345@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072738.093683223@linuxfoundation.org> References: <20190827072738.093683223@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilya Dryomov commit a561372405cf6bc6f14239b3a9e57bb39f2788b0 upstream. We can't rely on ->peer_features in calc_target() because it may be called both when the OSD session is established and open and when it's not. ->peer_features is not valid unless the OSD session is open. If this happens on a PG split (pg_num increase), that could mean we don't resend a request that should have been resent, hanging the client indefinitely. In userspace this was fixed by looking at require_osd_release and get_xinfo[osd].features fields of the osdmap. However these fields belong to the OSD section of the osdmap, which the kernel doesn't decode (only the client section is decoded). Instead, let's drop this feature check. It effectively checks for luminous, so only pre-luminous OSDs would be affected in that on a PG split the kernel might resend a request that should not have been resent. Duplicates can occur in other scenarios, so both sides should already be prepared for them: see dup/replay logic on the OSD side and retry_attempt check on the client side. Cc: stable@vger.kernel.org Fixes: 7de030d6b10a ("libceph: resend on PG splits if OSD has RESEND_ON_SPLIT") Link: https://tracker.ceph.com/issues/41162 Reported-by: Jerry Lee Signed-off-by: Ilya Dryomov Tested-by: Jerry Lee Reviewed-by: Jeff Layton Signed-off-by: Greg Kroah-Hartman --- net/ceph/osd_client.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1504,7 +1504,7 @@ static enum calc_target_result calc_targ struct ceph_osds up, acting; bool force_resend = false; bool unpaused = false; - bool legacy_change; + bool legacy_change = false; bool split = false; bool sort_bitwise = ceph_osdmap_flag(osdc, CEPH_OSDMAP_SORTBITWISE); bool recovery_deletes = ceph_osdmap_flag(osdc, @@ -1592,15 +1592,14 @@ static enum calc_target_result calc_targ t->osd = acting.primary; } - if (unpaused || legacy_change || force_resend || - (split && con && CEPH_HAVE_FEATURE(con->peer_features, - RESEND_ON_SPLIT))) + if (unpaused || legacy_change || force_resend || split) ct_res = CALC_TARGET_NEED_RESEND; else ct_res = CALC_TARGET_NO_ACTION; out: - dout("%s t %p -> ct_res %d osd %d\n", __func__, t, ct_res, t->osd); + dout("%s t %p -> %d%d%d%d ct_res %d osd%d\n", __func__, t, unpaused, + legacy_change, force_resend, split, ct_res, t->osd); return ct_res; }