1. 23 Jul, 2010 4 commits
    • Jeff Layton's avatar
      nfsd: fix error handling in __write_ports_addxprt · 0cd14a06
      Jeff Layton authored
      __write_ports_addxprt calls nfsd_create_serv. That increases the
      refcount of nfsd_serv (which is tracked in sv_nrthreads). The service
      only decrements the thread count on error, not on success like
      __write_ports_addfd does, so using this interface leaves the nfsd
      thread count high.
      
      Fix this by having this function call svc_destroy() on error to release
      the reference (and possibly to tear down the service) and simply
      decrement the refcount without tearing down the service on success.
      
      This makes the sv_threads handling work basically the same in both
      __write_ports_addxprt and __write_ports_addfd.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      0cd14a06
    • Jeff Layton's avatar
      nfsd: fix error handling when starting nfsd with rpcbind down · 78a8d7c8
      Jeff Layton authored
      The refcounting for nfsd is a little goofy. What happens is that we
      create the nfsd RPC service, attach sockets to it but don't actually
      start the threads until someone writes to the "threads" procfile. To do
      this, __write_ports_addfd will create the nfsd service and then will
      decrement the refcount when exiting but won't actually destroy the
      service.
      
      This is fine when there aren't errors, but when there are this can
      cause later attempts to start nfsd to fail. nfsd_serv will be set,
      and that causes __write_versions to return EBUSY.
      
      Fix this by calling svc_destroy on nfsd_serv when this function is
      going to return error.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      78a8d7c8
    • Jeff Layton's avatar
      nfsd4: fix v4 state shutdown error paths · 4ad9a344
      Jeff Layton authored
      If someone tries to shut down the laundry_wq while it isn't up it'll
      cause an oops.
      
      This can happen because write_ports can create a nfsd_svc before we
      really start the nfs server, and we may fail before the server is ever
      started.
      
      Also make sure state is shutdown on error paths in nfsd_svc().
      
      Use a common global nfsd_up flag instead of nfs4_init, and create common
      helper functions for nfsd start/shutdown, as there will be other work
      that we want done only when we the number of nfsd threads transitions
      between zero and nonzero.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      4ad9a344
    • J. Bruce Fields's avatar
      nfsd: remove unused assignment from nfsd_link · 55b13354
      J. Bruce Fields authored
      Trivial cleanup, since "dest" is never used.
      Reported-by: default avatarAnshul Madan <Anshul.Madan@netapp.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      55b13354
  2. 07 Jul, 2010 1 commit
    • Chuck Lever's avatar
      NFSD: Fill in WCC data for REMOVE, RMDIR, MKNOD, and MKDIR · 43a9aa64
      Chuck Lever authored
      Some well-known NFSv3 clients drop their directory entry caches when
      they receive replies with no WCC data.  Without this data, they
      employ extra READ, LOOKUP, and GETATTR requests to ensure their
      directory entry caches are up to date, causing performance to suffer
      needlessly.
      
      In order to return WCC data, our server has to have both the pre-op
      and the post-op attribute data on hand when a reply is XDR encoded.
      The pre-op data is filled in when the incoming fh is locked, and the
      post-op data is filled in when the fh is unlocked.
      
      Unfortunately, for REMOVE, RMDIR, MKNOD, and MKDIR, the directory fh
      is not unlocked until well after the reply has been XDR encoded.  This
      means that encode_wcc_data() does not have wcc_data for the parent
      directory, so none is returned to the client after these operations
      complete.
      
      By unlocking the parent directory fh immediately after the internal
      operations for each NFS procedure is complete, the post-op data is
      filled in before XDR encoding starts, so it can be returned to the
      client properly.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      43a9aa64
  3. 06 Jul, 2010 2 commits
    • J. Bruce Fields's avatar
      6a85d6c7
    • Artem Bityutskiy's avatar
      sunrpc: make the cache cleaner workqueue deferrable · 8eab945c
      Artem Bityutskiy authored
      This patch makes the cache_cleaner workqueue deferrable, to prevent
      unnecessary system wake-ups, which is very important for embedded
      battery-powered devices.
      
      do_cache_clean() is called every 30 seconds at the moment, and often
      makes the system wake up from its power-save sleep state. With this
      change, when the workqueue uses a deferrable timer, the
      do_cache_clean() invocation will be delayed and combined with the
      closest "real" wake-up. This improves the power consumption situation.
      
      Note, I tried to create a DECLARE_DELAYED_WORK_DEFERRABLE() helper
      macro, similar to DECLARE_DELAYED_WORK(), but failed because of the
      way the timer wheel core stores the deferrable flag (it is the
      LSBit in the time->base pointer). My attempt to define a static
      variable with this bit set ended up with the "initializer element is
      not constant" error.
      
      Thus, I have to use run-time initialization, so I created a new
      cache_initialize() function which is called once when sunrpc is
      being initialized.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      8eab945c
  4. 24 Jun, 2010 2 commits
  5. 23 Jun, 2010 1 commit
  6. 22 Jun, 2010 3 commits
  7. 31 May, 2010 4 commits
  8. 30 May, 2010 23 commits