Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp166341rwb; Mon, 26 Sep 2022 10:37:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6x6UgG2KCXwIEJ8vgSrErNG/RZRUhRsHiMGYFpxC/0ZINlRGLp1R2kRwdfN2uoAIjfoDQq X-Received: by 2002:a62:4e8e:0:b0:54a:ee65:cde6 with SMTP id c136-20020a624e8e000000b0054aee65cde6mr24823993pfb.42.1664213841105; Mon, 26 Sep 2022 10:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664213841; cv=none; d=google.com; s=arc-20160816; b=sxFYljgL+96RIjGKsyZs52UAGDtCtyTGoeRPWYS+PjPDDmb6WtjulI2VQ7mTpbJWdy qV5FL54KG3tktZFHgrpN40zV8EYeUGK8D/xhmA3AyRrweUskFaVXeNq5D8+KHzEUW8cQ RPIEQyD6VCEeEVU9CvpgPBY2Ewrm+zclYjwhvWzyA/hiuWD73GKdNg7ouPapYpH6Eoh1 k62zZbgOI6zliOUvcJM7cLnvou1bi/MxB5SW0f8yyN8ZrvyCCKqhNqKL45fRPKXKMKFl No2CCn0ihmuYaqISoOH+uDe71KoUWwk6Ji7P89TGSAOuNIs2oZW8pVYsHGyazyMnwhWd E7kA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JUTXwDGC2QpkfR2MOG4o/CUmeusAyn7+Gqbo1kQmeQg=; b=w4V/ZE8ARIqGma7zi/gx7po0o5q25yManxYdFZwXnUPWNTzXCBTz+6K5k4JzO6iBIw YtvFRfTYmm4j8v9mqr9uE+wkcHGOFZDZsHZwx5Sf81pYLhUWvqmfCeF/wBxZ1rfMBbJZ N2nhxWqckTnll7ejZoJQMmgo1qDQF+zzjf4JaXRpjPs1iu35e+/QcHQhvyC6ApuKy7VU CdjnbpzAbGp3RkXX/ZZcJyA6BR+rmukNmD3H+FSHLQdZL87xuTEXbnUJQ9X9QCYeyFEH MsBDk5DIMrLmQGvs/gsR++UyibYTGDLWopjfB8FWLOw3myMgSD7ZqLaPKgdf/rXmtJDX +smg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Qnz7+1rm; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020aa78bcc000000b00544328b120csi17165813pfd.202.2022.09.26.10.36.40; Mon, 26 Sep 2022 10:37:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Qnz7+1rm; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230448AbiIZRYG (ORCPT + 99 others); Mon, 26 Sep 2022 13:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbiIZRXp (ORCPT ); Mon, 26 Sep 2022 13:23:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56BF151B3E for ; Mon, 26 Sep 2022 09:38:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB6AF60FE6 for ; Mon, 26 Sep 2022 16:38:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EECF2C433B5; Mon, 26 Sep 2022 16:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664210331; bh=RpHxrgYpxq35FjRPQqazIiOeT+xlQVivUxI1IvXfHig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qnz7+1rmskL9OqUZ9fNzuQ3/ZL0shEVTKZDsoSOyNn1mJo9Xlh3PCO2X17PpIX8PH Eu+jHuXxQNTkME/R1eoEicb5EhFi+I6svCThh/qailDgt7u/FgD9EPNXLIjQ2Za6nF /Bzyy0uO4gDGg03QLz+6aulq1a7FV62hOVfW+TpuYPKVPmjPirYGWutzn0sDrxVf6A bs7jPzeewWkT5KI7mM5hD/H/6M81gdRkf2bvN0uEXB1YiuL7K7RiJXR0oDis4DjLPN dWnA2SQFawyPmSCVtKthHjZEg5rDwwYRTWL0p6MjlU64hbAT2b3GYl+17HJuEHxCsB H9WafQx3BIfHw== From: Jeff Layton To: chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH 3/4] nfsd: make nfsd4_run_cb a bool return function Date: Mon, 26 Sep 2022 12:38:46 -0400 Message-Id: <20220926163847.47558-4-jlayton@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926163847.47558-1-jlayton@kernel.org> References: <20220926163847.47558-1-jlayton@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org ...and mirror the semantics of queue_work. Also, queueing a delegation recall should always succeed when queueing, so WARN if one ever doesn't. Signed-off-by: Jeff Layton --- fs/nfsd/nfs4callback.c | 14 ++++++++++++-- fs/nfsd/nfs4state.c | 5 ++--- fs/nfsd/state.h | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 4ce328209f61..ba904614ebf5 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -1371,11 +1371,21 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, cb->cb_holds_slot = false; } -void nfsd4_run_cb(struct nfsd4_callback *cb) +/** + * nfsd4_run_cb - queue up a callback job to run + * @cb: callback to queue + * + * Kick off a callback to do its thing. Returns false if it was already + * queued or running, true otherwise. + */ +bool nfsd4_run_cb(struct nfsd4_callback *cb) { + bool queued; struct nfs4_client *clp = cb->cb_clp; nfsd41_cb_inflight_begin(clp); - if (!nfsd4_queue_cb(cb)) + queued = nfsd4_queue_cb(cb); + if (!queued) nfsd41_cb_inflight_end(clp); + return queued; } diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 211f1af1cfb3..90533f43fea9 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4861,14 +4861,13 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp) * we know it's safe to take a reference. */ refcount_inc(&dp->dl_stid.sc_count); - nfsd4_run_cb(&dp->dl_recall); + WARN_ON_ONCE(!nfsd4_run_cb(&dp->dl_recall)); } /* Called from break_lease() with flc_lock held. */ static bool nfsd_break_deleg_cb(struct file_lock *fl) { - bool ret = false; struct nfs4_delegation *dp = (struct nfs4_delegation *)fl->fl_owner; struct nfs4_file *fp = dp->dl_stid.sc_file; struct nfs4_client *clp = dp->dl_stid.sc_client; @@ -4894,7 +4893,7 @@ nfsd_break_deleg_cb(struct file_lock *fl) fp->fi_had_conflict = true; nfsd_break_one_deleg(dp); spin_unlock(&fp->fi_lock); - return ret; + return false; } /** diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index b3477087a9fc..e2daef3cc003 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -692,7 +692,7 @@ extern void nfsd4_probe_callback_sync(struct nfs4_client *clp); extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *); extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, const struct nfsd4_callback_ops *ops, enum nfsd4_cb_op op); -extern void nfsd4_run_cb(struct nfsd4_callback *cb); +extern bool nfsd4_run_cb(struct nfsd4_callback *cb); extern int nfsd4_create_callback_queue(void); extern void nfsd4_destroy_callback_queue(void); extern void nfsd4_shutdown_callback(struct nfs4_client *); -- 2.37.3