15 May, 2013

1 commit

  • Implement labeled NFS on the server: encoding and decoding, and writing
    and reading, of file labels.

    Enabled with CONFIG_NFSD_V4_SECURITY_LABEL.

    Signed-off-by: Matthew N. Dodd
    Signed-off-by: Miguel Rodel Felipe
    Signed-off-by: Phua Eu Gene
    Signed-off-by: Khin Mi Mi Aung
    Signed-off-by: J. Bruce Fields

    David Quigley
     

08 Apr, 2013

1 commit

  • Closed stateid's are kept around a little while to handle close replays
    in the 4.0 case. So we stash them in the last-used stateid in the
    oo_last_closed_stateid field of the open owner. We can free that in
    encode_seqid_op_tail once the seqid on the open owner is next
    incremented. But we don't want to do that on the close itself; so we
    set NFS4_OO_PURGE_CLOSE flag set on the open owner, skip freeing it the
    first time through encode_seqid_op_tail, then when we see that flag set
    next time we free it.

    This is unnecessarily baroque.

    Instead, just move the logic that increments the seqid out of the xdr
    code and into the operation code itself.

    The justification given for the current placement is that we need to
    wait till the last minute to be sure we know whether the status is a
    sequence-id-mutating error or not, but examination of the code shows
    that can't actually happen.

    Reported-by: Yanchuan Nian
    Tested-by: Yanchuan Nian
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

03 Apr, 2013

2 commits


24 Jan, 2013

1 commit

  • It seems slightly simpler to make nfsd4_encode_fattr rather than its
    callers responsible for advancing the write pointer on success.

    (Also: the count == 0 check in the verify case looks superfluous.
    Running out of buffer space is really the only reason fattr encoding
    should fail with eresource.)

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

18 Dec, 2012

1 commit


26 Nov, 2012

2 commits

  • Our server rejects compounds containing more than one write operation.
    It's unclear whether this is really permitted by the spec; with 4.0,
    it's possibly OK, with 4.1 (which has clearer limits on compound
    parameters), it's probably not OK. No client that we're aware of has
    ever done this, but in theory it could be useful.

    The source of the limitation: we need an array of iovecs to pass to the
    write operation. In the worst case that array of iovecs could have
    hundreds of elements (the maximum rwsize divided by the page size), so
    it's too big to put on the stack, or in each compound op. So we instead
    keep a single such array in the compound argument.

    We fill in that array at the time we decode the xdr operation.

    But we decode every op in the compound before executing any of them. So
    once we've used that array we can't decode another write.

    If we instead delay filling in that array till the time we actually
    perform the write, we can reuse it.

    Another option might be to switch to decoding compound ops one at a
    time. I considered doing that, but it has a number of other side
    effects, and I'd rather fix just this one problem for now.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • In preparation for moving some of this elsewhere.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

15 Nov, 2012

1 commit


08 Nov, 2012

1 commit


01 Jun, 2012

1 commit


21 Mar, 2012

1 commit

  • Clean up due to code review.

    The nfs4_verifier's data field is not guaranteed to be u32-aligned.
    Casting an array of chars to a u32 * is considered generally
    hazardous.

    We can fix most of this by using a __be32 array to generate the
    verifier's contents and then byte-copying it into the verifier field.

    However, there is one spot where there is a backwards compatibility
    constraint: the do_nfsd_create() call expects a verifier which is
    32-bit aligned. Fix this spot by forcing the alignment of the create
    verifier in the nfsd4_open args structure.

    Also, sizeof(nfs4_verifer) is the size of the in-core verifier data
    structure, but NFS4_VERIFIER_SIZE is the number of octets in an XDR'd
    verifier. The two are not interchangeable, even if they happen to
    have the same value.

    Signed-off-by: Chuck Lever
    Signed-off-by: J. Bruce Fields

    Chuck Lever
     

18 Feb, 2012

3 commits


16 Feb, 2012

3 commits


15 Feb, 2012

1 commit

  • Combine two booleans into a single flag field, move the smaller fields
    to the end.

    (In practice this doesn't make the struct any smaller. But we'll be
    adding another flag here soon.)

    Remove some debugging code that doesn't look useful, while we're in the
    neighborhood.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

24 Oct, 2011

1 commit


18 Oct, 2011

4 commits

  • If we create the object and then return failure to the client, we're
    left with an unexpected file in the filesystem.

    I'm trying to eliminate such cases but not 100% sure I have so an
    assertion might be helpful for now.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • As with the nfs4_file, we'd prefer to find out about any failure before
    creating a new file rather than after.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Creating a new file is an irrevocable step--once it's visible in the
    filesystem, other processes may have seen it and done something with it,
    and unlinking it wouldn't simply undo the effects of the create.

    Therefore, in the case where OPEN creates a new file, we shouldn't do
    the create until we know that the rest of the OPEN processing will
    succeed.

    For example, we should preallocate a struct file in case we need it
    until waiting to allocate it till process_open2(), which is already too
    late.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • If process_open1() creates a new open owner, but the open later fails,
    the current code will leave the open owner around. It won't be on the
    close_lru list, and the client isn't expected to send a CLOSE, so it
    will hang around as long as the client does.

    Similarly, if process_open1() removes an existing open owner from the
    close lru, anticipating that an open owner that previously had no
    associated stateid's now will, but the open subsequently fails, then
    we'll again be left with the same leak.

    Fix both problems.

    Reported-by: Bryan Schumaker
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

12 Oct, 2011

1 commit


27 Sep, 2011

1 commit


16 Sep, 2011

1 commit

  • For checking the size of reply before calling a operation,
    we need try to get maxsize of the operation's reply.

    v3: using new method as Bruce said,

    "we could handle operations in two different ways:

    - For operations that actually change something (write, rename,
    open, close, ...), do it the way we're doing it now: be
    very careful to estimate the size of the response before even
    processing the operation.
    - For operations that don't change anything (read, getattr, ...)
    just go ahead and do the operation. If you realize after the
    fact that the response is too large, then return the error at
    that point.

    So we'd add another flag to op_flags: say, OP_MODIFIES_SOMETHING. And for
    operations with OP_MODIFIES_SOMETHING set, we'd do the first thing. For
    operations without it set, we'd do the second."

    Signed-off-by: Mi Jinlong
    [bfields@redhat.com: crash, don't attempt to handle, undefined op_rsize_bop]
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     

07 Sep, 2011

1 commit


01 Sep, 2011

3 commits


28 Aug, 2011

1 commit


18 Jul, 2011

2 commits


16 Jul, 2011

2 commits


12 Jan, 2011

2 commits


18 Dec, 2010

1 commit


09 Dec, 2010

1 commit

  • If vfs_getattr in fill_post_wcc returns an error, we don't
    set fh_post_change.
    For NFSv4, this can result in set_change_info triggering a BUG_ON.
    i.e. fh_post_saved being zero isn't really a bug.

    So:
    - instead of BUGging when fh_post_saved is zero, just clear ->atomic.
    - if vfs_getattr fails in fill_post_wcc, take a copy of i_ctime anyway.
    This will be used i seg_change_info, but not overly trusted.
    - While we are there, remove the pointless 'if' statements in set_change_info.
    There is no harm setting all the values.

    Signed-off-by: NeilBrown
    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    Neil Brown