From patchwork Mon Dec 7 16:26:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Coddington X-Patchwork-Id: 7788231 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 7F1299F349 for ; Mon, 7 Dec 2015 16:26:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD4ED20437 for ; Mon, 7 Dec 2015 16:26:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD38120426 for ; Mon, 7 Dec 2015 16:26:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932926AbbLGQ0Q (ORCPT ); Mon, 7 Dec 2015 11:26:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40838 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932911AbbLGQ0L (ORCPT ); Mon, 7 Dec 2015 11:26:11 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id CB5758E36D; Mon, 7 Dec 2015 16:26:11 +0000 (UTC) Received: from bcodding-csb.redhat.com (unused [10.10.51.116] (may be forged)) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tB7GQB46007438; Mon, 7 Dec 2015 11:26:11 -0500 Received: by bcodding-csb.redhat.com (Postfix, from userid 24008) id ECCCEE3B51; Mon, 7 Dec 2015 11:26:09 -0500 (EST) From: Benjamin Coddington To: "J. Bruce Fields" , Jeff Layton , Trond Myklebust , Anna Schumaker , hch@infradead.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 07/10] lockd: do_vfs_lock() only needs the inode Date: Mon, 7 Dec 2015 11:26:06 -0500 Message-Id: <565d24deaab6b9e931076eac2236097d1f42cc65.1449503713.git.bcodding@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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=unavailable 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 Send the inode instead of the file to do_vfs_lock() by using locks_lock_inode_wait(). This allows an unlock operation to complete after a close when there may not be an fl_file. Signed-off-by: Benjamin Coddington --- fs/lockd/clntproc.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 91aa483..fa1d83b 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -476,9 +476,9 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho fl->fl_ops = &nlmclnt_lock_ops; } -static int do_vfs_lock(struct file_lock *fl) +static int do_vfs_lock(struct inode *inode, struct file_lock *fl) { - return locks_lock_file_wait(fl->fl_file, fl); + return locks_lock_inode_wait(inode, fl); } /* @@ -508,6 +508,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl) struct nlm_host *host = req->a_host; struct nlm_res *resp = &req->a_res; struct nlm_wait *block = NULL; + struct inode *inode = file_inode(fl->fl_file); unsigned char fl_flags = fl->fl_flags; unsigned char fl_type; int status = -ENOLCK; @@ -517,7 +518,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl) req->a_args.state = nsm_local_state; fl->fl_flags |= FL_ACCESS; - status = do_vfs_lock(fl); + status = do_vfs_lock(inode, fl); fl->fl_flags = fl_flags; if (status < 0) goto out; @@ -567,7 +568,7 @@ again: } /* Ensure the resulting lock will get added to granted list */ fl->fl_flags |= FL_SLEEP; - if (do_vfs_lock(fl) < 0) + if (do_vfs_lock(inode, fl) < 0) printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __func__); up_read(&host->h_rwsem); fl->fl_flags = fl_flags; @@ -597,7 +598,7 @@ out_unlock: fl_type = fl->fl_type; fl->fl_type = F_UNLCK; down_read(&host->h_rwsem); - do_vfs_lock(fl); + do_vfs_lock(inode, fl); up_read(&host->h_rwsem); fl->fl_type = fl_type; fl->fl_flags = fl_flags; @@ -665,7 +666,7 @@ nlmclnt_unlock(struct nfs_open_context *ctx, */ fl->fl_flags |= FL_EXISTS; down_read(&host->h_rwsem); - status = do_vfs_lock(fl); + status = do_vfs_lock(d_inode(ctx->dentry), fl); up_read(&host->h_rwsem); fl->fl_flags = fl_flags; if (status == -ENOENT) {