All of lore.kernel.org
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfsv4.0/setattr: Check behavior of setting a large file size
Date: Thu, 27 Jan 2022 17:06:29 -0500	[thread overview]
Message-ID: <20220127220629.GD3459@fieldses.org> (raw)
In-Reply-To: <164330361583.2340756.18437536986986631991.stgit@morisot.1015granger.net>

On Thu, Jan 27, 2022 at 12:19:24PM -0500, Chuck Lever wrote:
> 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 <chuck.lever@oracle.com>
> ---
>  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.

Looks fine by me; applied.

--b.

> 
> 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
>  
> 

      reply	other threads:[~2022-01-27 22:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 17:19 [PATCH] nfsv4.0/setattr: Check behavior of setting a large file size Chuck Lever
2022-01-27 22:06 ` J. Bruce Fields [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220127220629.GD3459@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.