1. 13 7月, 2009 1 次提交
  2. 18 6月, 2009 3 次提交
    • C
      lockd: Don't bother with RPC ping for NSM upcalls · 0e5c2632
      Chuck Lever 提交于
      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: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      0e5c2632
    • C
      lockd: Update NSM state from SM_MON replies · 6c9dc425
      Chuck Lever 提交于
      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: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      6c9dc425
    • T
  3. 07 5月, 2009 1 次提交
    • J
      lockd: fix list corruption on lockd restart · 89996df4
      J. Bruce Fields 提交于
      If lockd is signalled soon enough after restart then locks_start_grace()
      will try to re-add an entry to a list and trigger a lock corruption
      warning.
      
      Thanks to Wang Chen for the problem report and diagnosis.
      
      WARNING: at lib/list_debug.c:26 __list_add+0x27/0x5c()
      ...
      list_add corruption. next->prev should be prev (ef8fe958), but was ef8ff128.  (next=ef8ff128).
      ...
      Pid: 23062, comm: lockd Tainted: G        W  2.6.30-rc2 #3
      Call Trace:
      [<c042d5b5>] warn_slowpath+0x71/0xa0
      [<c0422a96>] ? update_curr+0x11d/0x125
      [<c044b12d>] ? trace_hardirqs_on_caller+0x18/0x150
      [<c044b270>] ? trace_hardirqs_on+0xb/0xd
      [<c051c61a>] ? _raw_spin_lock+0x53/0xfa
      [<c051c89f>] __list_add+0x27/0x5c
      [<ef8f6daa>] locks_start_grace+0x22/0x30 [lockd]
      [<ef8f34da>] set_grace_period+0x39/0x53 [lockd]
      [<c06b8921>] ? lock_kernel+0x1c/0x28
      [<ef8f3558>] lockd+0x64/0x164 [lockd]
      [<c044b12d>] ? trace_hardirqs_on_caller+0x18/0x150
      [<c04227b0>] ? complete+0x34/0x3e
      [<ef8f34f4>] ? lockd+0x0/0x164 [lockd]
      [<ef8f34f4>] ? lockd+0x0/0x164 [lockd]
      [<c043dd42>] kthread+0x45/0x6b
      [<c043dcfd>] ? kthread+0x0/0x6b
      [<c0403c23>] kernel_thread_helper+0x7/0x10
      Reported-by: NWang Chen <wangchen@cn.fujitsu.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      Cc: stable@kernel.org
      89996df4
  4. 25 4月, 2009 1 次提交
    • F
      lockd: call locks_release_private to cleanup per-filesystem state · a9e61e25
      Felix Blyakher 提交于
      For every lock request lockd creates a new file_lock object
      in nlmsvc_setgrantargs() by copying the passed in file_lock with
      locks_copy_lock(). A filesystem can attach it's own lock_operations
      vector to the file_lock. It has to be cleaned up at the end of the
      file_lock's life. However, lockd doesn't do it today, yet it
      asserts in nlmclnt_release_lockargs() that the per-filesystem
      state is clean.
      This patch fixes it by exporting locks_release_private() and adding
      it to nlmsvc_freegrantargs(), to be symmetrical to creating a
      file_lock in nlmsvc_setgrantargs().
      Signed-off-by: NFelix Blyakher <felixb@sgi.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      a9e61e25
  5. 02 4月, 2009 1 次提交
  6. 29 3月, 2009 4 次提交
  7. 19 3月, 2009 1 次提交
  8. 11 3月, 2009 1 次提交
  9. 10 2月, 2009 1 次提交
    • J
      lockd: fix regression in lockd's handling of blocked locks · 9d9b87c1
      J. Bruce Fields 提交于
      If a client requests a blocking lock, is denied, then requests it again,
      then here in nlmsvc_lock() we will call vfs_lock_file() without FL_SLEEP
      set, because we've already queued a block and don't need the locks code
      to do it again.
      
      But that means vfs_lock_file() will return -EAGAIN instead of
      FILE_LOCK_DENIED.  So we still need to translate that -EAGAIN return
      into a nlm_lck_blocked error in this case, and put ourselves back on
      lockd's block list.
      
      The bug was introduced by bde74e4b "locks: add special return
      value for asynchronous locks".
      
      Thanks to Frank van Maarseveen for the report; his original test
      case was essentially
      
      	for i in `seq 30`; do flock /nfsmount/foo sleep 10 & done
      Tested-by: NFrank van Maarseveen <frankvm@frankvm.com>
      Reported-by: NFrank van Maarseveen <frankvm@frankvm.com>
      Cc: Miklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      9d9b87c1
  10. 08 1月, 2009 2 次提交
  11. 07 1月, 2009 24 次提交