From patchwork Mon Dec 28 16:28:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Coddington X-Patchwork-Id: 7926651 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1030DBEEE5 for ; Mon, 28 Dec 2015 16:28:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 453D92022D for ; Mon, 28 Dec 2015 16:28:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58E082024D for ; Mon, 28 Dec 2015 16:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751250AbbL1Q2K (ORCPT ); Mon, 28 Dec 2015 11:28:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34052 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbbL1Q2I (ORCPT ); Mon, 28 Dec 2015 11:28:08 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id DD1E1A8C; Mon, 28 Dec 2015 16:28:07 +0000 (UTC) Received: from bcodding-csb.redhat.com (vpn-56-238.rdu2.redhat.com [10.10.56.238]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBSGS719005540; Mon, 28 Dec 2015 11:28:07 -0500 Received: by bcodding-csb.redhat.com (Postfix, from userid 24008) id C3D45E3B61; Mon, 28 Dec 2015 11:28:06 -0500 (EST) From: Benjamin Coddington To: Trond Myklebust , Anna Schumaker , Jeff Layton , "J. Bruce Fields" , Christoph Hellwig Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 04/10] NFSv4: Pass nfs_open_context instead of nfs4_state to nfs4_proc_unlck() Date: Mon, 28 Dec 2015 11:28:00 -0500 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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, 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 nfs4_proc_unlk() acquires the nfs_open_context from the file_lock's fl_file->private, but we will not always have a referenced fl_file in this path. Instead, pass along the nfs_open_context from the call to nfs4_proc_lock(). This allows us to use nfs4_proc_unlck() without a valid reference in fl_file. Signed-off-by: Benjamin Coddington Reviewed-by: Jeff Layton --- fs/nfs/nfs4proc.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 784ba4e..279c8b3 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5656,8 +5656,10 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, return rpc_run_task(&task_setup_data); } -static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request) +static int nfs4_proc_unlck(struct nfs_open_context *ctx, + int cmd, struct file_lock *request) { + struct nfs4_state *state = ctx->state; struct inode *inode = state->inode; struct nfs4_state_owner *sp = state->owner; struct nfs_inode *nfsi = NFS_I(inode); @@ -5693,7 +5695,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock * status = -ENOMEM; if (IS_ERR(seqid)) goto out; - task = nfs4_do_unlck(request, nfs_file_open_context(request->fl_file), lsp, seqid); + task = nfs4_do_unlck(request, ctx, lsp, seqid); status = PTR_ERR(task); if (IS_ERR(task)) goto out; @@ -6117,7 +6119,7 @@ nfs4_proc_lock(struct nfs_open_context *ctx, int cmd, struct file_lock *request) if (request->fl_type == F_UNLCK) { if (state != NULL) - return nfs4_proc_unlck(state, cmd, request); + return nfs4_proc_unlck(ctx, cmd, request); return 0; }