08 Jan, 2012

1 commit

  • ...so that we can do the uid/gid mapping outside the asynchronous RPC
    context.
    This fixes a bug in the current NFSv4 atomic open code where the client
    isn't able to determine what the true uid/gid fields of the file are,
    (because the asynchronous nature of the OPEN call denies it the ability
    to do an upcall) and so fills them with default values, marking the
    inode as needing revalidation.
    Unfortunately, in some cases, the VFS will do some additional sanity
    checks on the file, and may override the server's decision to allow
    the open because it sees the wrong owner/group fields.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

05 Jan, 2012

1 commit

  • The NFSv4 bitmap size is unbounded: a server can return an arbitrary
    sized bitmap in an FATTR4_WORD0_ACL request. Replace using the
    nfs4_fattr_bitmap_maxsz as a guess to the maximum bitmask returned by a server
    with the inclusion of the bitmap (xdr length plus bitmasks) and the acl data
    xdr length to the (cached) acl page data.

    This is a general solution to commit e5012d1f "NFSv4.1: update
    nfs4_fattr_bitmap_maxsz" and fixes hitting a BUG_ON in xdr_shrink_bufhead
    when getting ACLs.

    Fix a bug in decode_getacl that returned -EINVAL on ACLs > page when getxattr
    was called with a NULL buffer, preventing ACL > PAGE_SIZE from being retrieved.

    Cc: stable@kernel.org
    Signed-off-by: Andy Adamson
    Signed-off-by: Trond Myklebust

    Andy Adamson
     

31 Oct, 2011

1 commit


01 Aug, 2011

4 commits

  • This gives layout driver a chance to cleanup structures they put in at
    encode_layoutcommit.

    Signed-off-by: Andy Adamson
    [fixup layout header pointer for layoutcommit]
    Signed-off-by: Benny Halevy
    Signed-off-by: Benny Halevy
    [rm inode and pnfs_layout_hdr args from cleanup_layoutcommit()]
    Signed-off-by: Jim Rees
    Signed-off-by: Trond Myklebust

    Andy Adamson
     
  • Block layout needs it to determine IO size.

    Signed-off-by: Fred Isaman
    Signed-off-by: Tao Guo
    Signed-off-by: Benny Halevy
    Signed-off-by: Benny Halevy
    Signed-off-by: Jim Rees
    Signed-off-by: Trond Myklebust

    Fred Isaman
     
  • The block driver uses GETDEVICELIST

    Signed-off-by: Andy Adamson
    [pass struct nfs_server * to getdevicelist]
    [get machince creds for getdevicelist]
    [fix getdevicelist decode sizing]
    Signed-off-by: Benny Halevy
    Signed-off-by: Benny Halevy
    Signed-off-by: Jim Rees
    Signed-off-by: Trond Myklebust

    Andy Adamson
     
  • Using NFS4_MAX_UINT64 will break current protocol.

    [Needed in v3.0]
    CC: Stable Tree
    Signed-off-by: Peng Tao
    Signed-off-by: Jim Rees
    Signed-off-by: Trond Myklebust

    Peng Tao
     

13 Jul, 2011

4 commits

  • FREE_STATEID is used to tell the server that we want to free a stateid
    that no longer has any locks associated with it. This allows the client
    to reclaim locks without encountering edge conditions documented in
    section 8.4.3 of RFC 5661.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: Trond Myklebust

    Bryan Schumaker
     
  • This patch adds in the xdr for doing a TEST_STATEID call with a single
    stateid. RFC 5661 allows multiple stateids to be tested in a single
    call, but only testing one keeps things simpler for now.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: Trond Myklebust

    Bryan Schumaker
     
  • If the client is using NFS v4.1, then we can use SECINFO_NO_NAME to find
    the secflavor for the initial mount. If the server doesn't support
    SECINFO_NO_NAME then I fall back on the "guess and check" method used
    for v4.0 mounts.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: Trond Myklebust

    Bryan Schumaker
     
  • can be skipped if the "eir_server_scope" from the exchange_id proc differs from
    previous calls.

    Also, in the future server_scope will be useful for determining whether client
    trunking is available

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     

12 Jul, 2011

1 commit


21 Jun, 2011

1 commit


17 Jun, 2011

1 commit

  • Commit 7ebb9315 (NFS: use secinfo when crossing mountpoints) introduces
    a regression when decoding an NFSv4 readdir entry that sets the
    rdattr_error field.
    By treating the resulting value as if it is a decoding error, the current
    code may cause us to skip valid readdir entries.

    Reported-by: Andy Adamson
    Cc: stable@kernel.org [2.6.39]
    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

15 Jun, 2011

1 commit


30 May, 2011

3 commits

  • Add a layout driver method to encode the layout type specific
    opaque part of layout commit in-line in the xdr stream.

    Currently, the pnfs-objects layout driver uses it to encode metadata hints
    to the MDS and the blocks layout driver to commit provisionally allocated
    extents to the file.

    Signed-off-by: Benny Halevy

    Benny Halevy
     
  • Add a layout driver method to encode the layout type specific
    opaque part of layout return in-line in the xdr stream.

    Currently the pnfs-objects layout driver uses it to encode i/o error
    information on LAYOUTRETURN.

    Signed-off-by: Andy Adamson
    [fixup layout header pointer for encode_layoutreturn]
    Signed-off-by: Benny Halevy

    Andy Adamson
     
  • NFSv4.1 LAYOUTRETURN implementation

    Currently, does not support layout-type payload encoding.

    Signed-off-by: Alexandros Batsakis
    Signed-off-by: Andy Adamson
    Signed-off-by: Andy Adamson
    Signed-off-by: Dean Hildebrand
    Signed-off-by: Fred Isaman
    Signed-off-by: Fred Isaman
    Signed-off-by: Marc Eshel
    Signed-off-by: Zhang Jingwang
    [call pnfs_return_layout right before pnfs_destroy_layout]
    [remove assert_spin_locked from pnfs_clear_lseg_list]
    [remove wait parameter from the layoutreturn path.]
    [remove return_type field from nfs4_layoutreturn_args]
    [remove range from nfs4_layoutreturn_args]
    [no need to send layoutcommit from _pnfs_return_layout]
    [don't wait on sync layoutreturn]
    [fix layout stateid in layoutreturn args]
    [fixed NULL deref in _pnfs_return_layout]
    [removed recaim member of nfs4_layoutreturn_args]
    Signed-off-by: Benny Halevy

    Benny Halevy
     

28 Apr, 2011

2 commits

  • When compiling, I was getting this warning:
    fs/nfs/nfs4xdr.c: In function ‘decode_secinfo’:
    fs/nfs/nfs4xdr.c:4839:6: warning: variable ‘status’ set but not used
    [-Wunused-but-set-variable]

    We were unconditionally returning 0 as long as there wasn't an error
    coming out of xdr_inline_decode(). We probably want to check the error
    status coming out of decode_op_hdr() and decode_secinfo_gss(), rather
    than assuming that everything is OK all the time.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: Trond Myklebust

    Bryan Schumaker
     
  • When readdir() returns a directory entry for the root of a mounted
    filesystem, Linux follows the old convention of returning the inode
    number of the covered directory (despite newer versions of POSIX declaring
    that this is a bug).
    To ensure this continues to work, the NFSv4 readdir implementation requests
    the 'mounted-on-fileid' from the server.

    However, readdirplus also needs to instantiate an inode for this entry, and
    for that, we also need to request the real fileid as per this patch.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

14 Apr, 2011

1 commit

  • While decoding a secinfo reply, I store the list of supported sec
    flavors on a page accessible through res->flavors. Before reading
    each new flavor, I do some math to determine if there is enough
    space left on this page, and I break out of my read look if there
    isn't. In order to perform this check correctly, I need to use the
    address of res->flavors, rather than the address of res.

    When this loop was broken early I lied to the caller and told them
    that the entire list had been decoded. This could lead to problems
    if the caller tries to use any the garbage data claiming to be a
    valid sec flavor. I fixed this by using res->flavors->num_flavors
    as a counter, incrementing it every time a sec flavor is
    successfully decoded.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: Trond Myklebust

    Bryan Schumaker
     

25 Mar, 2011

4 commits


24 Mar, 2011

2 commits

  • The filelayout driver sends LAYOUTCOMMIT only when COMMIT goes to
    the data server (as opposed to the MDS) and the data server WRITE
    is not NFS_FILE_SYNC.

    Only whole file layout support means that there is only one IOMODE_RW layout
    segment.

    Signed-off-by: Andy Adamson
    Signed-off-by: Alexandros Batsakis
    Signed-off-by: Boaz Harrosh
    Signed-off-by: Dean Hildebrand
    Signed-off-by: Fred Isaman
    Signed-off-by: Mingyang Guo
    Signed-off-by: Tao Guo
    Signed-off-by: Zhang Jingwang
    Tested-by: Boaz Harrosh
    Signed-off-by: Benny Halevy
    Signed-off-by: Fred Isaman
    Signed-off-by: Trond Myklebust

    Andy Adamson
     
  • Any COMMIT compound directed to a data server needs to have the
    GETATTR calls suppressed. We here, make sure the field we are testing
    (data->lseg) is set and refcounted correctly.

    Signed-off-by: Fred Isaman
    Signed-off-by: Trond Myklebust

    Fred Isaman
     

12 Mar, 2011

4 commits


11 Mar, 2011

1 commit


29 Jan, 2011

2 commits

  • On recent 2.6.38-rc kernels, connectathon basic test 6 fails on
    NFSv4 mounts of OpenSolaris with something like:

    > ./test6: readdir
    > ./test6: (/mnt/klimt/matisse.test) didn't read expected 'file.12' dir entry, pass 0
    > ./test6: (/mnt/klimt/matisse.test) didn't read expected 'file.82' dir entry, pass 0
    > ./test6: (/mnt/klimt/matisse.test) didn't read expected 'file.164' dir entry, pass 0
    > ./test6: (/mnt/klimt/matisse.test) Test failed with 3 errors
    > basic tests failed
    > Tests failed, leaving /mnt/klimt mounted
    > [cel@matisse cthon04]$

    I narrowed the problem down to nfs4_decode_dirent() reporting that the
    decode buffer had overflowed while decoding the entries for those
    missing files.

    verify_attr_len() assumes both it's pointer arguments reside on the
    same page. When these arguments point to locations on two different
    pages, verify_attr_len() can report false errors. This can happen now
    that a large NFSv4 readdir result can span pages.

    We have reasonably good checking in nfs4_decode_dirent() anyway, so
    it should be safe to simply remove the extra checking.

    At a guess, this was introduced by commit 6650239a, "NFS: Don't use
    vm_map_ram() in readdir".

    Cc: stable@kernel.org [2.6.37]
    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Make the decoding of NFSv4 directory entries slightly more efficient
    by:

    1. Avoiding unnecessary byte swapping when checking XDR booleans,
    and

    2. Not bumping "p" when its value will be immediately replaced by
    xdr_inline_decode()

    This commit makes nfs4_decode_dirent() consistent with similar logic
    in the other two decode_dirent() functions.

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     

11 Jan, 2011

2 commits

  • Conflicts:
    fs/nfs/nfs2xdr.c
    fs/nfs/nfs3xdr.c
    fs/nfs/nfs4xdr.c

    Trond Myklebust
     
  • vm_map_ram() is not available on NOMMU platforms, and causes trouble
    on incoherrent architectures such as ARM when we access the page data
    through both the direct and the virtual mapping.

    The alternative is to use the direct mapping to access page data
    for the case when we are not crossing a page boundary, but to copy
    the data into a linear scratch buffer when we are accessing data
    that spans page boundaries.

    Signed-off-by: Trond Myklebust
    Tested-by: Marc Kleine-Budde
    Cc: stable@kernel.org [2.6.37]

    Trond Myklebust
     

07 Jan, 2011

3 commits

  • In order to enable migration support, we will want to move some of the
    structures that are subject to migration into the struct nfs_server.
    In particular, if we are to move the state_owner and state_owner_id to
    being a per-filesystem structure, then we should label the resulting
    open/lock owners with a per-filesytem label to ensure global uniqueness.

    This patch does so by adding the super block s_dev to the open/lock owner
    name.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     
  • We shouldn't send a LAYOUTGET(openstateid) unless all outstanding RPCs
    using the previous stateid are completed. This requires choosing the
    stateid to encode earlier, so we can abort if one is not available (we
    want to use the open stateid, but a LAYOUTGET is already out using
    it), and adding a count of the number of outstanding rpc calls using
    layout state (which for now consist solely of LAYOUTGETs).

    Signed-off-by: Fred Isaman
    Signed-off-by: Trond Myklebust

    Fred Isaman
     
  • This prepares for future changes, where the layout state needs
    to change atomically with several other variables. In particular,
    it will need to know if lo->segs is empty, as we test that instead
    of manipulating the NFS_LAYOUT_STATEID_SET bit. Moreover, the
    layoutstateid is not really a read-mostly structure, as it is
    written almost as often as it is read.

    The behavior of pnfs_get_layout_stateid is also slightly changed, so that
    it no longer changes the stateid. Its name is changed to +pnfs_choose_layoutget_stateid.

    Signed-off-by: Fred Isaman
    Signed-off-by: Benny Halevy
    Signed-off-by: Trond Myklebust

    Fred Isaman
     

17 Dec, 2010

1 commit

  • Now that all client-side XDR decoder routines use xdr_streams, there
    should be no need to support the legacy calling sequence [rpc_rqst *,
    __be32 *, RPC res *] anywhere. We can construct an xdr_stream in the
    generic RPC code, instead of in each decoder function.

    This is a refactoring change. It should not cause different behavior.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever