From patchwork Mon Jul 7 14:13:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4494971 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 56B269F1C4 for ; Mon, 7 Jul 2014 14:14:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86B9720212 for ; Mon, 7 Jul 2014 14:14:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE573201EC for ; Mon, 7 Jul 2014 14:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbaGGOOe (ORCPT ); Mon, 7 Jul 2014 10:14:34 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:35844 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753219AbaGGOOe (ORCPT ); Mon, 7 Jul 2014 10:14:34 -0400 Received: by mail-pd0-f181.google.com with SMTP id v10so5444314pde.12 for ; Mon, 07 Jul 2014 07:14:33 -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 :content-type:content-transfer-encoding; bh=9FYrQR0ZH2MNn7lLfPU1mVUQn2PHVNT5XALmkCXKRbs=; b=WAlXnG2Tuhtvxms7EKIDzOZwjIjKF5im/lT9J7YepRRacN6N3lhJb2DRA018mGH9BG idzf0yW8qJOEgagzpiodHR+DpB9qjkALGh/L7m5dbCS2KfqTpR9hk/vuxFjAmOqkiwr6 rKmRpIVYiIWWRniUErR6RXeVAejlhXkM623rRpCbJLXOECq1XM9Pd2Qgz4BL6eBiVrqd QbxUNq6loO3tUdSHxkh9VFpqEuXzpNQUxKiJ+9F+cY2OeraoZRxD/H6YyOd4IiD8KKlb 0AVM3yxq0M4uFagR7hve3f41Arw2A+pHN8ulXxvkU+SL7ffYu0SetmXdZCLPE/xAai8U aC9A== X-Received: by 10.68.226.105 with SMTP id rr9mr877945pbc.161.1404742473640; Mon, 07 Jul 2014 07:14:33 -0700 (PDT) Received: from [192.168.0.100] ([118.117.112.198]) by mx.google.com with ESMTPSA id mz8sm20478899pdb.62.2014.07.07.07.14.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Jul 2014 07:14:32 -0700 (PDT) Message-ID: <53BAAB1D.6080309@gmail.com> Date: Mon, 07 Jul 2014 22:13:49 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , kinglongmee@gmail.com Subject: [PATCH 4/4] NFSD: Cleanup for nfsd4_release_lockowner() 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.4 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 Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4state.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1b5afc1..abb2d81 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4815,11 +4815,9 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *rlockowner) { clientid_t *clid = &rlockowner->rl_clientid; - struct nfs4_stateowner *sop = NULL, *tmp; + struct nfs4_stateowner *sop; struct nfs4_lockowner *lo; struct nfs4_ol_stateid *stp; - struct xdr_netobj *owner = &rlockowner->rl_owner; - unsigned int hashval = ownerstr_hashval(clid->cl_id, owner); __be32 status; struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); @@ -4833,24 +4831,13 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, goto out; status = nfserr_locks_held; - - /* Find the matching lock stateowner */ - list_for_each_entry(tmp, &nn->ownerstr_hashtbl[hashval], so_strhash) { - if (tmp->so_is_open_owner) - continue; - if (same_owner_str(tmp, owner, clid)) { - sop = tmp; - break; - } - } - - /* No matching owner found, maybe a replay? Just declare victory... */ - if (!sop) { + lo = find_lockowner_str(clid, &rlockowner->rl_owner, nn); + if (!lo) { status = nfs_ok; goto out; } - lo = lockowner(sop); + sop = &lo->lo_owner; /* see if there are still any locks associated with it */ list_for_each_entry(stp, &sop->so_stateids, st_perstateowner) { if (check_for_locks(stp->st_file, lo))