From patchwork Tue Jul 29 20:33:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4642511 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DED849F2B8 for ; Tue, 29 Jul 2014 20:35:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 283412012D for ; Tue, 29 Jul 2014 20:35:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2746320142 for ; Tue, 29 Jul 2014 20:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754390AbaG2Uex (ORCPT ); Tue, 29 Jul 2014 16:34:53 -0400 Received: from mail-qa0-f41.google.com ([209.85.216.41]:61806 "EHLO mail-qa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754386AbaG2Uev (ORCPT ); Tue, 29 Jul 2014 16:34:51 -0400 Received: by mail-qa0-f41.google.com with SMTP id j7so271001qaq.28 for ; Tue, 29 Jul 2014 13:34:50 -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=SZkgDf61iJG6A3wgmLo30MXYK0+RJ9dosMAmvp18/fs=; b=WhGITfl00FBGusW6Yucw5VlmDHs+PnUThr2MuOmLiOA5Kl6FIYfYY2fIZKEf6gybkS r8XupMBJhh9joMDDdYyevwZCL551T9xu52NQJyosbgD2O2BbD0hZqqORuC2R+OD+y2IM FQ8w7PlhSBNllcWbiHOKT3V6DwAwJhoq85TUEIHue2hhfDcJ2V3Hs33dxwhJ9FFGhtPs 8e2b0Y8K2DM0a3qjJQm1bwKIM5BWHg5zD1K/CmuiTF12IV/pcf1/Pzfnr0G6QRUEgBHY H4sPHYOfzcimXMc31XrXAlGXrJ45CfIqMMKNrg4J2ZESNRr+2SRURrQKrJNPGfig0Stb UOFw== X-Gm-Message-State: ALoCoQkm/2kfu12Nw2ni88Wsv4yJBH9B9JgPZJQy4N5RJ/cndos+Ow7tHwZtPGnHbbqdvru5b1Vu X-Received: by 10.140.31.246 with SMTP id f109mr7409509qgf.8.1406666090449; Tue, 29 Jul 2014 13:34:50 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id 98sm74611qgh.5.2014.07.29.13.34.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jul 2014 13:34:49 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org, Trond Myklebust Subject: [PATCH v2 14/38] nfsd: nfsd4_process_open2() must reference the open stateid Date: Tue, 29 Jul 2014 16:33:57 -0400 Message-Id: <1406666061-14175-15-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406666061-14175-1-git-send-email-jlayton@primarydata.com> References: <1406666061-14175-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=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Trond Myklebust Ensure that nfsd4_process_open2() keeps a reference to the open stateid until it is done working with it. Necessary step toward client_mutex removal. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2020303fd100..f8e181fda015 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2996,6 +2996,7 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open, static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *open) { struct nfs4_openowner *oo = open->op_openowner; + atomic_inc(&stp->st_stid.sc_count); stp->st_stid.sc_type = NFS4_OPEN_STID; INIT_LIST_HEAD(&stp->st_locks); stp->st_stateowner = &oo->oo_owner; @@ -3376,6 +3377,7 @@ nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open) continue; if (local->st_stateowner == &oo->oo_owner) { ret = local; + atomic_inc(&ret->st_stid.sc_count); break; } } @@ -3836,6 +3838,8 @@ out: open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM; if (dp) nfs4_put_stid(&dp->dl_stid); + if (stp) + nfs4_put_stid(&stp->st_stid); return status; }