15 Aug, 2010

1 commit


03 May, 2010

1 commit


23 Apr, 2010

1 commit


16 Dec, 2009

3 commits

  • Most of this can be trivially moved to a private header as well.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • With the v4root option now enforced everywhere it should be, it is safe
    to advertise support for it to mountd.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • NFSv4 differs from v2 and v3 in that it presents a single unified
    filesystem tree, whereas v2 and v3 exported multiple filesystem (whose
    roots could be found using a separate mount protocol).

    Our original NFSv4 server implementation asked the administrator to
    designate a single filesystem as the NFSv4 root, then to mount
    filesystems they wished to export underneath. (Often using bind mounts
    of already-existing filesystems.)

    This was conceptually simple, and allowed easy implementation, but
    created a serious obstacle to upgrading between v2/v3: since the paths
    to v4 filesystems were different, administrators would have to adjust
    all the paths in client-side mount commands when switching to v4.

    Various workarounds are possible. For example, the administrator could
    export "/" and designate it as the v4 root. However, the security risks
    of that approach are obvious, and in any case we shouldn't be requiring
    the administrator to take extra steps to fix this problem; instead, the
    server should present consistent paths across different versions by
    default.

    These patches take a modified version of that approach: we provide a new
    export option which exports only a subset of a filesystem. With this
    flag, it becomes safe for mountd to export "/" by default, with no need
    for additional configuration.

    We begin just by defining the new flag.

    Signed-off-by: Steve Dickson
    Signed-off-by: J. Bruce Fields

    Steve Dickson
     

15 Dec, 2009

5 commits

  • This was an oversight; it should be among the export flags that can be
    allowed to vary by pseudoflavor. This allows an administrator to (for
    example) allow auth_sys mounts only from low ports, but allow auth_krb5
    mounts to use any port.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Soon we will add the new V4ROOT flag, and allow the INSECURE flag to
    vary by pseudoflavor. It would be useful for nfs-utils (for example,
    for improved exportfs error reporting) to be able to know when this
    happens. Use this new interface for that purpose.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Lots of include/linux/nfsd/* headers are only used by
    nfsd module. Move them to the source directory

    Signed-off-by: Boaz Harrosh
    Signed-off-by: J. Bruce Fields

    Boaz Harrosh
     
  • * Add includes that are directly used by headers
    * Remove includes that are not needed

    These are the changes made:

    [xdr.h]
    struct nfsd_readdirres has an embedded struct readdir_cd from nfsd.h
    fixing that we can drop other includes

    [xdr4.h]
    embedded types defined both at state.h and nfsd.h

    [syscall.h]
    After export.h fix none of these stuff is needed.
    fix extra space in # include <> statement

    [stats.h]
    does not need but was export to user-mode
    so I don't touch it

    [state.h]
    embedded types from nfsfh.h like struct knfsd_fh. bringing that
    eliminates the need for all other includes

    [nfsfh.h]
    directly manipulating types from sunrpc/svc.h.
    Removed Other unused headers.

    [nfsd.h]
    removed unused headers include

    [export.h]
    lots of sunrpc/svc.h types and a single prototype declaration
    with pointer from nfsfh.h, but all users of export.h do need
    nfsfh.h any way. remove now un-needed include.

    [const.h]
    Unfixed (not independent)

    [cache.h]
    could do with a forward declaration of "struct svc_rqst;"
    from sunrpc/svc.h but all users absolutely will need
    sunrpc/svc.h it is easier overall this way.

    Signed-off-by: Boaz Harrosh
    Signed-off-by: J. Bruce Fields

    Boaz Harrosh
     
  • This doesn't appear to be useful.

    Signed-off-by: Boaz Harrosh
    Signed-off-by: J. Bruce Fields

    Boaz Harrosh
     

14 Nov, 2009

1 commit


06 Nov, 2009

1 commit


23 Sep, 2009

1 commit

  • Make all seq_operations structs const, to help mitigate against
    revectoring user-triggerable function pointers.

    This is derived from the grsecurity patch, although generated from scratch
    because it's simpler than extracting the changes from there.

    Signed-off-by: James Morris
    Acked-by: Serge Hallyn
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    James Morris
     

17 Sep, 2009

1 commit

  • Today's linux-next build (sparc64_defconfig) failed like this:

    In file included from arch/sparc/kernel/sys_sparc32.c:32:
    include/linux/nfsd/nfsd.h: In function 'nfs4_state_start':
    include/linux/nfsd/nfsd.h:177: error: no return statement in function returning non-void

    Caused by commit 29ab23cc5d351658d01a4327d55e9106a73fd04f ("nfsd4: allow
    nfs4 state startup to fail"). Please, if you add code that depends on a
    CONFIG option, build with that option enabled and disabled.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: J. Bruce Fields

    Stephen Rothwell
     

16 Sep, 2009

6 commits

  • Follows the model used by the NFS client. Setup the RPC prepare and done
    function pointers so that we can populate the sequence information if
    minorversion == 1. rpc_run_task() is then invoked directly just like
    existing NFS client operations do.

    nfsd4_cb_prepare() determines if the sequence information needs to be setup.
    If the slot is in use, it adds itself to the wait queue.

    nfsd4_cb_done() wakes anyone sleeping on the callback channel wait queue
    after our RPC reply has been received. It also sets the task message
    result pointer to NULL to clearly indicate we're done using it.

    Signed-off-by: Ricardo Labiaga
    [define and initialize cl_cb_seq_nr here]
    [pulled out unused defintion of nfsd4_cb_done]
    Signed-off-by: Benny Halevy
    Signed-off-by: J. Bruce Fields

    Ricardo Labiaga
     
  • RPC callback requests will wait on this wait queue if the backchannel
    is out of slots.

    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy
    Signed-off-by: J. Bruce Fields

    Ricardo Labiaga
     
  • Follow the model we use in the client. Make the sequence arguments
    part of the regular RPC arguments. None of the callbacks that are
    soon to be implemented expect results that need to be passed back
    to the caller, so we don't define a separate RPC results structure.
    For session validation, the cb_sequence decoding will use a pointer
    to the sequence arguments that are part of the RPC argument.

    Signed-off-by: Ricardo Labiaga
    [define struct nfsd4_cb_sequence here]
    Signed-off-by: Benny Halevy
    Signed-off-by: J. Bruce Fields

    Ricardo Labiaga
     
  • Keep the xprt used for create_session in cl_cb_xprt.
    Mark cl_callback.cb_minorversion = 1 and remember
    the client provided cl_callback.cb_prog rpc program number.
    Use it to probe the callback path.

    Use the client's network address to initialize as the
    callback's address as expected by the xprt creation
    routines.

    Define xdr sizes and code nfs4_cb_compound header to be able
    to send a null callback rpc.

    Signed-off-by: Andy Adamson
    Signed-off-by: Benny Halevy
    Signed-off-by: Ricardo Labiaga
    [get callback minorversion from fore channel's]
    Signed-off-by: Benny Halevy
    [nfsd41: change bc_sock to bc_xprt]
    Signed-off-by: Benny Halevy
    [pulled definition for cl_cb_xprt]
    Signed-off-by: Benny Halevy
    [nfsd41: set up backchannel's cb_addr]
    [moved rpc_create_args init to "nfsd: modify nfsd4.1 backchannel to use new xprt class"]
    Signed-off-by: Benny Halevy
    Signed-off-by: J. Bruce Fields

    Andy Adamson
     
  • Callbacks are always made using the machine's identity, so we can use a
    single auth_generic credential shared among callbacks to all clients and
    let the rpc code take care of the rest.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • The failure here is pretty unlikely, but we should handle it anyway.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

02 Sep, 2009

2 commits

  • Use NFSD_SLOT_CACHE_SIZE size buffers for sessions DRC instead of holding nfsd
    pages in cache.

    Connectathon testing has shown that 1024 bytes for encoded compound operation
    responses past the sequence operation is sufficient, 512 bytes is a little too
    small. Set NFSD_SLOT_CACHE_SIZE to 1024.

    Allocate memory for the session DRC in the CREATE_SESSION operation
    to guarantee that the memory resource is available for caching responses.
    Allocate each slot individually in preparation for slot table size negotiation.

    Remove struct nfsd4_cache_entry and helper functions for the old page-based
    DRC.

    The iov_len calculation in nfs4svc_encode_compoundres is now always
    correct. Replay is now done in nfsd4_sequence under the state lock, so
    the session ref count is only bumped on non-replay. Clean up the
    nfs4svc_encode_compoundres session logic.

    The nfsd4_compound_state statp pointer is also not used.
    Remove nfsd4_set_statp().

    Move useful nfsd4_cache_entry fields into nfsd4_slot.

    Signed-off-by: Andy Adamson

    Andy Adamson
     
  • By using the requested ca_maxresponsesize_cached * ca_maxresponses to bound
    a forechannel drc request size, clients can tailor a session to usage.

    For example, an I/O session (READ/WRITE only) can have a much smaller
    ca_maxresponsesize_cached (for only WRITE compound responses) and a lot larger
    ca_maxresponses to service a large in-flight data window.

    Signed-off-by: Andy Adamson
    Signed-off-by: J. Bruce Fields

    Andy Adamson
     

29 Aug, 2009

1 commit

  • Compounds consisting of only a sequence operation don't need any
    additional caching beyond the sequence information we store in the slot
    entry. Fix nfsd4_is_solo_sequence to identify this case correctly.

    The additional check for a failed sequence in nfsd4_store_cache_entry()
    is redundant, since the nfsd4_is_solo_sequence call lower down catches
    this case.

    The final ce_cachethis set in nfsd4_sequence is also redundant.

    Signed-off-by: Andy Adamson
    Signed-off-by: J. Bruce Fields

    Andy Adamson
     

21 Aug, 2009

2 commits


29 Jul, 2009

2 commits

  • Instead of trying to share the generic 4.1 reply cache code for the
    CREATE_SESSION reply cache, it's simpler to handle CREATE_SESSION
    separately.

    The nfs41 single slot clientid DRC holds the results of create session
    processing. CREATE_SESSION can be preceeded by a SEQUENCE operation
    (an embedded CREATE_SESSION) and the create session single slot cache must be
    maintained. nfsd4_replay_cache_entry() and nfsd4_store_cache_entry() do not
    implement the replay of an embedded CREATE_SESSION.

    The clientid DRC slot does not need the inuse, cachethis or other fields that
    the multiple slot session cache uses. Replace the clientid DRC cache struct
    nfs4_slot cache with a new nfsd4_clid_slot cache. Save the xdr struct
    nfsd4_create_session into the cache at the end of processing, and on a replay,
    replace the struct for the replay request with the cached version all while
    under the state lock.

    nfsd4_proc_compound will handle both the solo and embedded CREATE_SESSION case
    via the normal use of encode_operation.

    Errors that do not change the create session cache:
    A create session NFS4ERR_STALE_CLIENTID error means that a client record
    (and associated create session slot) could not be found and therefore can't
    be changed. NFSERR_SEQ_MISORDERED errors do not change the slot cache.

    All other errors get cached.

    Remove the clientid DRC specific check in nfs4svc_encode_compoundres to
    put the session only if cstate.session is set which will now always be true.

    Signed-off-by: Andy Adamson
    Signed-off-by: J. Bruce Fields

    Andy Adamson
     
  • NFSD_SLOT_CACHE_SIZE is the size of all encoded operation responses
    (excluding the sequence operation) that we want to cache.

    For now, keep NFSD_SLOT_CACHE_SIZE at PAGE_SIZE. It will be reduced
    when the DRC is changed from page based to memory based.

    Signed-off-by: Andy Adamson
    Signed-off-by: J. Bruce Fields

    Andy Adamson
     

15 Jul, 2009

1 commit

  • The version 4.1 DRC memory limit and tracking variables are server wide and
    session specific. Replace struct svc_serv fields with globals.
    Stop using the svc_serv sv_lock.

    Add a spinlock to serialize access to the DRC limit management variables which
    change on session creation and deletion (usage counter) or (future)
    administrative action to adjust the total DRC memory limit.

    Signed-off-by: Andy Adamson
    Signed-off-by: Benny Halevy

    Andy Adamson
     

23 Jun, 2009

1 commit

  • * 'for-2.6.31' of git://fieldses.org/git/linux-nfsd: (60 commits)
    SUNRPC: Fix the TCP server's send buffer accounting
    nfsd41: Backchannel: minorversion support for the back channel
    nfsd41: Backchannel: cleanup nfs4.0 callback encode routines
    nfsd41: Remove ip address collision detection case
    nfsd: optimise the starting of zero threads when none are running.
    nfsd: don't take nfsd_mutex twice when setting number of threads.
    nfsd41: sanity check client drc maxreqs
    nfsd41: move channel attributes from nfsd4_session to a nfsd4_channel_attr struct
    NFS: kill off complicated macro 'PROC'
    sunrpc: potential memory leak in function rdma_read_xdr
    nfsd: minor nfsd_vfs_write cleanup
    nfsd: Pull write-gathering code out of nfsd_vfs_write
    nfsd: track last inode only in use_wgather case
    sunrpc: align cache_clean work's timer
    nfsd: Use write gathering only with NFSv2
    NFSv4: kill off complicated macro 'PROC'
    NFSv4: do exact check about attribute specified
    knfsd: remove unreported filehandle stats counters
    knfsd: fix reply cache memory corruption
    knfsd: reply cache cleanups
    ...

    Linus Torvalds
     

19 Jun, 2009

1 commit


18 Jun, 2009

2 commits

  • Trond Myklebust
     
  • Implement the exchange_id operation conforming to
    http://tools.ietf.org/html/draft-ietf-nfsv4-minorversion1-26

    Unlike NFSv4.0, NFSv4.1 requires machine credentials. RPC_AUTH_GSS machine
    credentials will be passed into the kernel at mount time to be available for
    the exchange_id operation.

    RPC_AUTH_UNIX root mounts can use the UNIX root credential. Store the root
    credential in the nfs_client struct.

    Without a credential, NFSv4.1 state renewal fails.

    [nfs41: establish clientid via exchange id only if cred != NULL]
    Signed-off-by: Andy Adamson
    Signed-off-by: Benny Halevy
    [nfsd41: move nfstime4 from under CONFIG_NFS_V4_1]
    Signed-off-by: Andy Adamson
    Signed-off-by: Benny Halevy
    [nfs41: do not wait a lease time in exchange id]
    Signed-off-by: Andy Adamson
    Signed-off-by: Benny Halevy
    [nfs41: pass *session in seq_args and seq_res]
    Signed-off-by: Benny Halevy
    Signed-off-by: Trond Myklebust
    [nfs41: Ignoring impid in decode_exchange_id is missing a READ_BUF]
    Signed-off-by: Benny Halevy
    [nfs41: fix Xcode_exchange_id's xdr Xcoding pointer type]
    [nfs41: get rid of unused struct nfs41_exchange_id_res members]
    Signed-off-by: Benny Halevy

    Benny Halevy
     

17 Jun, 2009

1 commit


12 Jun, 2009

2 commits


28 May, 2009

1 commit


02 May, 2009

3 commits

  • Move this out of a local variable into the nfs4_delegation object in
    preparation for making this an async rpc call (at which point we'll need
    any state like this in a common object that's preserved across function
    calls).

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • There's no point in keeping this field around--it's always zero.

    (Background: the protocol allows you to tell the client that the file is
    about to be truncated, as an optimization to save the client from
    writing back dirty pages that will just be discarded. We don't
    implement this hint. If we do some day, adding this field back in will
    be the least of the work involved.)

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • The nfs4_cb_recall struct is used only in nfs4_delegation, so its
    pointer to the containing delegation is unnecessary--we could just use
    container_of().

    But there's no real reason to have this a separate struct at all--just
    move these fields to nfs4_delegation.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields