From patchwork Fri Aug 15 00:02:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4725921 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 94B56C0338 for ; Fri, 15 Aug 2014 00:03:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2FB820142 for ; Fri, 15 Aug 2014 00:03:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DABE42012B for ; Fri, 15 Aug 2014 00:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751272AbaHOADL (ORCPT ); Thu, 14 Aug 2014 20:03:11 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:55898 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751209AbaHOADK (ORCPT ); Thu, 14 Aug 2014 20:03:10 -0400 Received: by mail-pa0-f41.google.com with SMTP id rd3so2528976pab.28 for ; Thu, 14 Aug 2014 17:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=vpn1JLcsA1mYJEOMT8XdLEySzxAKbrsIZpbRBfEJqXg=; b=kWG4rIvAx96utBvFB9he7FgQPf5PKeyugoxGhtGsJ6Ru5zXdgfVU+p8oOi5alSoyzK 3WD5Uhc7OorM+h/f9/94AMVilvNdHhiLmzPv3EEj4gMsH88sOGBkXH5heTRKQQoQBtzV bmYnQywtuWGNB3lBYSGm5AmTD74cPrwCgk300RU+Fh4AFB1fcrqYRUnMKqiswIHVFExK uvF6kGDBkIod8SwJ2KKhcUnPQWh4kOT2lx0jgTX4IAyp2Nd03RLw5unG2nSf2XJu57aU dh2hErPWIB3DotQbx2CdnZxXpp6B6G1iIMHL5p4e1Je++8CMIsm07aXuqZNCk3C12zp4 1XDg== X-Received: by 10.66.66.202 with SMTP id h10mr7596091pat.70.1408060990241; Thu, 14 Aug 2014 17:03:10 -0700 (PDT) Received: from [192.168.0.100] ([171.208.179.144]) by mx.google.com with ESMTPSA id un15sm22041056pab.14.2014.08.14.17.03.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Aug 2014 17:03:09 -0700 (PDT) Message-ID: <53ED4E2F.2010701@gmail.com> Date: Fri, 15 Aug 2014 08:02:55 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Jeff Layton CC: "J. Bruce Fields" , Linux NFS Mailing List , Trond Myklebust , linux-fsdevel@vger.kernel.org, kinglongmee@gmail.com Subject: [PATCH 1/5 v3] NFSD: Remove duplicate initialization of file_lock References: <53BAAAC5.9000106@gmail.com> <53E22EA5.70708@gmail.com> <20140809065112.700e0ecc@tlielax.poochiereds.net> <53E791F1.40802@gmail.com> In-Reply-To: <53E791F1.40802@gmail.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.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 locks_alloc_lock() has initialize struct file_lock, don't need re-initialize it by locks_init_lock(). v3: A new patch isn't exit in v2/v1. Signed-off-by: Kinglong Mee Reviewed-by: Jeff Layton --- fs/nfsd/nfs4state.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2e80a59..98edf97 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3759,7 +3759,6 @@ static struct file_lock *nfs4_alloc_init_lease(struct nfs4_file *fp, int flag) fl = locks_alloc_lock(); if (!fl) return NULL; - locks_init_lock(fl); fl->fl_lmops = &nfsd_lease_mng_ops; fl->fl_flags = FL_DELEG; fl->fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK; @@ -5210,7 +5209,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, } fp = lock_stp->st_stid.sc_file; - locks_init_lock(file_lock); switch (lock->lk_type) { case NFS4_READ_LT: case NFS4_READW_LT: @@ -5354,7 +5352,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfserr_jukebox; goto out; } - locks_init_lock(file_lock); + switch (lockt->lt_type) { case NFS4_READ_LT: case NFS4_READW_LT: @@ -5432,7 +5430,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfserr_jukebox; goto fput; } - locks_init_lock(file_lock); + file_lock->fl_type = F_UNLCK; file_lock->fl_owner = (fl_owner_t)lockowner(stp->st_stateowner); file_lock->fl_pid = current->tgid;