Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp472784pxb; Fri, 28 Jan 2022 03:24:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoLmiPEpLyS4dBx1aChve0Xn9pOu+obB0pENVYW2Mfaj38mQLoagRa3DtSm1RltRyddI8t X-Received: by 2002:a17:906:e0cb:: with SMTP id gl11mr6483441ejb.135.1643369046996; Fri, 28 Jan 2022 03:24:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643369046; cv=none; d=google.com; s=arc-20160816; b=kOo6RBCcvlnh1046ic/Z/ZrXJ/1cQqljmUjLRGcwlBnBKdaPa4iwY0JILDKkBv1zSm CVubu02KQIodiRfIR71ztgqOoCKJycRrewuF7euc4AbRF57LyKFpauGn4155gyNLAD1V sb+ovC3mset1NN7UQgFhopZac0cSxr3mJ7hjpUTO4qgCukpT4gAgPlcAYKxY7Mddry35 JB1TnIq7ST7EUBJmad0zkeDvlBb7tYj7xmVV6X1ubY3nd/bz0DndPOz6wv4yrnUzdQFB dlkeDoWwy7xYU4xEtlz+D8TyJ+9kkodLBn0+043x3irasdEC+aAM7NCkR5NJkfJNInHv 1kqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:to:from:subject; bh=tt1oKnz1DM44Fgu85igR6vt8RFjZ8WVd/KXA9sC6Q1Y=; b=sFAGHTA45nLL6muuqeY4SbTLrc5j3JK4lVENuP061FTkoUpucQyJPV+l3zbGjuTV6g iB8VVakPzaSSPQi6GBwK4ivMGKPiqNmLC3ULlMKASKqFFpfgg7yFNJg3Jjj3qSbRvN0u tBmCsId3B0rZFSEv7wo+jIMPZuOkmYPIACl3ZSlwVjduRwyFt87qtNVe0QYTsHMqkL0G gMvBZcGTRjDe5YKzbT6n756vEuUQHbP53qyxaVVd+ryT3qRZYjy6R0G6128BL4dMzHzV UkWxV7Y58L9BHhQ8qMVhNbhYfHxUf3pc7BrYlEsRl1X2AIljqxCeLkXtPhgBOCHeEu76 wCVA== 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si3289503edd.385.2022.01.28.03.23.42; Fri, 28 Jan 2022 03:24:06 -0800 (PST) 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229483AbiA0RT1 (ORCPT + 99 others); Thu, 27 Jan 2022 12:19:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44050 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242179AbiA0RT1 (ORCPT ); Thu, 27 Jan 2022 12:19:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DCE9B81366 for ; Thu, 27 Jan 2022 17:19:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 294E1C340E4 for ; Thu, 27 Jan 2022 17:19:25 +0000 (UTC) Subject: [PATCH] nfsv4.0/setattr: Check behavior of setting a large file size From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Thu, 27 Jan 2022 12:19:24 -0500 Message-ID: <164330361583.2340756.18437536986986631991.stgit@morisot.1015granger.net> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Many POSIX systems internally use a signed file size. The NFS server has to correctly handle the conversion from a u64 size to the internal size value. Signed-off-by: Chuck Lever --- nfs4.0/servertests/st_setattr.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) Just something to consider... "It's my first ray gun" so I'm sure I got something wrong here. diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py index c3ecee3fbcfb..5d51054c29b4 100644 --- a/nfs4.0/servertests/st_setattr.py +++ b/nfs4.0/servertests/st_setattr.py @@ -562,6 +562,25 @@ def testUnsupportedSocket(t, env): check(res) _try_unsupported(t, env, path) +def testMaxSizeFile(t, env): + """SETATTR(U64_MAX) of a file should return NFS4_OK or NFS4ERR_FBIG + + FLAGS: setattr all + DEPEND: INIT + CODE: SATT12x + """ + maxsize = 0xffffffffffffffff + c = env.c1 + fh, stateid = c.create_confirm(t.word(), deny=OPEN4_SHARE_DENY_NONE) + dict = {FATTR4_SIZE: maxsize} + ops = c.use_obj(fh) + [c.setattr(dict, stateid)] + res = c.compound(ops) + check(res, [NFS4_OK, NFS4ERR_FBIG], "SETATTR(U64_MAX) of a file") + newsize = c.do_getattr(FATTR4_SIZE, fh) + if newsize != maxsize: + check(res, [NFS4ERR_INVAL, NFS4ERR_FBIG], + "File size is %i; SETATTR" % newsize) + def testSizeDir(t, env): """SETATTR(_SIZE) of a directory should return NFS4ERR_ISDIR or NFS4ERR_BAD_STATEID