Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9110935pxu; Mon, 28 Dec 2020 06:56:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWO+v4UrndVmtz/HVvEGN+/syeTKK9V1QDej+sU1oyMmLjew1mYlxqhPklVbpZDVX5u9dj X-Received: by 2002:a50:b765:: with SMTP id g92mr42422461ede.317.1609167363193; Mon, 28 Dec 2020 06:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167363; cv=none; d=google.com; s=arc-20160816; b=WXZTu7UxbUhaHCz/sTKMzYGXv0L0bOT451XS+jt2mM/dkQJWxmHlXAb7vu6udjDsBF UMlY6GnwAQZWiVsgX3ndawnQHYVeuSZHfI7VQii2whscsfBxpgNg6iXps7yEUBysa/ky qG9iYVZM5zYpIAbNIMZSXeT6egMIayT6dvdGFoLBC9+YNnsqr7W3n6ZxYYyeV9AhwLFr SwWlWNYoikBqUtwbCR7PHCAWEjRD5mPPLIWlL+dewBqcWGMEqcSZ91ITWw5IVht8N5Ql DIwbcEM9lAX0+ejFDiQmixeMWRlwg1PuHmZ4HvG0KhjSAkB9l2LMx/ZSYbyE9z49b9Ti X2qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iL7bYldn9UsspiUv/UKIKanB6HiE6MTq52vpKNAje88=; b=ZCCll5pnNW3AX/CFFZ4Nz0FnfZKYS7MSs2BZpWPzeg+4vRm1LA8VH7aFglNJVCm8ae OOQmaLFsEUJY3XLdOLzgps0Q05RXIMwJl0GcP9wojjY3Gu86AHPinlWpP+oPqNdFjPUG LckZzfb57meiiP9DQhkMiotIAgf+ArR9m2ACHfsaX/b4rxnG9tfQRYGLfgtoWw3ed7El YaUr/UkpGwVLWgawMd9Iky1zkEyBCR0wSEnWhzEJJdZQ/rkdZxTVu5qXQkCvdvb/m31b dT230Xfo6f6V9kuT4LdcQWdBL210XaAIeaQmpzeCj9Ql1gPmDLIBdMZNLtcyZigd6w2t wKOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F0q6iJzV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l19si20027733edq.537.2020.12.28.06.55.39; Mon, 28 Dec 2020 06:56:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F0q6iJzV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441500AbgL1ORq (ORCPT + 99 others); Mon, 28 Dec 2020 09:17:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:52854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441493AbgL1ORp (ORCPT ); Mon, 28 Dec 2020 09:17:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 222A5229C5; Mon, 28 Dec 2020 14:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165024; bh=/qWz2VcDO/m3AyVrool8a3Qv4KL9VqTD27TO2E0UiVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F0q6iJzVOYWF8xLT+UYZtJA1xSp7FXTxq8LdFBIJpjHu54dymgPc7C4yJDbcTtxbC VYQ3//hBFH4uvytVdfBK5KTgOTaeAokF586WPdMsU2xZyBLk2JUB1mbZbwykp4KpLt eCDYhFjD+xPvauSfd5YoOi4+rIQ/1oizBKrfDPs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dai Ngo , Chuck Lever , Sasha Levin Subject: [PATCH 5.10 376/717] NFSD: Fix 5 seconds delay when doing inter server copy Date: Mon, 28 Dec 2020 13:46:14 +0100 Message-Id: <20201228125039.023665528@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dai Ngo [ Upstream commit ca9364dde50daba93eff711b4b945fd08beafcc2 ] Since commit b4868b44c5628 ("NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE"), every inter server copy operation suffers 5 seconds delay regardless of the size of the copy. The delay is from nfs_set_open_stateid_locked when the check by nfs_stateid_is_sequential fails because the seqid in both nfs4_state and nfs4_stateid are 0. Fix by modifying nfs4_init_cp_state to return the stateid with seqid 1 instead of 0. This is also to conform with section 4.8 of RFC 7862. Here is the relevant paragraph from section 4.8 of RFC 7862: A copy offload stateid's seqid MUST NOT be zero. In the context of a copy offload operation, it is inappropriate to indicate "the most recent copy offload operation" using a stateid with a seqid of zero (see Section 8.2.2 of [RFC5661]). It is inappropriate because the stateid refers to internal state in the server and there may be several asynchronous COPY operations being performed in parallel on the same file by the server. Therefore, a copy offload stateid with a seqid of zero MUST be considered invalid. Fixes: ce0887ac96d3 ("NFSD add nfs4 inter ssc to nfsd4_copy") Signed-off-by: Dai Ngo Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index d7f27ed6b7941..47006eec724e6 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -769,6 +769,7 @@ static int nfs4_init_cp_state(struct nfsd_net *nn, copy_stateid_t *stid, spin_lock(&nn->s2s_cp_lock); new_id = idr_alloc_cyclic(&nn->s2s_cp_stateids, stid, 0, 0, GFP_NOWAIT); stid->stid.si_opaque.so_id = new_id; + stid->stid.si_generation = 1; spin_unlock(&nn->s2s_cp_lock); idr_preload_end(); if (new_id < 0) -- 2.27.0