1. 23 2月, 2013 1 次提交
  2. 16 2月, 2013 1 次提交
  3. 28 7月, 2012 2 次提交
  4. 15 2月, 2012 2 次提交
  5. 01 2月, 2012 1 次提交
  6. 13 1月, 2012 1 次提交
  7. 12 12月, 2011 1 次提交
  8. 17 12月, 2010 3 次提交
    • C
      lockd: Clean up nlmsvc_lookup_host() · 67216b94
      Chuck Lever 提交于
      Clean up.
      
      Change nlmsvc_lookup_host() to be purpose-built for server-side
      nlm_host management.  This replaces the generic nlm_lookup_host()
      helper function, just like on the client side.  The lookup logic is
      specialized for server host lookups.
      
      The server side cache also gets its own specialized equivalent of the
      nlm_release_host() function.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      67216b94
    • C
      lockd: Create client-side nlm_host cache · 8ea6ecc8
      Chuck Lever 提交于
      NFS clients don't need the garbage collection processing that is
      performed on nlm_host structures.  The client picks up an nlm_host at
      mount time and holds a reference to it until the file system is
      unmounted.
      
      Servers, on the other hand, don't have a precise way to tell when an
      nlm_host is no longer being used, so zero refcount nlm_host entries
      are left to expire in the cache after a time.
      
      Basically there's nothing holding a reference to an nlm_host between
      individual server-side NLM requests, but we can't afford the expense
      of recreating them for every new NLM request from a client.  The
      nlm_host cache adds some lifetime hysteresis to entries in the cache
      so the next time a particular nlm_host is needed, it's likely to be
      discovered by a lookup rather than created from whole cloth.
      
      With the new implementation, client nlm_host cache items are no longer
      garbage collected, and are destroyed directly by a new release
      function specialized for client entries, nlmclnt_release_host().  They
      are cached in their own data structure, and have their own lookup
      logic, simplified and specialized for client nlm_host entries.
      
      However, the client nlm_host cache still shares reboot recovery logic
      with the server nlm_host cache.  The NSM "peer rebooted" downcall for
      clients and servers still come through the same RPC call.  This is a
      legacy formal API that would be difficult to alter, and besides, the
      user space NSM implementation can't tell the difference between peers
      that are clients or servers.
      
      For this reason, the client cache continues to share the
      nlm_host_mutex (and reboot recovery logic) with the server cache.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      8ea6ecc8
    • C
      lockd: Split nlm_release_call() · 7db836d4
      Chuck Lever 提交于
      The nlm_release_call() function is invoked from both the server and
      the client side.  We're about to introduce a distinct server- and
      client-side nlm_release_host(), so nlm_release_call() must first be
      split into a client-side and a server-side version.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      7db836d4
  9. 16 11月, 2010 1 次提交
    • T
      NLM: Fix a regression in lockd · 8e35f8e7
      Trond Myklebust 提交于
      Nick Bowler reports:
      There are no unusual messages on the client... but I just logged into
      the server and I see lots of messages of the following form:
      
        nfsd: request from insecure port (192.168.8.199:35766)!
        nfsd: request from insecure port (192.168.8.199:35766)!
        nfsd: request from insecure port (192.168.8.199:35766)!
        nfsd: request from insecure port (192.168.8.199:35766)!
        nfsd: request from insecure port (192.168.8.199:35766)!
      
      Bisected to commit 92476850 (SUNRPC:
      Properly initialize sock_xprt.srcaddr in all cases)
      
      Apparently, removing the 'transport->srcaddr.ss_family = family' from
      xs_create_sock() triggers this due to nlmclnt_lookup_host() incorrectly
      initialising the srcaddr family to AF_UNSPEC.
      Reported-by: NNick Bowler <nbowler@elliptictech.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      8e35f8e7
  10. 22 9月, 2009 1 次提交
  11. 21 8月, 2009 1 次提交
  12. 18 6月, 2009 1 次提交
    • 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
  13. 11 3月, 2009 1 次提交
  14. 07 1月, 2009 17 次提交
    • C
      NLM: Rewrite IPv4 privileged requester's check · 57ef6925
      Chuck Lever 提交于
      Clean up.
      
      For consistency, rewrite the IPv4 check to match the same style as the
      new IPv6 check.  Note that ipv4_is_loopback() is somewhat broader in
      its interpretation of what is a loopback address than simply
      "127.0.0.1".
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      57ef6925
    • C
      NLM: nlm_privileged_requester() doesn't recognize mapped loopback address · d1208f70
      Chuck Lever 提交于
      Commit b85e4676 added the nlm_privileged_requester() helper to check
      whether an RPC request was sent from a local privileged caller.  It
      recognizes IPv4 privileged callers (from "127.0.0.1"), and IPv6
      privileged callers (from "::1").
      
      However, IPV6_ADDR_LOOPBACK is not set for the mapped IPv4 loopback
      address (::ffff:7f00:0001), so the test breaks when the kernel's RPC
      service is IPv6-enabled but user space is calling via the IPv4
      loopback address.  This is actually the most common case for IPv6-
      enabled RPC services on Linux.
      
      Rewrite the IPv6 check to handle the mapped IPv4 loopback address as
      well as a normal IPv6 loopback address.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      d1208f70
    • C
      NSM: Move nsm_addr() to fs/lockd/mon.c · 8529bc51
      Chuck Lever 提交于
      Clean up: nsm_addr_in() is no longer used, and nsm_addr() is used only in
      fs/lockd/mon.c, so move it there.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      8529bc51
    • C
      NSM: Remove include/linux/lockd/sm_inter.h · e6765b83
      Chuck Lever 提交于
      Clean up: The include/linux/lockd/sm_inter.h header is nearly empty
      now.  Remove it.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      e6765b83
    • C
      NLM: Remove "create" argument from nsm_find() · 92fd91b9
      Chuck Lever 提交于
      Clean up: nsm_find() now has only one caller, and that caller
      unconditionally sets the @create argument. Thus the @create
      argument is no longer needed.
      
      Since nsm_find() now has a more specific purpose, pick a more
      appropriate name for it.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      92fd91b9
    • C
      NSM: Add nsm_lookup() function · 3420a8c4
      Chuck Lever 提交于
      Introduce a new API to fs/lockd/mon.c that allows nlm_host_rebooted()
      to lookup up nsm_handles via the contents of an nlm_reboot struct.
      
      The new function is equivalent to calling nsm_find() with @create set
      to zero, but it takes a struct nlm_reboot instead of separate
      arguments.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      3420a8c4
    • C
      NLM: Change nlm_host_rebooted() to take a single nlm_reboot argument · 7fefc9cb
      Chuck Lever 提交于
      Pass the nlm_reboot data structure directly from the NLMPROC_SM_NOTIFY
      XDR decoders to nlm_host_rebooted().  This eliminates some packing and
      unpacking of the NLMPROC_SM_NOTIFY results, and prepares for passing
      these results, including the "priv" cookie, directly to a lookup
      routine in fs/lockd/mon.c.
      
      This patch changes code organization but should not cause any
      behavioral change.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      7fefc9cb
    • C
      NSM: Generate NSMPROC_MON's "priv" argument when nsm_handle is created · 7e44d3be
      Chuck Lever 提交于
      Introduce a new data type, used by both the in-kernel NLM and NSM
      implementations, that is used to manage the opaque "priv" argument
      for the NSMPROC_MON and NLMPROC_SM_NOTIFY calls.
      
      Construct the "priv" cookie when the nsm_handle is created.
      
      The nsm_init_private() function may look a little strange, but it is
      roughly equivalent to how the XDR encoder formed the "priv" argument.
      It's going to go away soon.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      7e44d3be
    • C
      NSM: Move nsm_find() to fs/lockd/mon.c · 67c6d107
      Chuck Lever 提交于
      The nsm_find() function sets up fresh nsm_handle entries.  This is
      where we will store the "priv" cookie used to lookup nsm_handles during
      reboot recovery.  The cookie will be constructed when nsm_find()
      creates a new nsm_handle.
      
      As much as possible, I would like to keep everything that handles a
      "priv" cookie in fs/lockd/mon.c so that all the smarts are in one
      source file.  That organization should make it pretty simple to see how
      all this works.
      
      To me, it makes more sense than the current arrangement to keep
      nsm_find() with nsm_monitor() and nsm_unmonitor().
      
      So, start reorganizing by moving nsm_find() into fs/lockd/mon.c.  The
      nsm_release() function comes along too, since it shares the nsm_lock
      global variable.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      67c6d107
    • C
      NLM: Move the public declaration of nsm_unmonitor() to lockd.h · 356c3eb4
      Chuck Lever 提交于
      Clean up.
      
      Make the nlm_host argument "const," and move the public declaration to
      lockd.h.  Add a documenting comment.
      
      Bruce observed that nsm_unmonitor()'s only caller doesn't care about
      its return code, so make nsm_unmonitor() return void.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      356c3eb4
    • C
      NSM: Release nsmhandle in nlm_destroy_host · c8c23c42
      Chuck Lever 提交于
      The nsm_handle's reference count is bumped in nlm_lookup_host().  It
      should be decremented in nlm_destroy_host() to make it easier to see
      the balance of these two operations.
      
      Move the nsm_release() call to fs/lockd/host.c.
      
      The h_nsmhandle pointer is set in nlm_lookup_host(), and never cleared.
      The nlm_destroy_host() function is never called for the same nlm_host
      twice, so h_nsmhandle won't ever be NULL when nsm_unmonitor() is
      called.
      
      All references to the nlm_host are gone before it is freed.  We can
      skip making h_nsmhandle NULL just before the nlm_host is deallocated.
      
      It's also likely we can remove the h_nsmhandle NULL check in
      nlmsvc_is_client() as well, but we can do that later when rearchitect-
      ing the nlm_host cache.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      c8c23c42
    • C
      NLM: Move the public declaration of nsm_monitor() to lockd.h · 1e49323c
      Chuck Lever 提交于
      Clean up.
      
      Make the nlm_host argument "const," and move the public declaration to
      lockd.h with other NSM public function (nsm_release, eg) and global
      variable declarations.
      
      Add a documenting comment.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      1e49323c
    • C
      NSM: Support IPv6 version of mon_name · 29ed1407
      Chuck Lever 提交于
      The "mon_name" argument of the NSMPROC_MON and NSMPROC_UNMON upcalls
      is a string that contains the hostname or IP address of the remote peer
      to be notified when this host has rebooted.  The sm-notify command uses
      this identifier to contact the peer when we reboot, so it must be
      either a well-qualified DNS hostname or a presentation format IP
      address string.
      
      When the "nsm_use_hostnames" sysctl is set to zero, the kernel's NSM
      provides a presentation format IP address in the "mon_name" argument.
      Otherwise, the "caller_name" argument from NLM requests is used,
      which is usually just the DNS hostname of the peer.
      
      To support IPv6 addresses for the mon_name argument, we use the
      nsm_handle's address eye-catcher, which already contains an appropriate
      presentation format address string.  Using the eye-catcher string
      obviates the need to use a large buffer on the stack to form the
      presentation address string for the upcall.
      
      This patch also addresses a subtle bug.
      
      An NSMPROC_MON request and the subsequent NSMPROC_UNMON request for the
      same peer are required to use the same value for the "mon_name"
      argument.  Otherwise, rpc.statd's NSMPROC_UNMON processing cannot
      locate the database entry for that peer and remove it.
      
      If the setting of nsm_use_hostnames is changed between the time the
      kernel sends an NSMPROC_MON request and the time it sends the
      NSMPROC_UNMON request for the same peer, the "mon_name" argument for
      these two requests may not be the same.  This is because the value of
      "mon_name" is currently chosen at the moment the call is made based on
      the setting of nsm_use_hostnames
      
      To ensure both requests pass identical contents in the "mon_name"
      argument, we now select which string to use for the argument in the
      nsm_monitor() function.  A pointer to this string is saved in the
      nsm_handle so it can be used for a subsequent NSMPROC_UNMON upcall.
      
      NB: There are other potential problems, such as how nlm_host_rebooted()
      might behave if nsm_use_hostnames were changed while hosts are still
      being monitored.  This patch does not attempt to address those
      problems.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      29ed1407
    • C
      NSM: Use modern style for sm_name field in nsm_handle · f47534f7
      Chuck Lever 提交于
      Clean up: I'm about to add another "char *" field to the nsm_handle
      structure.  The sm_name field uses an older style of declaring a
      "char *" field.  If I match that style for the new field, checkpatch.pl
      will complain.
      
      So, fix the sm_name field to use the new style.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      f47534f7
    • C
      NLM: Support IPv6 scope IDs in nlm_display_address() · bc995801
      Chuck Lever 提交于
      Scope ID support is needed since the kernel's NSM implementation is
      about to use these displayed addresses as a mon_name in some cases.
      
      When nsm_use_hostnames is zero, without scope ID support NSM will fail
      to handle peers that contact us via a link-local address.  Link-local
      addresses do not work without an interface ID, which is stored in the
      sockaddr's sin6_scope_id field.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      bc995801
    • C
      NLM: Remove address eye-catcher buffers from nlm_host · 1df40b60
      Chuck Lever 提交于
      The h_name field in struct nlm_host is a just copy of
      h_nsmhandle->sm_name.  Likewise, the contents of the h_addrbuf field
      should be identical to the sm_addrbuf field.
      
      The h_srcaddrbuf field is used only in one place for debugging.  We can
      live without this until we get %pI formatting for printk().
      
      Currently these buffers are 48 bytes, but we need to support scope IDs
      in IPv6 presentation addresses, which means making the buffers even
      larger.  Instead, let's find ways to eliminate them to save space.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      1df40b60
    • C
      NLM: Use modern style for pointer fields in nlm_host · 7538ce1e
      Chuck Lever 提交于
      Clean up: I'm about to add another "char *" field to the nlm_host
      structure.  The h_name field, for example, uses an older style of
      declaring a "char *" field.  If I match that style for the new field,
      checkpatch.pl will complain.
      
      So, fix pointer fields to use the new style.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      7538ce1e
  15. 24 12月, 2008 1 次提交
  16. 04 10月, 2008 5 次提交