Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp424925pxj; Wed, 16 Jun 2021 05:45:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw83KaPQ1SLVF3qhdsDxcj1qaK6jwUiDn6aOCJvy46Q57w3UgpRKoceWF4ebhYxD5JWWgf/ X-Received: by 2002:a5d:94d2:: with SMTP id y18mr1110864ior.51.1623847537244; Wed, 16 Jun 2021 05:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623847537; cv=none; d=google.com; s=arc-20160816; b=FEQNzY0jQxfMVjwCeXvw1wFXdta2vr62FR4b7wC7bVUYlH9GrDztKyBce3hd8ZJdvx Nm00wB0ICR510byzIytyq/iQq5nDw6yeKZYWyAzCRYVWz76i1GOBWf024ofxGWnCzU7N AiFQRbBDOQrjyGh5AS4zQoOk0vqyUhq/qUHUzs4bVG3HI6QnDC/rk+W882s0+KyIZSfR jGQyC/5guIoU163JCCTCZVB+Vr/RJ8BhJevXy9Iec0V7by3UU3Vkimwj5jfE5xb8WZwn OzEY5mDkikz/WhNN1MUT1wDYVLDqIKFOHwqUFpX0gj7FV2GqozwMYwmL6xgHDVQkkIvR gGyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=W6b/LU7TJdoYz1cGqFiN783JVmCabZekP6aA1vZ3AiA=; b=PprasrJ+HG9IQwasa1iKHbjLqNhaLpY6Inqc5Yn6AueO48FZrOEAjPTK9XaKcQZj1L klT1AotRMuVK2PsbAcpRyP8hGSNbzMeCzfIvk4SfNy9vePHvegzm5+/WaW5bBnpgaGQe mHeAMd+OQjKFSngVqsh0nH7KDbB3mBwB21GUesxWx7MqgXQ7AGhuIpV1dWwIX1zdkU+c p2tHk2VYY3/d/YE2I0P1kDA+utvQZmQeLbZfz5XS6Y0xjyDcUR4tZExA4q/i7rxCi86B g7oy1uy6mVg7fNs7GbPsbuj9gRM+zrTw5+TE+rAouJCEijRq8K1nsDJH8/FdNtem4cTj y2cA== 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 m25si2158846ioo.79.2021.06.16.05.44.58; Wed, 16 Jun 2021 05:45:37 -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 S232628AbhFPMqo (ORCPT + 99 others); Wed, 16 Jun 2021 08:46:44 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:37433 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232403AbhFPMqo (ORCPT ); Wed, 16 Jun 2021 08:46:44 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UccgjY3_1623847470; Received: from e18g09479.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UccgjY3_1623847470) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Jun 2021 20:44:36 +0800 From: Gao Xiang To: linux-nfs@vger.kernel.org Cc: LKML , Gao Xiang , Trond Myklebust , Anna Schumaker , Joseph Qi Subject: [PATCH] nfs: set block size according to pnfs_blksize first Date: Wed, 16 Jun 2021 20:44:29 +0800 Message-Id: <1623847469-150122-1-git-send-email-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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; + + 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; -- 1.8.3.1