Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5215261ybl; Tue, 27 Aug 2019 00:56:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQuuAZIgh2t5qkjsJ27s02lTcKUNobM5aiCOU8p978PPD2Di7kVxlupsrJtkIH0Uautacy X-Received: by 2002:a62:e50c:: with SMTP id n12mr11173336pff.206.1566892574806; Tue, 27 Aug 2019 00:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892574; cv=none; d=google.com; s=arc-20160816; b=AMrMPN0NkLbdUaq5tM+vMc08ochM3PlVv2md5P/vSqlGtPojxLxqEkoECmC+CpoIap YuhMGMWK1NcBLTK9NhnVQS3nVvKu7Ob+38yMHByhvl+rAOcGk2NVQiF2AFIWVaTsFFVy uH3Y8Fzoy6vhqC7xlFcYRHO3vr2jMm2vVQyrAEMKo9vC8cVEdGxpM+4L+Y5Sjakz3sMn dCH4mfeQd0x/5fc6GtC4u1ms8V5EXMxWorSHuI3wgkWQYgGmjEMYwvQcOlE2gC/CKkpB lBwE5IuC385ihTUz5IQuCUFdRc2QznpvNmz/ljeQXHVOCBOnUJ9HyqCU8PsvKBkVb36M TIEg== 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=eVlCk2BGL82IaP+GqxkIKU4T7icGtjA+wwwSx3iggpU=; b=QZBZjqw6OAAJpFj0cs63iLJ0TacLMqVmgiVa8SRRi57q6zqSFqMXGZaI9N8InJHECh uPkxe95flRObmyauEBgv8R3+3sY3ag523oPPiy7NP85vOxZG8i0qHol9Ekhmc8x2HG/d Mwi0QE4CqAhHpDFN+xO837IHy+6EMgX1tu7pizH/jY9ksuKFgWlciBIMY5x2+e+lvQvy Ns0rhEZPVHTaOlj1jz0A5zCSqEo9tNWA13HFQk0FcC8mJEJljrfAi7DgHF0abXBDu73a lxAqBqMoWJYp+BOvqXio5a6UwGSGlxpCajduZBJhqTWaUqFfYPYDcjNiNE17ibSllwfv aqaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OwI0ofAZ; 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 h64si11281362pge.208.2019.08.27.00.55.59; Tue, 27 Aug 2019 00:56:14 -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=OwI0ofAZ; 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 S1728819AbfH0HxV (ORCPT + 99 others); Tue, 27 Aug 2019 03:53:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:44760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729743AbfH0HxS (ORCPT ); Tue, 27 Aug 2019 03:53:18 -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 C6B9B2173E; Tue, 27 Aug 2019 07:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892397; bh=yQomjeLpXLhIYFSrbCyENDzJfHKJHvWnIxJKHtKzsxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwI0ofAZlWrlawyz54NBavaps3uFIO1ubBKVaJjn0KWySKbtIwHSxQpJAzFkMMxbO X36BPirnoIUhE0/KJUlF1boCx6WpwA94Dkso9YADqmNluoYYsh/aIEaa2p8Kqzw+5s 87EYCCv5K9IzKPSj8WyXINrIyLw0mxtyWz4sJwRA= 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 4.14 40/62] libceph: fix PG split vs OSD (re)connect race Date: Tue, 27 Aug 2019 09:50:45 +0200 Message-Id: <20190827072702.925987338@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@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 @@ -1330,7 +1330,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, @@ -1426,15 +1426,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; }