Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp535873lqb; Thu, 29 Feb 2024 07:58:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdjGpsZuU+RyZGXvWl/mZFCxOasvNS7/PCB8cGUuGEngEEjxcPWcvo/ZmrxdDz2E3ar0aWgtiy9cP0Bef6Cy7OPivRXqjhmkd2egmJsA== X-Google-Smtp-Source: AGHT+IEs1uOmHR2rUFuBqCRMlIskxdygEx4iOzzVNSa+czX3Vm2KKiuXh+Crveu/Htun65T3vlYa X-Received: by 2002:a62:e406:0:b0:6e5:35a5:511e with SMTP id r6-20020a62e406000000b006e535a5511emr2847965pfh.0.1709222319868; Thu, 29 Feb 2024 07:58:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709222319; cv=pass; d=google.com; s=arc-20160816; b=PVVeBMIcmqMYojm4euJylDq9mnBXTD0CZxOPHBd9GV4UbLFWk95wHog1c+Du3lMDEr vqmP3sdL7r6ZMhyC53XLeyE0g3RJoRBeAwLYBcS5a2HDnk9hVLiK69GAqqe/kBtQbQQ6 0DPS352r49faeC31oN8xFNPg4FJfNvRUCLrTONTe2cU/+AFcZpSksNsMbsT8E0Zf3fum 79f7jQciFf8UrBn5a+K9/YWnDzJQ8cGPQXT3j6DUn4JUfoAwQkOfzgoN9xKTTFLuUJrF eqssT/hAW9gVW2ULDpag3+vu0xJjsDWhAlI8SDc3E58slqi7ADS7w71k5Kvhbx0hvuVh WM6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GHzABztmFGH6lXUu0pJihGFRRgs7fyX3EPeO5qENEKQ=; fh=nC8kVTHB+Xac2Frrfm4RMSK9K/mAgnd12wPAezauZoY=; b=zjLLsfXJjFkqEpOyn4Xz2H5S+bWvLglvwEZLTOOlMB8MUS84lEpePgr8atw1dI5s3i 0qyv20P8VtzYYYQjb5tn9E+LvsP2DZ7FbnAEWvK5cbgkwYxnxvlKRwKempgs6sjHTwMl 77Y5dUwWb5U3ylfT3uT/NHNlWD2SHRIWFQTeXYsev123HzJYkUYDYxACEtsrlWZmW31Q vC5sndECsmf1FQ4UxJncUnYL3je9edZxTVr+OtrJTisfLEaeExkb+YHAVLoBVMXaiOCd s22EztMfpQ8jwEJJn+G/6ha6rz1YivjWz9Oa37K6oA10Jak6OJ19AKg1gsSVtwBYrH2w X69Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r1JUMKjI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86968-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86968-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y37-20020a634b25000000b005d6b61e24afsi1584078pga.763.2024.02.29.07.58.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:58:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86968-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r1JUMKjI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86968-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86968-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1AC12B2636B for ; Thu, 29 Feb 2024 15:54:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F299B160880; Thu, 29 Feb 2024 15:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r1JUMKjI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ED1915F308; Thu, 29 Feb 2024 15:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221769; cv=none; b=jM843040C4cZboKQnHpH5tdv4i4bhsqSmDpmGEZ/Cw8VaFG1MOA70wtgazxma3GPhot+PL3+4zktKG9nHEcmwA1Dbqw7V9OSpsn0FViv0zlkNYNrx4ycpmsb5kYoVlduJ0KLLABsu1SoLBWn6XOM5X59uK7xYkFuKW/cf3OWPwk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221769; c=relaxed/simple; bh=894SECjX07TeJHgEDN4GpeYDrHauzDYi/LFjH0WQrXA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L9FdGofX9vCxXrHlGVpGjx0Yg63QsNzIkdchGG/CLyAPJsdXJvKD5GWt6NyyxGkq8Vvp6pOlRfWnqkkHz2z1n7E7DOBkHQnqJ8O/6Aj3oLRIsFZX/KgvDEig+I7R1zYXIuE1n0HTTkw8Re93rbWIPY3BoIwGRYUOEpmRMOtoIN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r1JUMKjI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B64F9C433A6; Thu, 29 Feb 2024 15:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709221768; bh=894SECjX07TeJHgEDN4GpeYDrHauzDYi/LFjH0WQrXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1JUMKjILmIExy8I6Zi0vmVS8LhIsFeyoGWbpLuQSMPVimfjZSi0MeQcaPCZy5w1U frm+o/TWdI+46DBT47nIB5AXAWU3Wgm1JsUbxWz2ioSAr1dgVYFFuUHLZo8jHmf2re F3NrJgzogFLb9ELFXIOC0WcrS2KyA2HB9Vt9KF6w4NCqITovXZgBB6wDzxSdKCxlnT 2koSV5us7TVI2wMvsvFTNwoDLRFLXF5vABYyzEFS8+jAH5iY1pOvuk9hklW/raBbYk Kdh1ymR7Jq0llEAbrLy7HKD8xtMzuCcGKPJ5ljll6ydhk0FgF0vyPQpHD1Lp6bZjs5 aZcL1dU/w2KnA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xiubo Li , Milind Changire , Ilya Dryomov , Sasha Levin , ceph-devel@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 20/26] ceph: always queue a writeback when revoking the Fb caps Date: Thu, 29 Feb 2024 10:48:39 -0500 Message-ID: <20240229154851.2849367-20-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229154851.2849367-1-sashal@kernel.org> References: <20240229154851.2849367-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.6 Content-Transfer-Encoding: 8bit From: Xiubo Li [ Upstream commit 902d6d013f75b68f31d208c6f3ff9cdca82648a7 ] In case there is 'Fw' dirty caps and 'CHECK_CAPS_FLUSH' is set we will always ignore queue a writeback. Queue a writeback is very important because it will block kclient flushing the snapcaps to MDS and which will block MDS waiting for revoking the 'Fb' caps. Link: https://tracker.ceph.com/issues/50223 Signed-off-by: Xiubo Li Reviewed-by: Milind Changire Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin --- fs/ceph/caps.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 9c02f328c966c..ad4d5387aa1c8 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2155,6 +2155,30 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags) ceph_cap_string(cap->implemented), ceph_cap_string(revoking)); + /* completed revocation? going down and there are no caps? */ + if (revoking) { + if ((revoking & cap_used) == 0) { + doutc(cl, "completed revocation of %s\n", + ceph_cap_string(cap->implemented & ~cap->issued)); + goto ack; + } + + /* + * If the "i_wrbuffer_ref" was increased by mmap or generic + * cache write just before the ceph_check_caps() is called, + * the Fb capability revoking will fail this time. Then we + * must wait for the BDI's delayed work to flush the dirty + * pages and to release the "i_wrbuffer_ref", which will cost + * at most 5 seconds. That means the MDS needs to wait at + * most 5 seconds to finished the Fb capability's revocation. + * + * Let's queue a writeback for it. + */ + if (S_ISREG(inode->i_mode) && ci->i_wrbuffer_ref && + (revoking & CEPH_CAP_FILE_BUFFER)) + queue_writeback = true; + } + if (cap == ci->i_auth_cap && (cap->issued & CEPH_CAP_FILE_WR)) { /* request larger max_size from MDS? */ @@ -2182,30 +2206,6 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags) } } - /* completed revocation? going down and there are no caps? */ - if (revoking) { - if ((revoking & cap_used) == 0) { - doutc(cl, "completed revocation of %s\n", - ceph_cap_string(cap->implemented & ~cap->issued)); - goto ack; - } - - /* - * If the "i_wrbuffer_ref" was increased by mmap or generic - * cache write just before the ceph_check_caps() is called, - * the Fb capability revoking will fail this time. Then we - * must wait for the BDI's delayed work to flush the dirty - * pages and to release the "i_wrbuffer_ref", which will cost - * at most 5 seconds. That means the MDS needs to wait at - * most 5 seconds to finished the Fb capability's revocation. - * - * Let's queue a writeback for it. - */ - if (S_ISREG(inode->i_mode) && ci->i_wrbuffer_ref && - (revoking & CEPH_CAP_FILE_BUFFER)) - queue_writeback = true; - } - /* want more caps from mds? */ if (want & ~cap->mds_wanted) { if (want & ~(cap->mds_wanted | cap->issued)) -- 2.43.0