From patchwork Thu Jul 30 13:42:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6902661 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 49D109F39D for ; Thu, 30 Jul 2015 13:42:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6887620592 for ; Thu, 30 Jul 2015 13:42:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80A60205B8 for ; Thu, 30 Jul 2015 13:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752048AbbG3Nmv (ORCPT ); Thu, 30 Jul 2015 09:42:51 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35612 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750901AbbG3Nmi (ORCPT ); Thu, 30 Jul 2015 09:42:38 -0400 Received: by pabkd10 with SMTP id kd10so23843644pab.2 for ; Thu, 30 Jul 2015 06:42:37 -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=JzXi/IRrnnwg+5oA53hDjsdzRSbM0gpugZKY95rWGko=; b=BwjUAjl4p2isOCSVVnmhdAR/zMb9zPBRx7Tp24aeCNrm3gYvUyyq6Gt5ZcnavxAouz S3WwF4Aokam4kxJX044i8jwBhs83dxwFEXTKkPbcTfIfD7KyDEm7z6HIGjpkkD4wuNhJ ZcJ+8ura3A8U4NW7xgZPpkJbJ+sNXJ2woHgZcWYe45HywS+2utWYMrF0yr2gxjlCiH9k mNoVWzGay3NAB5BexzLE2yJhB6cypWXON+g9utjpyK855/pHPaX4gqmNxlpxrhtqk358 375ydlwbLFe+bPpL1p7S5XTCKjjyBct9SFNqbljg5j4DmzAp6lcrzJp+w6/nZL3rd5XD tzRg== X-Received: by 10.66.141.135 with SMTP id ro7mr78962451pab.68.1438263757437; Thu, 30 Jul 2015 06:42:37 -0700 (PDT) Received: from [192.168.99.8] ([104.143.41.79]) by smtp.googlemail.com with ESMTPSA id os7sm2357552pdb.51.2015.07.30.06.42.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 06:42:36 -0700 (PDT) Message-ID: <55BA29BF.5050300@gmail.com> Date: Thu, 30 Jul 2015 21:42:23 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Trond Myklebust CC: "linux-nfs@vger.kernel.org" , kinglongmee@gmail.com Subject: [PATCH 4/7] NFS: Make opened as optional argument in _nfs4_do_open References: <55BA290B.2020704@gmail.com> <55BA2936.4030404@gmail.com> In-Reply-To: <55BA2936.4030404@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=-8.2 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 Check opened, only update it when non-NULL. It's not needs define an unused value for the opened when calling _nfs4_do_open. v2, add change-log. Signed-off-by: Kinglong Mee --- fs/nfs/nfs4file.c | 3 +-- fs/nfs/nfs4proc.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index dcd39d4..43f1590 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -27,7 +27,6 @@ nfs4_file_open(struct inode *inode, struct file *filp) struct inode *dir; unsigned openflags = filp->f_flags; struct iattr attr; - int opened = 0; int err; /* @@ -66,7 +65,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) nfs_sync_inode(inode); } - inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, &opened); + inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, NULL); if (IS_ERR(inode)) { err = PTR_ERR(inode); switch (err) { diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 3acb1eb..1e5a2fb 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2439,7 +2439,7 @@ static int _nfs4_do_open(struct inode *dir, nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel); } } - if (opendata->file_created) + if (opened && opendata->file_created) *opened |= FILE_CREATED; if (pnfs_use_threshold(ctx_th, opendata->f_attr.mdsthreshold, server)) { @@ -3552,7 +3552,6 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, struct nfs4_label l, *ilabel = NULL; struct nfs_open_context *ctx; struct nfs4_state *state; - int opened = 0; int status = 0; ctx = alloc_nfs_open_context(dentry, FMODE_READ); @@ -3562,7 +3561,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ilabel = nfs4_label_init_security(dir, dentry, sattr, &l); sattr->ia_mode &= ~current_umask(); - state = nfs4_do_open(dir, ctx, flags, sattr, ilabel, &opened); + state = nfs4_do_open(dir, ctx, flags, sattr, ilabel, NULL); if (IS_ERR(state)) { status = PTR_ERR(state); goto out;