Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp761529rdb; Fri, 26 Jan 2024 09:48:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvcACKVcQzP/jGhZFQ0BusEwk2GZEbi+M3KpB2Twp05STV361B/fLgwIvsv/DPxqDE/J8T X-Received: by 2002:a17:902:dacc:b0:1d7:176a:c83d with SMTP id q12-20020a170902dacc00b001d7176ac83dmr116510plx.139.1706291327836; Fri, 26 Jan 2024 09:48:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706291327; cv=pass; d=google.com; s=arc-20160816; b=dtGPHeoG9uPQuunR+KMNBsGJMZarafjd4Y1ZWUr7Vfe2cdnwvuPYpgSOMHWyIlTeh7 ljJzIDlwRkDHx37ne6GZOf/T/M17L1DH+Jo+ZgvIbmltLP/IM/TCxnccRO3co9hqDmki 8cNfjtThGu/KZpoCTMVw0QBxkOGtJHSzIaLAsf/VqBovR49sgv66B1qj0qu9UtkA4YDF iJXV0asw9GfaVZQiBPmzhwopJ6E3vDE0a1PnwFQCvHDOg2h5hT2eM1LLN+GDEjXhAjUn sA8Xm0zyIu7ZdmO5nziHsCtYX0XmadIEwXSvRXuEUytT08XUsvxLEPt9XMEC3wjeycT1 nEtQ== 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:user-agent:references:in-reply-to :message-id:date:to:from:subject:dkim-signature; bh=rt8sSDONT3ESS7EY3FALgMJnd06p99AnSmKkWlkqgz4=; fh=Mys3y4MwsHRytUQMpdfGBn3oGRYLcLloxNwkFYMYMmg=; b=d2uFPWbjsniptRTtmeX+9NKxmhqYjjITa+RHHo6KWt5atIem49Sog1pdstRRRMLinS vsPIxI4S7L33SNcaqBbjhIc+UwuaTNbMxZ9WoV81+KobcUCyznP1GsZ7gwB7YD9l4TZ7 ctJWfkG3n/hEK7uQ6x25FGU/kE1j/brEKYf5dvoKzy94R7qGmF0GAky4xQmp+x+CnSSm KPSDyPzCPZ6z9YcCnowpdaoTKUrjlzhiu38FI1TGGSyu0zqPr9vN64NvN47Vhq6Q2idd FpXUF1hMoLNYyfFbwWUaalnL7kujxpdClNLKbYMdHdcNHD17E7bdrVhQ9f2YWO3S+Sej y7MA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZFm7nDf6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1491-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1491-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h37-20020a631225000000b005be1e55546esi1483897pgl.51.2024.01.26.09.48.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 09:48:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1491-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZFm7nDf6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1491-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1491-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9D93328619A for ; Fri, 26 Jan 2024 17:47:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43A49208B9; Fri, 26 Jan 2024 17:45:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZFm7nDf6" X-Original-To: linux-nfs@vger.kernel.org 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 13A2C208BA for ; Fri, 26 Jan 2024 17:45:24 +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=1706291125; cv=none; b=aGFaA0Wpz/Er/yH92ZYuBh2bJQRQ90G5FHy1qf7zHaB5yCQP5gTlWtaVmBdi/HHhzfSCPIhRzMkievYb3BwXIlqHn29w2qTsyxEdQfj2LGSmhM/6RGOZlaQnfm8aG2ictlNhma63HLtEGSpSxfX1lTkLhWm/NzeFNI5AKnfNcrw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706291125; c=relaxed/simple; bh=fvaiBK3PyaNdQ/1DEAZsRSMGJZ0XyMNPJw/0OTMTGMM=; h=Subject:From:To:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BDOjvCI+nFnaPOHOZYHONiN7gwKbXl7noxsx+nEgLChUXb1hdEU3769gIbWOV8MCL42tTie9G2j1WsW0GxFMjejNlB/wUmZ9ZyZuupK9x7y207A4bkrOgttZv2j3SrVXmFSTHuWbfJbr1V+XjVx0fXvv9hEUvaCYNgmHFovoe0U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZFm7nDf6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56DD7C43394 for ; Fri, 26 Jan 2024 17:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706291124; bh=fvaiBK3PyaNdQ/1DEAZsRSMGJZ0XyMNPJw/0OTMTGMM=; h=Subject:From:To:Date:In-Reply-To:References:From; b=ZFm7nDf6tP+fOUCTD/uG/z7pAEzazRUHH84zZSJS6Y6CCylvDwEHbVEUpBKC6T6Y1 6fswHhXQcash8jnBbGQxTiGYjMVmTFIQk/ZX8vx72rfC6JgmnHGoZjRAEzbruBvOX2 hEDjF7auo+/lCk409Ce9f17TzQh06fTQaQ9C9uRGYm1ZFKRZRg6UQK5GEmD9HBw1km pC7Lb6EQVEGQ/7lpru6GWDTHd7K2O3lqcEqnVNWsheQJiWmLxefGLPx75Y+evYwZ8z iYI9epuRI1+AYmRTqGpzqWLq5I7jmNAYG3gXJgYTokduuWO817V++exe+PDPA/R1Kf l/T+DZARw5qQQ== Subject: [PATCH 2 02/14] NFSD: Convert the callback workqueue to use delayed_work From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Fri, 26 Jan 2024 12:45:23 -0500 Message-ID: <170629112325.20612.15691160218281370004.stgit@manet.1015granger.net> In-Reply-To: <170629091560.20612.563908774748586696.stgit@manet.1015granger.net> References: <170629091560.20612.563908774748586696.stgit@manet.1015granger.net> User-Agent: StGit/1.5 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit From: Chuck Lever Normally, NFSv4 callback operations are supposed to be sent to the client as soon as they are queued up. In a moment, I will introduce a recovery path where the server has to wait for the client to reconnect. We don't want a hard busy wait here -- the callback should be requeued to try again in several milliseconds. For now, convert nfsd4_callback from struct work_struct to struct delayed_work, and queue with a zero delay argument. This should avoid behavior changes for current operation. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4callback.c | 6 +++--- fs/nfsd/state.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 43b0a34a5d5b..1ed2512b3648 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -887,7 +887,7 @@ static struct workqueue_struct *callback_wq; static bool nfsd4_queue_cb(struct nfsd4_callback *cb) { - return queue_work(callback_wq, &cb->cb_work); + return queue_delayed_work(callback_wq, &cb->cb_work, 0); } static void nfsd41_cb_inflight_begin(struct nfs4_client *clp) @@ -1370,7 +1370,7 @@ static void nfsd4_run_cb_work(struct work_struct *work) { struct nfsd4_callback *cb = - container_of(work, struct nfsd4_callback, cb_work); + container_of(work, struct nfsd4_callback, cb_work.work); struct nfs4_client *clp = cb->cb_clp; struct rpc_clnt *clnt; int flags; @@ -1415,7 +1415,7 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, cb->cb_msg.rpc_argp = cb; cb->cb_msg.rpc_resp = cb; cb->cb_ops = ops; - INIT_WORK(&cb->cb_work, nfsd4_run_cb_work); + INIT_DELAYED_WORK(&cb->cb_work, nfsd4_run_cb_work); cb->cb_seq_status = 1; cb->cb_status = 0; cb->cb_need_restart = false; diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 41bdc913fa71..87c4372ba36a 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -68,7 +68,7 @@ struct nfsd4_callback { struct nfs4_client *cb_clp; struct rpc_message cb_msg; const struct nfsd4_callback_ops *cb_ops; - struct work_struct cb_work; + struct delayed_work cb_work; int cb_seq_status; int cb_status; bool cb_need_restart;