15 Aug, 2013

1 commit

  • commit 786615bc1ce84150ded80daea6bd9f6297f48e73 upstream.

    If rpcbind causes our connection to the AF_LOCAL socket to close after
    we've registered a service, then we want to be careful about reconnecting
    since the mount namespace may have changed.

    By simply refusing to reconnect the AF_LOCAL socket in the case of
    unregister, we avoid the need to somehow save the mount namespace. While
    this may lead to some services not unregistering properly, it should
    be safe.

    Signed-off-by: Trond Myklebust
    Cc: Nix
    Cc: Jeff Layton
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     

10 May, 2013

1 commit

  • Pull more NFS client bugfixes from Trond Myklebust:

    - Ensure that we match the 'sec=' mount flavour against the server list

    - Fix the NFSv4 byte range locking in the presence of delegations

    - Ensure that we conform to the NFSv4.1 spec w.r.t. freeing lock
    stateids

    - Fix a pNFS data server connection race

    * tag 'nfs-for-3.10-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
    NFS4.1 Fix data server connection race
    NFSv3: match sec= flavor against server list
    NFSv4.1: Ensure that we free the lock stateid on the server
    NFSv4: Convert nfs41_free_stateid to use an asynchronous RPC call
    SUNRPC: Don't spam syslog with "Pseudoflavor not found" messages
    NFSv4.x: Fix handling of partially delegated locks

    Linus Torvalds
     

04 May, 2013

1 commit


30 Apr, 2013

1 commit


26 Apr, 2013

2 commits

  • This patch implements a sunrpc client to use the services of the gssproxy
    userspace daemon.

    In particular it allows to perform calls in user space using an RPC
    call instead of custom hand-coded upcall/downcall messages.

    Currently only accept_sec_context is implemented as that is all is needed for
    the server case.

    File server modules like NFS and CIFS can use full gssapi services this way,
    once init_sec_context is also implemented.

    For the NFS server case this code allow to lift the limit of max 2k krb5
    tickets. This limit is prevents legitimate kerberos deployments from using krb5
    authentication with the Linux NFS server as they have normally ticket that are
    many kilobytes large.

    It will also allow to lift the limitation on the size of the credential set
    (uid,gid,gids) passed down from user space for users that have very many groups
    associated. Currently the downcall mechanism used by rpc.svcgssd is limited
    to around 2k secondary groups of the 65k allowed by kernel structures.

    Signed-off-by: Simo Sorce
    [bfields: containerization, concurrent upcalls, misc. fixes and cleanup]
    Signed-off-by: J. Bruce Fields

    Simo Sorce
     
  • In the gss-proxy case we don't want to have to reconnect at random--we
    want to connect only on gss-proxy startup when we can steal gss-proxy's
    context to do the connect in the right namespace.

    So, provide a flag that allows the rpc_create caller to turn off the
    idle timeout.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

24 Apr, 2013

1 commit


15 Apr, 2013

2 commits


06 Apr, 2013

2 commits

  • If the call to rpciod_up() fails, we currently leak a reference to the
    struct rpc_xprt.
    As part of the fix, we also remove the redundant check for xprt!=NULL.
    This is already taken care of by the callers.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     
  • While testing error cases where rpc_new_client() fails, I saw
    some oopses.

    If rpc_new_client() fails, it already invokes xprt_put(). Thus
    __rpc_clone_client() does not need to invoke it again.

    Introduced by commit 1b63a751 "SUNRPC: Refactor rpc_clone_client()"
    Fri Sep 14, 2012.

    Signed-off-by: Chuck Lever
    Cc: stable@vger.kernel.org [>=3.7]
    Signed-off-by: Trond Myklebust

    Chuck Lever
     

26 Mar, 2013

1 commit


03 Mar, 2013

2 commits

  • Pull NFS client bugfixes from Trond Myklebust:
    "We've just concluded another Connectathon interoperability testing
    week, and so here are the fixes for the bugs that were discovered:

    - Don't allow NFS silly-renamed files to be deleted
    - Don't start the retransmission timer when out of socket space
    - Fix a couple of pnfs-related Oopses.
    - Fix one more NFSv4 state recovery deadlock
    - Don't loop forever when LAYOUTGET returns NFS4ERR_LAYOUTTRYLATER"

    * tag 'nfs-for-3.9-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
    SUNRPC: One line comment fix
    NFSv4.1: LAYOUTGET EDELAY loops timeout to the MDS
    SUNRPC: add call to get configured timeout
    PNFS: set the default DS timeout to 60 seconds
    NFSv4: Fix another open/open_recovery deadlock
    nfs: don't allow nfs_find_actor to match inodes of the wrong type
    NFSv4.1: Hold reference to layout hdr in layoutget
    pnfs: fix resend_to_mds for directio
    SUNRPC: Don't start the retransmission timer when out of socket space
    NFS: Don't allow NFS silly-renamed files to be deleted, no signal

    Linus Torvalds
     
  • Reported-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

01 Mar, 2013

2 commits

  • Pull nfsd changes from J Bruce Fields:
    "Miscellaneous bugfixes, plus:

    - An overhaul of the DRC cache by Jeff Layton. The main effect is
    just to make it larger. This decreases the chances of intermittent
    errors especially in the UDP case. But we'll need to watch for any
    reports of performance regressions.

    - Containerized nfsd: with some limitations, we now support
    per-container nfs-service, thanks to extensive work from Stanislav
    Kinsbursky over the last year."

    Some notes about conflicts, since there were *two* non-data semantic
    conflicts here:

    - idr_remove_all() had been added by a memory leak fix, but has since
    become deprecated since idr_destroy() does it for us now.

    - xs_local_connect() had been added by this branch to make AF_LOCAL
    connections be synchronous, but in the meantime Trond had changed the
    calling convention in order to avoid a RCU dereference.

    There were a couple of more obvious actual source-level conflicts due to
    the hlist traversal changes and one just due to code changes next to
    each other, but those were trivial.

    * 'for-3.9' of git://linux-nfs.org/~bfields/linux: (49 commits)
    SUNRPC: make AF_LOCAL connect synchronous
    nfsd: fix compiler warning about ambiguous types in nfsd_cache_csum
    svcrpc: fix rpc server shutdown races
    svcrpc: make svc_age_temp_xprts enqueue under sv_lock
    lockd: nlmclnt_reclaim(): avoid stack overflow
    nfsd: enable NFSv4 state in containers
    nfsd: disable usermode helper client tracker in container
    nfsd: use proper net while reading "exports" file
    nfsd: containerize NFSd filesystem
    nfsd: fix comments on nfsd_cache_lookup
    SUNRPC: move cache_detail->cache_request callback call to cache_read()
    SUNRPC: remove "cache_request" argument in sunrpc_cache_pipe_upcall() function
    SUNRPC: rework cache upcall logic
    SUNRPC: introduce cache_detail->cache_request callback
    NFS: simplify and clean cache library
    NFS: use SUNRPC cache creation and destruction helper for DNS cache
    nfsd4: free_stid can be static
    nfsd: keep a checksum of the first 256 bytes of request
    sunrpc: trim off trailing checksum before returning decrypted or integrity authenticated buffer
    sunrpc: fix comment in struct xdr_buf definition
    ...

    Linus Torvalds
     
  • Returns the configured timeout for the xprt of the rpc client.

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

    Weston Andros Adamson
     

05 Feb, 2013

1 commit


01 Feb, 2013

2 commits


11 Jan, 2013

1 commit

  • Fix new kernel-doc warnings in clnt.c:

    Warning(net/sunrpc/clnt.c:561): No description found for parameter 'flavor'
    Warning(net/sunrpc/clnt.c:561): Excess function parameter 'auth' description in 'rpc_clone_client_set_auth'

    Signed-off-by: Randy Dunlap
    Cc: Trond Myklebust
    Cc: "J. Bruce Fields"
    Cc: linux-nfs@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

05 Jan, 2013

1 commit


18 Dec, 2012

1 commit

  • There are SUNRPC clients, which program doesn't have pipe_dir_name. These
    clients can be skipped on PipeFS events, because nothing have to be created or
    destroyed. But instead of breaking in case of such a client was found, search
    for suitable client over clients list have to be continued. Otherwise some
    clients could not be covered by PipeFS event handler.

    Signed-off-by: Stanislav Kinsbursky
    Cc: stable@vger.kernel.org [>= v3.4]
    Signed-off-by: Trond Myklebust

    Stanislav Kinsbursky
     

13 Dec, 2012

1 commit

  • Currently, when an RPCSEC_GSS context has expired or is non-existent
    and the users (Kerberos) credentials have also expired or are non-existent,
    the client receives the -EKEYEXPIRED error and tries to refresh the context
    forever. If an application is performing I/O, or other work against the share,
    the application hangs, and the user is not prompted to refresh/establish their
    credentials. This can result in a denial of service for other users.

    Users are expected to manage their Kerberos credential lifetimes to mitigate
    this issue.

    Move the -EKEYEXPIRED handling into the RPC layer. Try tk_cred_retry number
    of times to refresh the gss_context, and then return -EACCES to the application.

    Signed-off-by: Andy Adamson
    Signed-off-by: Trond Myklebust

    Andy Adamson
     

05 Nov, 2012

8 commits


02 Oct, 2012

2 commits

  • An ULP is supposed to be able to replace a GSS rpc_auth object with
    another GSS rpc_auth object using rpcauth_create(). However,
    rpcauth_create() in 3.5 reliably fails with -EEXIST in this case.
    This is because when gss_create() attempts to create the upcall pipes,
    sometimes they are already there. For example if a pipe FS mount
    event occurs, or a previous GSS flavor was in use for this rpc_clnt.

    It turns out that's not the only problem here. While working on a
    fix for the above problem, we noticed that replacing an rpc_clnt's
    rpc_auth is not safe, since dereferencing the cl_auth field is not
    protected in any way.

    So we're deprecating the ability of rpcauth_create() to switch an
    rpc_clnt's security flavor during normal operation. Instead, let's
    add a fresh API that clones an rpc_clnt and gives the clone a new
    flavor before it's used.

    This makes immediate use of the new __rpc_clone_client() helper.

    This can be used in a similar fashion to rpcauth_create() when a
    client is hunting for the correct security flavor. Instead of
    replacing an rpc_clnt's security flavor in a loop, the ULP replaces
    the whole rpc_clnt.

    To fix the -EEXIST problem, any ULP logic that relies on replacing
    an rpc_clnt's rpc_auth with rpcauth_create() must be changed to use
    this API instead.

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

    Chuck Lever
     
  • rpc_clone_client() does most of the same tasks as rpc_new_client(),
    so there is an opportunity for code re-use. Create a generic helper
    that makes it easy to clone an RPC client while replacing any of the
    clnt's parameters.

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

    Chuck Lever
     

01 Aug, 2012

1 commit

  • Implement the new swapfile a_ops for NFS and hook up ->direct_IO. This
    will set the NFS socket to SOCK_MEMALLOC and run socket reconnect under
    PF_MEMALLOC as well as reset SOCK_MEMALLOC before engaging the protocol
    ->connect() method.

    PF_MEMALLOC should allow the allocation of struct socket and related
    objects and the early (re)setting of SOCK_MEMALLOC should allow us to
    receive the packets required for the TCP connection buildup.

    [jlayton@redhat.com: Restore PF_MEMALLOC task flags in all cases]
    [dfeng@redhat.com: Fix handling of multiple swap files]
    [a.p.zijlstra@chello.nl: Original patch]
    Signed-off-by: Mel Gorman
    Acked-by: Rik van Riel
    Cc: Christoph Hellwig
    Cc: David S. Miller
    Cc: Eric B Munson
    Cc: Eric Paris
    Cc: James Morris
    Cc: Mel Gorman
    Cc: Mike Christie
    Cc: Neil Brown
    Cc: Sebastian Andrzej Siewior
    Cc: Trond Myklebust
    Cc: Xiaotian Feng
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     

31 Jul, 2012

2 commits

  • Pull NFS client updates from Trond Myklebust:
    "Features include:
    - More preparatory patches for modularising NFSv2/v3/v4. Split out
    the various NFSv2/v3/v4-specific code into separate files
    - More preparation for the NFSv4 migration code
    - Ensure that OPEN(O_CREATE) observes the pNFS mds threshold
    parameters
    - pNFS fast failover when the data servers are down
    - Various cleanups and debugging patches"

    * tag 'nfs-for-3.6-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (67 commits)
    nfs: fix fl_type tests in NFSv4 code
    NFS: fix pnfs regression with directio writes
    NFS: fix pnfs regression with directio reads
    sunrpc: clnt: Add missing braces
    nfs: fix stub return type warnings
    NFS: exit_nfs_v4() shouldn't be an __exit function
    SUNRPC: Add a missing spin_unlock to gss_mech_list_pseudoflavors
    NFS: Split out NFS v4 client functions
    NFS: Split out the NFS v4 filesystem types
    NFS: Create a single nfs_clone_super() function
    NFS: Split out NFS v4 server creating code
    NFS: Initialize the NFS v4 client from init_nfs_v4()
    NFS: Move the v4 getroot code to nfs4getroot.c
    NFS: Split out NFS v4 file operations
    NFS: Initialize v4 sysctls from nfs_init_v4()
    NFS: Create an init_nfs_v4() function
    NFS: Split out NFS v4 inode operations
    NFS: Split out NFS v3 inode operations
    NFS: Split out NFS v2 inode operations
    NFS: Clean up nfs4_proc_setclientid() and friends
    ...

    Linus Torvalds
     
  • Add a missing set of braces that commit 4e0038b6b24
    ("SUNRPC: Move clnt->cl_server into struct rpc_xprt")
    forgot.

    Signed-off-by: Joe Perches
    Signed-off-by: Trond Myklebust
    Cc: stable@vger.kernel.org [>= 3.4]

    Joe Perches
     

11 Jul, 2012

1 commit


30 May, 2012

1 commit

  • Pull NFS client updates from Trond Myklebust:
    "New features include:
    - Rewrite the O_DIRECT code so that it can share the same coalescing
    and pNFS functionality as the page cache code.
    - Allow the server to provide hints as to when we should use pNFS,
    and when it is more efficient to read and write through the
    metadata server.
    - NFS cache consistency updates:
    * Use the ctime to emulate a change attribute for NFSv2/v3 so that
    all NFS versions can share the same cache management code.
    * New cache management code will only look at the change attribute
    and size attribute when deciding whether or not our cached data
    is still valid or not.
    * Don't request NFSv4 post-op attributes on writes in cases such as
    O_DIRECT, where we don't care about data cache consistency, or
    when we have a write delegation, and know that our cache is still
    consistent.
    * Don't request NFSv4 post-op attributes on operations such as
    COMMIT, where there are no expected metadata updates.
    * Don't request NFSv4 directory post-op attributes in cases where
    the operations themselves already return change attribute
    updates: i.e. operations such as OPEN, CREATE, REMOVE, LINK and
    RENAME.
    - Speed up 'ls' and friends by using READDIR rather than READDIRPLUS
    if we detect no attempts to lookup filenames.
    - Improve the code sharing between NFSv2/v3 and v4 mounts
    - NFSv4.1 state management efficiency improvements
    - More patches in preparation for NFSv4/v4.1 migration functionality."

    Fix trivial conflict in fs/nfs/nfs4proc.c that was due to the dcache
    qstr name initialization changes (that made the length/hash a 64-bit
    union)

    * tag 'nfs-for-3.5-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (146 commits)
    NFSv4: Add debugging printks to state manager
    NFSv4: Map NFS4ERR_SHARE_DENIED into an EACCES error instead of EIO
    NFSv4: update_changeattr does not need to set NFS_INO_REVAL_PAGECACHE
    NFSv4.1: nfs4_reset_session should use nfs4_handle_reclaim_lease_error
    NFSv4.1: Handle other occurrences of NFS4ERR_CONN_NOT_BOUND_TO_SESSION
    NFSv4.1: Handle NFS4ERR_CONN_NOT_BOUND_TO_SESSION in the state manager
    NFSv4.1: Handle errors in nfs4_bind_conn_to_session
    NFSv4.1: nfs4_bind_conn_to_session should drain the session
    NFSv4.1: Don't clobber the seqid if exchange_id returns a confirmed clientid
    NFSv4.1: Add DESTROY_CLIENTID
    NFSv4.1: Ensure we use the correct credentials for bind_conn_to_session
    NFSv4.1: Ensure we use the correct credentials for session create/destroy
    NFSv4.1: Move NFSPROC4_CLNT_BIND_CONN_TO_SESSION to the end of the operations
    NFSv4.1: Handle NFS4ERR_SEQ_MISORDERED when confirming the lease
    NFSv4: When purging the lease, we must clear NFS4CLNT_LEASE_CONFIRM
    NFSv4: Clean up the error handling for nfs4_reclaim_lease
    NFSv4.1: Exchange ID must use GFP_NOFS allocation mode
    nfs41: Use BIND_CONN_TO_SESSION for CB_PATH_DOWN*
    nfs4.1: add BIND_CONN_TO_SESSION operation
    NFSv4.1 test the mdsthreshold hint parameters
    ...

    Linus Torvalds
     

20 May, 2012

1 commit

  • xprt_alloc_slot will call rpc_delay() to make the task wait a bit before
    retrying when it gets back an -ENOMEM error from xprt_dynamic_alloc_slot.
    The problem is that rpc_delay will clear the task->tk_status, causing
    call_reserveresult to abort the task.

    The solution is simply to let call_reserveresult handle the ENOMEM error
    directly.

    Reported-by: Jeff Layton
    Cc: stable@vger.kernel.org [>= 3.1]
    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

11 May, 2012

1 commit

  • This allows comparing hash and len in one operation on 64-bit
    architectures. Right now only __d_lookup_rcu() takes advantage of this,
    since that is the case we care most about.

    The use of anonymous struct/unions hides the alternate 64-bit approach
    from most users, the exception being a few cases where we initialize a
    'struct qstr' with a static initializer. This makes the problematic
    cases use a new QSTR_INIT() helper function for that (but initializing
    just the name pointer with a "{ .name = xyzzy }" initializer remains
    valid, as does just copying another qstr structure).

    Signed-off-by: Linus Torvalds

    Linus Torvalds