From patchwork Thu Oct 1 13:05:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7308831 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 612509F314 for ; Thu, 1 Oct 2015 13:05:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C06220382 for ; Thu, 1 Oct 2015 13:05:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 648C22037F for ; Thu, 1 Oct 2015 13:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933007AbbJANFz (ORCPT ); Thu, 1 Oct 2015 09:05:55 -0400 Received: from mail-qg0-f45.google.com ([209.85.192.45]:34050 "EHLO mail-qg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932966AbbJANFy (ORCPT ); Thu, 1 Oct 2015 09:05:54 -0400 Received: by qgez77 with SMTP id z77so64368140qge.1 for ; Thu, 01 Oct 2015 06:05:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=J/nlyu/3qdhU5y0g0/80QH5ldKZfga0Z2OC1BepM8+U=; b=YB11HzGvj4ot5CxmM05MVyc95XxwV9096NIUFKxLz3ZkwlOpCLmMTTpfp/b7OD2T9C ZIKVbDDxFqt9L/KaJPNrfUhXHBbFdjou9OusC563uzRbss7ct/vrZEw+IO/7dns6w+71 w9YF8B/l5txHctysbBEhLQd5ZfPU1gqYXnS4+A7DzDwUPWJFnbQR0uxLgZlTbn4auhh1 v2+efGWBWBBNAf7BJKCnwGVMNJTDmYKJ39gtIAj8AK7tNHEMG2dPeUty7SqogfDzg6ky ZuEulP6eBSunlBtZaZ4NiKMLicRxyntY2UFc59lFwM6R+yljfCvjJQW9XkejHpuYpZsf Mhaw== X-Gm-Message-State: ALoCoQkuuSil+JHzUSPJjy4kvELUt60T4T5VDO0oQKI/ld3mjRg3iCwuQn7zJJxlkSOxa4R4YRgw X-Received: by 10.140.96.135 with SMTP id k7mr12220631qge.34.1443704754021; Thu, 01 Oct 2015 06:05:54 -0700 (PDT) Received: from tlielax.poochiereds.net ([2606:a000:1125:6079::d5a]) by smtp.googlemail.com with ESMTPSA id z19sm2360790qge.38.2015.10.01.06.05.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 06:05:53 -0700 (PDT) From: Jeff Layton X-Google-Original-From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH] nfsd: add a spinlock to nfs4_stid Date: Thu, 1 Oct 2015 09:05:50 -0400 Message-Id: <1443704750-7277-1-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 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 ...to allow seqid morphing to be serialized wrt to its copying. Signed-off-by: Jeff Layton --- fs/nfsd/nfs4state.c | 1 + fs/nfsd/state.h | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index bec2cc7eac78..156fc9183728 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -577,6 +577,7 @@ struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; /* Will be incremented before return to client: */ atomic_set(&stid->sc_count, 1); + spin_lock_init(&stid->sc_lock); /* * It shouldn't be a problem to reuse an opaque stateid value. diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 6f35fec88517..e3a191ea771c 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -84,7 +84,7 @@ struct nfsd4_callback_ops { * fields that are of general use to any stateid. */ struct nfs4_stid { - atomic_t sc_count; + atomic_t sc_count; #define NFS4_OPEN_STID 1 #define NFS4_LOCK_STID 2 #define NFS4_DELEG_STID 4 @@ -94,11 +94,12 @@ struct nfs4_stid { #define NFS4_REVOKED_DELEG_STID 16 #define NFS4_CLOSED_DELEG_STID 32 #define NFS4_LAYOUT_STID 64 - unsigned char sc_type; - stateid_t sc_stateid; - struct nfs4_client *sc_client; - struct nfs4_file *sc_file; - void (*sc_free)(struct nfs4_stid *); + unsigned char sc_type; + stateid_t sc_stateid; + spinlock_t sc_lock; + struct nfs4_client *sc_client; + struct nfs4_file *sc_file; + void (*sc_free)(struct nfs4_stid *); }; /*