From patchwork Mon Jun 30 15:48:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4451091 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E028CBEEAA for ; Mon, 30 Jun 2014 15:50:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0107D2021F for ; Mon, 30 Jun 2014 15:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 10DC420375 for ; Mon, 30 Jun 2014 15:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754487AbaF3Puj (ORCPT ); Mon, 30 Jun 2014 11:50:39 -0400 Received: from mail-qc0-f177.google.com ([209.85.216.177]:34733 "EHLO mail-qc0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752096AbaF3Pui (ORCPT ); Mon, 30 Jun 2014 11:50:38 -0400 Received: by mail-qc0-f177.google.com with SMTP id r5so7152500qcx.8 for ; Mon, 30 Jun 2014 08:50:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Kds5C//7m6sCET3i4WxZSM+q0bO9kRB67xqjOdl+4mU=; b=BYGhJFG4F4sLIWLA32FVR4iWB4r2wR/Mf4aUoqjkhXldGLgG6J5ZoX4CsJ3E2o8bQs Buv91qtW4h5N2e8GBvam1WJzPS6hOdKdMJxKOtVInvtvp7GnxwPBTQ+hFIXR82/Jppmv c0Tyjm0v+1uk5QdtN5KPcbw8Vnt+gMbru/NYoGyjHD2fBQFfO6cC9Gx2NvwU/qEgZHJT Lic8GPSGi/887aw6vog9MRMlauMwiKlEn6d2loyu1FC/HYmMacc77Iyb0Jt/OgUdvZjd /Gr2SGF7FFc4HezBrcqHgZ4h+xIkzH7b4+z4J05uTqfQBiGxFFIm8pij0SHrkqMpIaZB 6SPA== X-Gm-Message-State: ALoCoQkGh+osuIC2PQcS7Bvv2ApSmrV4ySqnsmrRCiUtLKrbhE4mpjvrDkL06INrgWbxXbaK2ft4 X-Received: by 10.140.49.194 with SMTP id q60mr49905838qga.7.1404143437418; Mon, 30 Jun 2014 08:50:37 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id m1sm32584105qaz.27.2014.06.30.08.50.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jun 2014 08:50:36 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 003/114] nfsd: wait to initialize work struct just prior to using it Date: Mon, 30 Jun 2014 11:48:32 -0400 Message-Id: <1404143423-24381-4-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1404143423-24381-1-git-send-email-jlayton@primarydata.com> References: <1404143423-24381-1-git-send-email-jlayton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's a fair chance we won't ever need this work struct, so we might as well delay initializing it until just before we're going to use it. In a later patch, we'll need to intialize the work with a different function for delegation callbacks. By delaying this, we avoid having to do it twice. Signed-off-by: Jeff Layton Reviewed-by: Christoph Hellwig --- fs/nfsd/nfs4callback.c | 10 +++++----- fs/nfsd/nfs4state.c | 2 -- fs/nfsd/state.h | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 2c73cae9899d..00cb9b7a75f6 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -43,6 +43,7 @@ #define NFSDDBG_FACILITY NFSDDBG_PROC static void nfsd4_mark_cb_fault(struct nfs4_client *, int reason); +static void nfsd4_do_callback_rpc(struct work_struct *w); #define NFSPROC4_CB_NULL 0 #define NFSPROC4_CB_COMPOUND 1 @@ -763,6 +764,8 @@ static void do_probe_callback(struct nfs4_client *clp) cb->cb_ops = &nfsd4_cb_probe_ops; + INIT_WORK(&cb->cb_work, nfsd4_do_callback_rpc); + run_nfsd4_cb(cb); } @@ -1031,11 +1034,6 @@ static void nfsd4_do_callback_rpc(struct work_struct *w) cb->cb_ops, cb); } -void nfsd4_init_callback(struct nfsd4_callback *cb) -{ - INIT_WORK(&cb->cb_work, nfsd4_do_callback_rpc); -} - void nfsd4_cb_recall(struct nfs4_delegation *dp) { struct nfsd4_callback *cb = &dp->dl_recall; @@ -1053,5 +1051,7 @@ void nfsd4_cb_recall(struct nfs4_delegation *dp) INIT_LIST_HEAD(&cb->cb_per_client); cb->cb_done = true; + INIT_WORK(&cb->cb_work, nfsd4_do_callback_rpc); + run_nfsd4_cb(&dp->dl_recall); } diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 29788fd0da24..b49b46b0ce23 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -466,7 +466,6 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct sv fh_copy_shallow(&dp->dl_fh, ¤t_fh->fh_handle); dp->dl_time = 0; atomic_set(&dp->dl_count, 1); - nfsd4_init_callback(&dp->dl_recall); return dp; } @@ -1472,7 +1471,6 @@ static struct nfs4_client *create_client(struct xdr_netobj name, spin_unlock(&nn->client_lock); return NULL; } - nfsd4_init_callback(&clp->cl_cb_null); clp->cl_time = get_seconds(); clear_bit(0, &clp->cl_cb_slot_busy); copy_verf(clp, verf); diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 374c66283ac5..9447f86f2778 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -464,7 +464,6 @@ extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir, struct nfsd_net *nn); extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions, struct nfsd_net *nn); extern int set_callback_cred(void); -extern void nfsd4_init_callback(struct nfsd4_callback *); extern void nfsd4_probe_callback(struct nfs4_client *clp); extern void nfsd4_probe_callback_sync(struct nfs4_client *clp); extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);