1. 11 Mar, 2009 12 commits
    • NeilBrown's avatar
      NFS: flush cached directory information slightly more readily. · 37d9d76d
      NeilBrown authored
      If cached directory contents becomes incorrect, there is no way to
      flush the contents.  This contrasts with files where file locking is
      the recommended way to ensure cache consistency between multiple
      applications (a read-lock always flushes the cache).
      
      Also while changes to files often change the size of the file (thus
      triggering a cache flush), changes to directories often do not change
      the apparent size (as the size is often rounded to a block size).
      
      So it is particularly important with directories to avoid the
      possibility of an incorrect cache wherever possible.
      
      When the link count on a directory changes it implies a change in the
      number of child directories, and so a change in the contents of this
      directory.  So use that as a trigger to flush cached contents.
      
      When the ctime changes but the mtime does not, there are two possible
      reasons.
       1/ The owner/mode information has been changed.
       2/ utimes has been used to set the mtime backwards.
      
      In the first case, a data-cache flush is not required.
      In the second case it is.
      
      So on the basis that correctness trumps performance, flush the
      directory contents cache in this case also.
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      37d9d76d
    • Suresh Jayaraman's avatar
      NFS: Minor __nfs_revalidate_inode cleanup · 2b57dc6c
      Suresh Jayaraman authored
      Remove redundant NFS_STALE() check, a leftover due to the commit
      691beb13Signed-off-by: default avatarSuresh Jayaraman <sjayaraman@suse.de>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      2b57dc6c
    • Chuck Lever's avatar
      SUNRPC: Avoid spurious wake-up during UDP connect processing · fe315e76
      Chuck Lever authored
      To clear out old state, the UDP connect workers unconditionally invoke
      xs_close() before proceeding with a new connect.  Nowadays this causes
      a spurious wake-up of the task waiting for the connect to complete.
      
      This is a little racey, but usually harmless.  The waiting task
      immediately retries the connect via a call_bind/call_connect sequence,
      which usually finds the transport already in the connected state
      because the connect worker has finished in the background.
      
      To avoid a spurious wake-up, factor the xs_close() logic that resets
      the underlying socket into a helper, and have the UDP connect workers
      call that helper instead of xs_close().
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      fe315e76
    • Trond Myklebust's avatar
      SUNRPC: xprt_connect() don't abort the task if the transport isn't bound · 01d37c42
      Trond Myklebust authored
      If the transport isn't bound, then we should just return ENOTCONN, letting
      call_connect_status() and/or call_status() deal with retrying. Currently,
      we appear to abort all pending tasks with an EIO error.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      01d37c42
    • Trond Myklebust's avatar
      SUNRPC: Fix an Oops due to socket not set up yet... · fba91afb
      Trond Myklebust authored
      We can Oops in both xs_udp_send_request() and xs_tcp_send_request() if the
      call to xs_sendpages() returns an error due to the socket not yet being
      set up.
      Deal with that situation by returning a new error: ENOTSOCK, so that we
      know to avoid dereferencing transport->sock.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      fba91afb
    • Ian Dall's avatar
      Bug 11061, NFS mounts dropped · d7371c41
      Ian Dall authored
      Addresses: http://bugzilla.kernel.org/show_bug.cgi?id=11061
      
      sockaddr structures can't be reliably compared using memcmp() because
      there are padding bytes in the structure which can't be guaranteed to
      be the same even when the sockaddr structures refer to the same
      socket. Instead compare all the relevant fields. In the case of IPv6
      sin6_flowinfo is not compared because it only affects QoS and
      sin6_scope_id is only compared if the address is "link local" because
      "link local" addresses need only be unique to a specific link.
      Signed-off-by: default avatarIan Dall <ian@beware.dropbear.id.au>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      d7371c41
    • Suresh Jayaraman's avatar
      NFS: Handle -ESTALE error in access() · a71ee337
      Suresh Jayaraman authored
      Hi Trond,
      
      I have been looking at a bugreport where trying to open applications on KDE
      on a NFS mounted home fails temporarily. There have been multiple reports on
      different kernel versions pointing to this common issue:
      http://bugzilla.kernel.org/show_bug.cgi?id=12557
      https://bugs.launchpad.net/ubuntu/+source/linux/+bug/269954
      http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508866.html
      
      This issue can be reproducible consistently by doing this on a NFS mounted
      home (KDE):
      1. Open 2 xterm sessions
      2. From one of the xterm session, do "ssh -X <remote host>"
      3. "stat ~/.Xauthority" on the remote SSH session
      4. Close the two xterm sessions
      5. On the server do a "stat ~/.Xauthority"
      6. Now on the client, try to open xterm
      This will fail.
      
      Even if the filehandle had become stale, the NFS client should invalidate
      the cache/inode and should repeat LOOKUP. Looking at the packet capture when
      the failure occurs shows that there were two subsequent ACCESS() calls with
      the same filehandle and both fails with -ESTALE error.
      
      I have tested the fix below. Now the client issue a LOOKUP after the
      ACCESS() call fails with -ESTALE. If all this makes sense to you, can you
      consider this for inclusion?
      
      Thanks,
      
      
      If the server returns an -ESTALE error due to stale filehandle in response to
      an ACCESS() call, we need to invalidate the cache and inode so that LOOKUP()
      can be retried. Without this change, the nfs client retries ACCESS() with the
      same filehandle, fails again and could lead to temporary failure of
      applications running on nfs mounted home.
      Signed-off-by: default avatarSuresh Jayaraman <sjayaraman@suse.de>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      a71ee337
    • Chuck Lever's avatar
      NLM: Fix GRANT callback address comparison when IPv6 is enabled · 57df675c
      Chuck Lever authored
      The NFS mount command may pass an AF_INET server address to lockd.  If
      lockd happens to be using a PF_INET6 listener, the nlm_cmp_addr() in
      nlmclnt_grant() will fail to match requests from that host because they
      will all have a mapped IPv4 AF_INET6 address.
      
      Adopt the same solution used in nfs_sockaddr_match_ipaddr() for NFSv4
      callbacks: if either address is AF_INET, map it to an AF_INET6 address
      before doing the comparison.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      57df675c
    • Chuck Lever's avatar
      NLM: Shrink the IPv4-only version of nlm_cmp_addr() · 78851e1a
      Chuck Lever authored
      Clean up/micro-optimatization:  Make the AF_INET-only version of
      nlm_cmp_addr() smaller.  This matches the style of
      nlm_privileged_requester(), and makes the AF_INET-only version of
      nlm_cmp_addr() nearly the same size as it was before IPv6 support.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      78851e1a
    • Trond Myklebust's avatar
      NFSv3: Fix posix ACL code · ae46141f
      Trond Myklebust authored
      Fix a memory leak due to allocation in the XDR layer. In cases where the
      RPC call needs to be retransmitted, we end up allocating new pages without
      clearing the old ones. Fix this by moving the allocation into
      nfs3_proc_setacls().
      
      Also fix an issue discovered by Kevin Rudd, whereby the amount of memory
      reserved for the acls in the xdr_buf->head was miscalculated, and causing
      corruption.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      ae46141f
    • Trond Myklebust's avatar
      NFS: Fix misparsing of nfsv4 fs_locations attribute (take 2) · ef95d31e
      Trond Myklebust authored
      The changeset ea31a443 (nfs: Fix
      misparsing of nfsv4 fs_locations attribute) causes the mountpath that is
      calculated at the beginning of try_location() to be clobbered when we
      later strncpy a non-nul terminated hostname using an incorrect buffer
      length.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      ef95d31e
    • Trond Myklebust's avatar
      SUNRPC: Tighten up the task locking rules in __rpc_execute() · eb9b55ab
      Trond Myklebust authored
      We should probably not be testing any flags after we've cleared the
      RPC_TASK_RUNNING flag, since rpc_make_runnable() is then free to assign the
      rpc_task to another workqueue, which may then destroy it.
      
      We can fix any races with rpc_make_runnable() by ensuring that we only
      clear the RPC_TASK_RUNNING flag while holding the rpc_wait_queue->lock that
      the task is supposed to be sleeping on (and then checking whether or not
      the task really is sleeping).
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      eb9b55ab
  2. 10 Mar, 2009 21 commits
  3. 09 Mar, 2009 7 commits