From patchwork Thu Jul 30 13:55:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6902961 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 5215E9F38B for ; Thu, 30 Jul 2015 13:55:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6229D20592 for ; Thu, 30 Jul 2015 13:55:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92E6320582 for ; Thu, 30 Jul 2015 13:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752138AbbG3NzT (ORCPT ); Thu, 30 Jul 2015 09:55:19 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:33157 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751287AbbG3NzS (ORCPT ); Thu, 30 Jul 2015 09:55:18 -0400 Received: by pdbnt7 with SMTP id nt7so25091754pdb.0 for ; Thu, 30 Jul 2015 06:55:17 -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=oE8NaGe40KZUCDAu0QAlC9+R/Ej0q45rMuwUX1Tb6k8=; b=zg0ToYn1A0LjSPpZd8tDLfkPo2NdezyUBS0BQb9WEFBKBhG8dHxlemyf1aaB6545SW gpzi4N9foEG0zE1+gEzZECNLdBxyKJCd+0cZJPqz4HUzPFmwvVAI5NOY8pMuDSsy1hsh 2Rsqate/79K6CjB2ZRnDtdsKs7DIWOE9ZrLNx2bSfImp2bZ58YR5XKM4p3rikpo2I12O aKTf5TGclqJmBcdOiUzbgKINIVL8jYw73uglQKHgIcBwNWTxStIDBC2YrUwWRmo72l+p XcxHHVFOwFfJOMUith87pbiQ25L4ngy1ZVr1THe5iqBeMROfTH/5x8JcNYhXHcmSFPeP 6ZZg== X-Received: by 10.70.91.12 with SMTP id ca12mr106930159pdb.135.1438264517696; Thu, 30 Jul 2015 06:55:17 -0700 (PDT) Received: from [192.168.99.8] ([104.143.41.79]) by smtp.googlemail.com with ESMTPSA id rh11sm2447685pdb.22.2015.07.30.06.55.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 06:55:17 -0700 (PDT) Message-ID: <55BA2CB6.8040806@gmail.com> Date: Thu, 30 Jul 2015 21:55:02 +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: "J. Bruce Fields" CC: "linux-nfs@vger.kernel.org" , kinglongmee@gmail.com Subject: [PATCH 4/5] NFSD: Set the attributes used to store the verifier for EXCLUSIVE4_1 References: <55BA2B46.90204@gmail.com> In-Reply-To: <55BA2B46.90204@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 According to rfc5661 18.16.4, "If EXCLUSIVE4_1 was used, the client determines the attributes used for the verifier by comparing attrset with cva_attrs.attrmask;" So, EXCLUSIVE4_1 also needs those bitmask used to store the verifier. Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4proc.c | 12 ++++++------ fs/nfsd/vfs.c | 6 ------ fs/nfsd/vfs.h | 6 ++++++ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 90cfda7..91f05e8 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -276,13 +276,13 @@ do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, stru nfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval); /* - * Following rfc 3530 14.2.16, use the returned bitmask - * to indicate which attributes we used to store the - * verifier: + * Following rfc 3530 14.2.16, and rfc 5661 18.16.4 + * use the returned bitmask to indicate which attributes + * we used to store the verifier: */ - if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) - open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | - FATTR4_WORD1_TIME_MODIFY); + if (nfsd_create_is_exclusive(open->op_createmode) && status == 0) + open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS | + FATTR4_WORD1_TIME_MODIFY); } else /* * Note this may exit with the parent still locked. diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index b5e077a..45c0497 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1249,12 +1249,6 @@ out_nfserr: #ifdef CONFIG_NFSD_V3 -static inline int nfsd_create_is_exclusive(int createmode) -{ - return createmode == NFS3_CREATE_EXCLUSIVE - || createmode == NFS4_CREATE_EXCLUSIVE4_1; -} - /* * NFSv3 and NFSv4 version of nfsd_create */ diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index 5be875e..fee2451 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h @@ -131,4 +131,10 @@ static inline __be32 fh_getattr(struct svc_fh *fh, struct kstat *stat) return nfserrno(vfs_getattr(&p, stat)); } +static inline int nfsd_create_is_exclusive(int createmode) +{ + return createmode == NFS3_CREATE_EXCLUSIVE + || createmode == NFS4_CREATE_EXCLUSIVE4_1; +} + #endif /* LINUX_NFSD_VFS_H */