1. 18 Jun, 2009 10 commits
    • Chuck Lever's avatar
      NFS: Add separate mountd status code decoders for each mountd version · fb125295
      Chuck Lever authored
      Introduce data structures and xdr_stream-based decoding functions for
      unmarshalling mountd status codes properly.
      
      Mountd version 3 uses specific standard error return codes that are
      not errno values and not NFS3ERR_ values.  These have a well-defined
      standard mapping to local errno values.  Introduce data structures
      and a decoder function that map these status codes to local errno
      values properly.  This is new functionality (but not used yet).
      
      Version 1 mountd status values are defined by RFC 1094 as UNIX error
      values (errno values).  Errno values on heterogeneous systems do not
      necessarily match each other.  To avoid exposing possibly incorrect
      errno values to upper layers, the current XDR decoder converts all
      non-zero MNT version 1 status codes to -EACCES.
      
      The OpenGroup XNFS standard provides a mapping similar to but smaller
      than the version 3 error codes.  Implement a decoder that uses the XNFS
      error codes, replacing the current decoder.
      
      For both mountd protocol versions, map unrecognized errors to -EACCES.
      
      Finally we introduce a replacement data structure for mnt_fhstatus
      at this time, which is used by the new XDR decoders.  In addition to
      documenting that the status value returned by the XDR decoders is
      always an errno, this new structure will be expanded in subsequent
      patches.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      fb125295
    • Chuck Lever's avatar
      NFS: remove unused function in fs/nfs/mount_clnt.c · 99835db4
      Chuck Lever authored
      Clean up: remove xdr_encode_dirpath() now that it has been replaced.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      99835db4
    • Chuck Lever's avatar
      NFS: Use xdr_stream-based XDR encoder for MNT's dirpath argument · 29a1bd6b
      Chuck Lever authored
      Check the length of the supplied dirpath, and see that it fits
      properly in the RPC buffer.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      29a1bd6b
    • Chuck Lever's avatar
      NFS: Clean up MNT program definitions · 2ad78097
      Chuck Lever authored
      Clean up:  Relocate MNT program procedure number definitions to the
      only file that uses them.  Relocate the version number definitions,
      which are shared, to nfs.h.  Remove duplicate program number
      definitions.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      2ad78097
    • Chuck Lever's avatar
      lockd: Don't bother with RPC ping for NSM upcalls · 0e5c2632
      Chuck Lever authored
      Cut NSM upcall RPC traffic in half -- don't do a NULL call first.
      The cases where a ping would be helpful are rare.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      0e5c2632
    • Chuck Lever's avatar
      lockd: Update NSM state from SM_MON replies · 6c9dc425
      Chuck Lever authored
      When rpc.statd starts up in user space at boot time, it attempts to
      write the latest NSM local state number into
      /proc/sys/fs/nfs/nsm_local_state.
      
      If lockd.ko isn't loaded yet (as is the case in most configurations),
      that file doesn't exist, thus the kernel's NSM state remains set to
      its initial value of zero during lockd operation.
      
      This is a problem because rpc.statd and lockd use the NSM state number
      to prevent repeated lock recovery on rebooted hosts.  If lockd sends
      a zero NSM state, but then a delayed SM_NOTIFY with a real NSM state
      number is received, there is no way for lockd or rpc.statd to
      distinguish that stale SM_NOTIFY from an actual reboot.  Thus lock
      recovery could be performed after the rebooted host has already
      started reclaiming locks, and those locks will be lost.
      
      We could change /etc/init.d/nfslock so it always modprobes lockd.ko
      before starting rpc.statd.  However, if lockd.ko is ever unloaded
      and reloaded, we are back at square one, since the NSM state is not
      preserved across an unload/reload cycle.  This may happen frequently
      on clients that use automounter.  A period of NFS inactivity causes
      lockd.ko to be unloaded, and the kernel loses its NSM state setting.
      
      Instead, let's use the fact that rpc.statd plants the local system's
      NSM state in every SM_MON (and SM_UNMON) reply.  lockd performs a
      synchronous SM_MON upcall to the local rpc.statd _before_ sending its
      first NLM request to a new remote.  This would permit rpc.statd to
      provide the current NSM state to lockd, even after lockd.ko had been
      unloaded and reloaded.
      
      Note that NLMPROC_LOCK arguments are constructed before the
      nsm_monitor() call, so we have to rearrange argument construction very
      slightly to make this all work out.
      
      And, the kernel appears to treat NSM state as a u32 (see struct
      nlm_args and nsm_res).  Make nsm_local_state a u32 as well, to ensure
      we don't get bogus comparison results.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      6c9dc425
    • Chuck Lever's avatar
      NFS: Fix false error return from nfs_callback_up() if ipv6.ko is not available · 18fc3164
      Chuck Lever authored
      Clear "ret" if the error return from svc_create_xprt(AF_INET6) was
      -EAFNOSUPORT.  Otherwise, callback start-up will succeed, but
      nfs_callback_up() will return -EAFNOSUPPORT anyway, and the first
      NFSv4 mount attempt after a reboot will fail.
      
      Bug introduced by commit f738f517 in 2.6.30-rc1.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      18fc3164
    • Chuck Lever's avatar
      NFS: Return error code from nfs_callback_up() to user space · a21bdd9b
      Chuck Lever authored
      If the kernel cannot start the NFSv4 callback service during a mount
      request, it returns -ENOMEM to user space, resulting in this message:
      
         mount.nfs4: Cannot allocate memory
      
      Adjust nfs_alloc_client() and nfs_get_client() to pass NFSv4 callback
      start-up errors back to user space so a less mysterious error message
      can be displayed by the mount command.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      a21bdd9b
    • Chuck Lever's avatar
      NFS: Do not display the setting of the "intr" mount option · c381ad2c
      Chuck Lever authored
      The "intr" mount option has been deprecated for a while, but
      /proc/mounts continues to display "nointr" whether "intr" or "nointr"
      has been specified for a mount point.
      
      Since these options do not have any effect, simply do not display
      them.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      c381ad2c
    • Suresh Jayaraman's avatar
      NFS: add support for splice writes · bf40d343
      Suresh Jayaraman authored
      Adds support for splice writes. It effectively calls
      generic_file_splice_write() to do the writes.
      
      We need not worry about O_APPEND case as the combination of splice()
      writes and O_APPEND is disallowed. This patch propagates NFS write
      errors back to the caller. The number of bytes written via splice are
      being added to NFSIO_NORMALWRITTENBYTES as these are effectively
      cached writes.
      Signed-off-by: default avatarSuresh Jayaraman <sjayaraman@suse.de>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      bf40d343
  2. 17 Jun, 2009 30 commits