From patchwork Thu Jul 30 13:51:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6902821 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 AFE3FC05AC for ; Thu, 30 Jul 2015 13:52:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB65D205BB for ; Thu, 30 Jul 2015 13:52:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC006205B4 for ; Thu, 30 Jul 2015 13:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753369AbbG3Nwl (ORCPT ); Thu, 30 Jul 2015 09:52:41 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:36698 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753334AbbG3Nwj (ORCPT ); Thu, 30 Jul 2015 09:52:39 -0400 Received: by pdjr16 with SMTP id r16so25513704pdj.3 for ; Thu, 30 Jul 2015 06:52:39 -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=yqADzo7LCHw3xTsmUIp4xT9C9cDKLvqUJXma11uAGt4=; b=bVS6/MTML6I4K+Ydz7n5aKKe8O6JA3kFUQ/Po7hoP/Nj/IGb28J9QGe5CEzNo9t/Lu 8gFM7DwVCfAFAO+K82TJu5aV/SSxAqilqn8ymppHn9ptfijLr2pMYrmpSwLx3OzlpjiV hH/h8DmfUg3tnPB68TT1BFGsH8u7NPyP/rsjfl7OESHGxeOrX9sGuIAA3VSRmALvsIWF Wkf+FerwAkCQ/+XRpFc6iXiq2YqcAQTAtAb3IWPGHj0AcugSZd22yK7VoRrdsXjUfOKg Z8Q/jyBfdEM9ECNl0RRfy9pr6NqbUBrhQuezzGIcNvfv0p90egJTZfPyfazpS1mrzTPo 9t1w== X-Received: by 10.70.65.99 with SMTP id w3mr107019044pds.132.1438264359093; Thu, 30 Jul 2015 06:52:39 -0700 (PDT) Received: from [192.168.99.8] ([104.143.41.79]) by smtp.googlemail.com with ESMTPSA id pm4sm2414597pdb.36.2015.07.30.06.52.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 06:52:38 -0700 (PDT) Message-ID: <55BA2BFA.2060809@gmail.com> Date: Thu, 30 Jul 2015 21:51:54 +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 1/5] NFSD: Store parent's stat in a sperate value 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 Commit ae7095a7c4 (nfsd4: helper function for getting mounted_on ino) don't process the return value from get_parent_attributes(). Also, the following FATTR4_WORD2_LAYOUT_BLKSIZE will using stat.blksize, using an independent value for parent's attributes. Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4xdr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 5463385..f11003c 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2674,6 +2674,9 @@ out_acl: *p++ = cpu_to_be32(stat.mtime.tv_nsec); } if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) { + struct kstat parent_stat; + u64 ino = stat.ino; + p = xdr_reserve_space(xdr, 8); if (!p) goto out_resource; @@ -2682,9 +2685,13 @@ out_acl: * and this is the root of a cross-mounted filesystem. */ if (ignore_crossmnt == 0 && - dentry == exp->ex_path.mnt->mnt_root) - get_parent_attributes(exp, &stat); - p = xdr_encode_hyper(p, stat.ino); + dentry == exp->ex_path.mnt->mnt_root) { + err = get_parent_attributes(exp, &parent_stat); + if (err) + goto out_nfserr; + ino = parent_stat.ino; + } + p = xdr_encode_hyper(p, ino); } #ifdef CONFIG_NFSD_PNFS if ((bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) ||