Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp490068pxj; Wed, 16 Jun 2021 07:07:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf/IR52PF6r9fkFQF8hCebI5b1kDhIM5PyIxeRf9FPo5b8vd7JZF0txmPQn3/0ezFRZvz4 X-Received: by 2002:a5d:9694:: with SMTP id m20mr112466ion.185.1623852448005; Wed, 16 Jun 2021 07:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623852447; cv=none; d=google.com; s=arc-20160816; b=bNy21vQHgp/I+m/08FzPusFyANWra8cbrcDyiGhNXkehKiRPBWrUdkEwjhjLnYLQYP zRaZI+v4UQ9iftqQepWNmiOhHQO8LOubCV2wRojIkF2A74Vl1acJaeF1QX/tpydVF41Z g5k2/WANFFEcyrGH3RwudvxabvWGOUEm+AAOddquvNXhwWxAT4eFJb7vEV/B/8IbGqWt Am5Uc/JyBIIEfiV96G693vo4LRWSVgV93lHYgilTl6wXb4INYdSkmBiTmCOdBOCgZs2M Pr4hKoUw5ZxATWT5er4fp/Jf+bl8KXhrWJi1JIZGoeuU9dBi9BrMH18MMPKnZcbUYHJ8 ST2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=PuL9tjV6s1Xt+5b1MFOny8IHTm0gJMcKlhqB6yrxAN4=; b=jAyBtzd0rJQvPgr1t5kUg3qkawXGg9HWRpz5t/LJRUf63/jgFWRJ8pKr0yNqdu2loO 4Yco4qHkUbcaPMfmG/GUg7LYLTOnyKS07xSKBa1eMMccqcAiQ1fExQ3PP5h+erxYqzbH wh6653Vb5YPzJDJVmDxFFB9WXFvUX38sIJ456i0cbGAnr437GND7dscQ2NxmG874+Rfe LBsm3PYQlwcUh04MMZU5JDMV9QPVtuigkol9tbZN5dSKP6DXBGXUFAZv5jpvKa+kprlC zGX8ZWqY7bGp1QlbcsV+FW9ktv3o9xMdKgCCyacatnp7Byj5z1OvvmbULNTpV0Li61NR r2xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si2052946iox.103.2021.06.16.07.07.09; Wed, 16 Jun 2021 07:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233622AbhFPOIv (ORCPT + 99 others); Wed, 16 Jun 2021 10:08:51 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:60551 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233720AbhFPOIu (ORCPT ); Wed, 16 Jun 2021 10:08:50 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0Ucd3X5L_1623852401; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Ucd3X5L_1623852401) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Jun 2021 22:06:42 +0800 Date: Wed, 16 Jun 2021 22:06:41 +0800 From: Gao Xiang To: Trond Myklebust Cc: "linux-nfs@vger.kernel.org" , "joseph.qi@linux.alibaba.com" , "linux-kernel@vger.kernel.org" , "anna.schumaker@netapp.com" Subject: Re: [PATCH] nfs: set block size according to pnfs_blksize first Message-ID: References: <1623847469-150122-1-git-send-email-hsiangkao@linux.alibaba.com> <4898aa11dc26396c13bbc3d8bf18c13efe4d513a.camel@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4898aa11dc26396c13bbc3d8bf18c13efe4d513a.camel@hammerspace.com> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Jun 16, 2021 at 01:47:13PM +0000, Trond Myklebust wrote: > On Wed, 2021-06-16 at 20:44 +0800, Gao Xiang wrote: > > When testing fstests with ext4 over nfs 4.2, I found generic/486 > > failed. The root cause is that the length of its xattr value is > >   min(st_blksize * 3 / 4, XATTR_SIZE_MAX) > > > > which is 4096 * 3 / 4 = 3072 for underlayfs ext4 rather than > > XATTR_SIZE_MAX = 65536 for nfs since the block size would be wsize > > (=131072) if bsize is not specified. > > > > Let's use pnfs_blksize first instead of using wsize directly if > > bsize isn't specified. And the testcase itself can pass now. > > > > Cc: Trond Myklebust > > Cc: Anna Schumaker > > Cc: Joseph Qi > > Signed-off-by: Gao Xiang > > --- > > Considering bsize is not specified, we might use pnfs_blksize > > directly first rather than wsize. > > > >  fs/nfs/super.c | 8 ++++++-- > >  1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/fs/nfs/super.c b/fs/nfs/super.c > > index fe58525cfed4..5015edf0cd9a 100644 > > --- a/fs/nfs/super.c > > +++ b/fs/nfs/super.c > > @@ -1068,9 +1068,13 @@ static void nfs_fill_super(struct super_block > > *sb, struct nfs_fs_context *ctx) > >         snprintf(sb->s_id, sizeof(sb->s_id), > >                  "%u:%u", MAJOR(sb->s_dev), MINOR(sb->s_dev)); > >   > > -       if (sb->s_blocksize == 0) > > -               sb->s_blocksize = nfs_block_bits(server->wsize, > > +       if (sb->s_blocksize == 0) { > > +               unsigned int blksize = server->pnfs_blksize ? > > +                       server->pnfs_blksize : server->wsize; > > NACK. The pnfs block size is a layout driver-specific quantity, and > should not be used to substitute for the server-advertised block size. > It only applies to I/O _if_ the client is holding a layout for a > specific file and is using pNFS to do I/O to that file. Honestly, I'm not sure if it's ok as well. > > It has nothing to do with xattrs at all. Yet my question is how to deal with generic/486, should we just skip the case directly? I cannot find some proper way to get underlayfs block size or real xattr value limit. For now, generic/486 will return ENOSPC at fsetxattr(fd, "user.world", value, 65536, XATTR_REPLACE); when testing new nfs4.2 xattr support. Thanks, Gao Xiang > > > + > > +               sb->s_blocksize = nfs_block_bits(blksize, > >                                                  &sb- > > >s_blocksize_bits); > > +       } > >   > >         nfs_super_set_maxbytes(sb, server->maxfilesize); > >         server->has_sec_mnt_opts = ctx->has_sec_mnt_opts; > > -- > Trond Myklebust > Linux NFS client maintainer, Hammerspace > trond.myklebust@hammerspace.com > >