Skip to content
Snippets Groups Projects
  1. Dec 14, 2009
  2. Nov 13, 2009
  3. Sep 16, 2009
  4. Sep 02, 2009
    • David Howells's avatar
      CRED: Add some configurable debugging [try #6] · e0e81739
      David Howells authored
      Add a config option (CONFIG_DEBUG_CREDENTIALS) to turn on some debug checking
      for credential management.  The additional code keeps track of the number of
      pointers from task_structs to any given cred struct, and checks to see that
      this number never exceeds the usage count of the cred struct (which includes
      all references, not just those from task_structs).
      
      Furthermore, if SELinux is enabled, the code also checks that the security
      pointer in the cred struct is never seen to be invalid.
      
      This attempts to catch the bug whereby inode_has_perm() faults in an nfsd
      kernel thread on seeing cred->security be a NULL pointer (it appears that the
      credential struct has been previously released):
      
      	http://www.kerneloops.org/oops.php?number=252883
      
      
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      e0e81739
    • Andy Adamson's avatar
      nfsd41: replace page based DRC with buffer based DRC · 557ce264
      Andy Adamson authored
      
      Use NFSD_SLOT_CACHE_SIZE size buffers for sessions DRC instead of holding nfsd
      pages in cache.
      
      Connectathon testing has shown that 1024 bytes for encoded compound operation
      responses past the sequence operation is sufficient, 512 bytes is a little too
      small. Set NFSD_SLOT_CACHE_SIZE to 1024.
      
      Allocate memory for the session DRC in the CREATE_SESSION operation
      to guarantee that the memory resource is available for caching responses.
      Allocate each slot individually in preparation for slot table size negotiation.
      
      Remove struct nfsd4_cache_entry and helper functions for the old page-based
      DRC.
      
      The iov_len calculation in nfs4svc_encode_compoundres is now always
      correct.  Replay is now done in nfsd4_sequence under the state lock, so
      the session ref count is only bumped on non-replay. Clean up the
      nfs4svc_encode_compoundres session logic.
      
      The nfsd4_compound_state statp pointer is also not used.
      Remove nfsd4_set_statp().
      
      Move useful nfsd4_cache_entry fields into nfsd4_slot.
      
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      557ce264
  5. Aug 25, 2009
  6. Jul 28, 2009
  7. Jul 14, 2009
    • Andy Adamson's avatar
      nfsd41: use globals for DRC limits · 4bd9b0f4
      Andy Adamson authored
      
      The version 4.1 DRC memory limit and tracking variables are server wide and
      session specific. Replace struct svc_serv fields with globals.
      Stop using the svc_serv sv_lock.
      
      Add a spinlock to serialize access to the DRC limit management variables which
      change on session creation and deletion (usage counter) or (future)
      administrative action to adjust the total DRC memory limit.
      
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
      4bd9b0f4
  8. Jul 12, 2009
  9. Jun 18, 2009
    • NeilBrown's avatar
      nfsd: optimise the starting of zero threads when none are running. · 671e1fcf
      NeilBrown authored
      
      Currently, if we ask to set then number of nfsd threads to zero when
      there are none running, we set up all the sockets and register the
      service, and then tear it all down again.
      This is pointless.
      
      So detect that case and exit promptly.
      (also remove an assignment to 'error' which was never used.
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Acked-by: default avatarJeff Layton <jlayton@redhat.com>
      671e1fcf
    • NeilBrown's avatar
      nfsd: don't take nfsd_mutex twice when setting number of threads. · 82e12fe9
      NeilBrown authored
      
      Currently when we write a number to 'threads' in nfsdfs,
      we take the nfsd_mutex, update the number of threads, then take the
      mutex again to read the number of threads.
      
      Mostly this isn't a big deal.  However if we are write '0', and
      portmap happens to be dead, then we can get unpredictable behaviour.
      If the nfsd threads all got killed quickly and the last thread is
      waiting for portmap to respond, then the second time we take the mutex
      we will block waiting for the last thread.
      However if the nfsd threads didn't die quite that fast, then there
      will be no contention when we try to take the mutex again.
      
      Unpredictability isn't fun, and waiting for the last thread to exit is
      pointless, so avoid taking the lock twice.
      To achieve this, get nfsd_svc return a non-negative number of active
      threads when not returning a negative error.
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      82e12fe9
  10. Apr 06, 2009
  11. Apr 04, 2009
    • Benny Halevy's avatar
      nfsd41: control nfsv4.1 svc via /proc/fs/nfsd/versions · 8daf220a
      Benny Halevy authored
      
      Support enabling and disabling nfsv4.1 via /proc/fs/nfsd/versions
      by writing the strings "+4.1" or "-4.1" correspondingly.
      
      Use user mode nfs-utils (rpc.nfsd option) to enable.
      This will allow us to get rid of CONFIG_NFSD_V4_1
      
      [nfsd41: disable support for minorversion by default]
      Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      8daf220a
    • Andy Adamson's avatar
      nfsd41: hard page limit for DRC · c3d06f9c
      Andy Adamson authored
      
      Use no more than 1/128th of the number of free pages at nfsd startup for the
      v4.1 DRC.
      
      This is an arbitrary default which should probably end up under the control
      of an administrator.
      
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      [moved added fields in struct svc_serv under CONFIG_NFSD_V4_1]
      Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
      [fix set_max_drc calculation of sv_drc_max_pages]
      [moved NFSD_DRC_SIZE_SHIFT's declaration up in header file]
      Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      c3d06f9c
    • Andy Adamson's avatar
      nfsd41: DRC save, restore, and clear functions · 074fe897
      Andy Adamson authored
      
      Cache all the result pages, including the rpc header in rq_respages[0],
      for a request in the slot table cache entry.
      
      Cache the statp pointer from nfsd_dispatch which points into rq_respages[0]
      just past the rpc header. When setting a cache entry, calculate and save the
      length of the nfs data minus the rpc header for rq_respages[0].
      
      When replaying a cache entry, replace the cached rpc header with the
      replayed request rpc result header, unless there is not enough room in the
      cached results first page. In that case, use the cached rpc header.
      
      The sessions fore channel maxresponse size cached is set to NFSD_PAGES_PER_SLOT
      * PAGE_SIZE. For compounds we are cacheing with operations such as READDIR
      that use the xdr_buf->pages to hold data, we choose to cache the extra page of
      data rather than copying data from xdr_buf->pages into the xdr_buf->head page.
      
      [nfsd41: limit cache to maxresponsesize_cached]
      [nfsd41: mv nfsd4_set_statp under CONFIG_NFSD_V4_1]
      [nfsd41: rename nfsd4_move_pages]
      [nfsd41: rename page_no variable]
      [nfsd41: rename nfsd4_set_cache_entry]
      [nfsd41: fix nfsd41_copy_replay_data comment]
      [nfsd41: add to nfsd4_set_cache_entry]
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      074fe897
  12. Apr 01, 2009
    • Al Viro's avatar
      Take fs_struct handling to new file (fs/fs_struct.c) · 3e93cd67
      Al Viro authored
      
      Pure code move; two new helper functions for nfsd and daemonize
      (unshare_fs_struct() and daemonize_fs_struct() resp.; for now -
      the same code as used to be in callers).  unshare_fs_struct()
      exported (for nfsd, as copy_fs_struct()/exit_fs() used to be),
      copy_fs_struct() and exit_fs() don't need exports anymore.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      3e93cd67
  13. Mar 28, 2009
  14. Mar 18, 2009
    • Greg Banks's avatar
      knfsd: add file to export stats about nfsd pools · 03cf6c9f
      Greg Banks authored
      Add /proc/fs/nfsd/pool_stats to export to userspace various
      statistics about the operation of rpc server thread pools.
      
      This patch is based on a forward-ported version of
      knfsd-add-pool-thread-stats which has been shipping in the SGI
      "Enhanced NFS" product since 2006 and which was previously
      posted:
      
      http://article.gmane.org/gmane.linux.nfs/10375
      
      
      
      It has also been updated thus:
      
       * moved EXPORT_SYMBOL() to near the function it exports
       * made the new struct struct seq_operations const
       * used SEQ_START_TOKEN instead of ((void *)1)
       * merged fix from SGI PV 990526 "sunrpc: use dprintk instead of
         printk in svc_pool_stats_*()" by Harshula Jayasuriya.
       * merged fix from SGI PV 964001 "Crash reading pool_stats before
         nfsds are started".
      
      Signed-off-by: default avatarGreg Banks <gnb@sgi.com>
      Signed-off-by: default avatarHarshula Jayasuriya <harshula@sgi.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      03cf6c9f
    • Greg Banks's avatar
      knfsd: remove the nfsd thread busy histogram · 8bbfa9f3
      Greg Banks authored
      Stop gathering the data that feeds the 'th' line in /proc/net/rpc/nfsd
      because the questionable data provided is not worth the scalability
      impact of calculating it.  Instead, always report zeroes.  The current
      approach suffers from three major issues:
      
      1. update_thread_usage() increments buckets by call service
         time or call arrival time...in jiffies.  On lightly loaded
         machines, call service times are usually < 1 jiffy; on
         heavily loaded machines call arrival times will be << 1 jiffy.
         So a large portion of the updates to the buckets are rounded
         down to zero, and the histogram is undercounting.
      
      2. As seen previously on the nfs mailing list, the format in which
         the histogram is presented is cryptic, difficult to explain,
         and difficult to use.
      
      3. Updating the histogram requires taking a global spinlock and
         dirtying the global variables nfsd_last_call, nfsd_busy, and
         nfsdstats *twice* on every RPC call, which is a significant
         scaling limitation.
      
      Testing on a 4 CPU 4 NIC Altix using 4 IRIX clients each doing
      1K streaming reads at full line rate, shows the stats update code
      (inlined into nfsd()) takes about 1.7% of each CPU.  This patch drops
      the contribution from nfsd() into the profile noise.
      
      This patch is a forward-ported version of knfsd-remove-nfsd-threadstats
      which has been shipping in the SGI "Enhanced NFS" product since 2006.
      In that time, exactly one customer has noticed that the threadstats
      were missing.  It has been previously posted:
      
      http://article.gmane.org/gmane.linux.nfs/10376
      
      
      
      and more recently requested to be posted again.
      
      Signed-off-by: default avatarGreg Banks <gnb@sgi.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      8bbfa9f3
  15. Oct 22, 2008
    • Chuck Lever's avatar
      NFSD: Fix BUG during NFSD shutdown processing · 1cd9cd16
      Chuck Lever authored
      
      The Linux NFS server can be started via a user-space write to
      /proc/fs/nfs/threads or to /proc/fs/nfs/portlist.  In the first case,
      all default listeners are started (both UDP and TCP).  In the second,
      a listener is started only for one specified transport.
      
      The NFS server has to make sure lockd stays up until the last listener
      transport goes away.  To support both start-up interfaces, it should
      do one lockd_up() for each NFSD listener.
      
      The nfsd_init_socks() function used to do one lockd_up() call for each
      svc_create_xprt().  Recently commit
      26a41409 mistakenly changed
      nfsd_init_socks() to do only one lockd_up() call even though it still
      does two svc_create_xprt() calls.
      
      The end result is a lockd_down() BUG during NFSD shutdown processing
      because nfsd_last_threads() does a lockd_down() call for each entry
      on the sv_permsocks list, but the start-up code doesn't do a matching
      number of lockd_up() calls.
      
      Add a second lockd_up() in nfsd_init_socks() to make sure the number
      of lockd_up() calls matches the number of entries on the NFS servers's
      sv_permsocks list.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      1cd9cd16
  16. Oct 04, 2008
  17. Sep 29, 2008
  18. Jun 30, 2008
    • Jeff Layton's avatar
      nfsd: treat all shutdown signals as equivalent · 100766f8
      Jeff Layton authored
      
      knfsd currently uses 2 signal masks when processing requests. A "loose"
      mask (SHUTDOWN_SIGS) that it uses when receiving network requests, and
      then a more "strict" mask (ALLOWED_SIGS, which is just SIGKILL) that it
      allows when doing the actual operation on the local storage.
      
      This is apparently unnecessarily complicated. The underlying filesystem
      should be able to sanely handle a signal in the middle of an operation.
      This patch removes the signal mask handling from knfsd altogether. When
      knfsd is started as a kthread, all signals are ignored. It then allows
      all of the signals in SHUTDOWN_SIGS. There's no need to set the mask
      as well.
      
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      100766f8
  19. Jun 23, 2008
  20. Apr 23, 2008
  21. Feb 01, 2008
  22. Oct 09, 2007
  23. Jul 17, 2007
  24. May 21, 2007
    • Alexey Dobriyan's avatar
      Detach sched.h from mm.h · e8edc6e0
      Alexey Dobriyan authored
      
      First thing mm.h does is including sched.h solely for can_do_mlock() inline
      function which has "current" dereference inside. By dealing with can_do_mlock()
      mm.h can be detached from sched.h which is good. See below, why.
      
      This patch
      a) removes unconditional inclusion of sched.h from mm.h
      b) makes can_do_mlock() normal function in mm/mlock.c
      c) exports can_do_mlock() to not break compilation
      d) adds sched.h inclusions back to files that were getting it indirectly.
      e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
         getting them indirectly
      
      Net result is:
      a) mm.h users would get less code to open, read, preprocess, parse, ... if
         they don't need sched.h
      b) sched.h stops being dependency for significant number of files:
         on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
         after patch it's only 3744 (-8.3%).
      
      Cross-compile tested on
      
      	all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
      	alpha alpha-up
      	arm
      	i386 i386-up i386-defconfig i386-allnoconfig
      	ia64 ia64-up
      	m68k
      	mips
      	parisc parisc-up
      	powerpc powerpc-up
      	s390 s390-up
      	sparc sparc-up
      	sparc64 sparc64-up
      	um-x86_64
      	x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
      
      as well as my two usual configs.
      
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e8edc6e0
Loading