1. 28 4月, 2008 1 次提交
  2. 26 4月, 2008 11 次提交
  3. 25 4月, 2008 8 次提交
  4. 24 4月, 2008 20 次提交
    • J
      knfsd: clear both setuid and setgid whenever a chown is done · ca456252
      Jeff Layton 提交于
      Currently, knfsd only clears the setuid bit if the owner of a file is
      changed on a SETATTR call, and only clears the setgid bit if the group
      is changed. POSIX says this in the spec for chown():
      
          "If the specified file is a regular file, one or more of the
           S_IXUSR, S_IXGRP, or S_IXOTH bits of the file mode are set, and the
           process does not have appropriate privileges, the set-user-ID
           (S_ISUID) and set-group-ID (S_ISGID) bits of the file mode shall
           be cleared upon successful return from chown()."
      
      If I'm reading this correctly, then knfsd is doing this wrong. It should
      be clearing both the setuid and setgid bit on any SETATTR that changes
      the uid or gid. This wasn't really as noticable before, but now that the
      ATTR_KILL_S*ID bits are a no-op for the NFS client, it's more evident.
      
      This patch corrects the nfsd_setattr logic so that this occurs. It also
      does a bit of cleanup to the function.
      
      There is also one small behavioral change. If a SETATTR call comes in
      that changes the uid/gid and the mode, then we now only clear the setgid
      bit if the group execute bit isn't set. The setgid bit without a group
      execute bit signifies mandatory locking and we likely don't want to
      clear the bit in that case. Since there is no call in POSIX that should
      generate a SETATTR call like this, then this should rarely happen, but
      it's worth noting.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      ca456252
    • J
      knfsd: get rid of imode variable in nfsd_setattr · dee3209d
      Jeff Layton 提交于
      ...it's not really needed.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      dee3209d
    • J
      NLM: don't let lockd exit on unexpected svc_recv errors (try #2) · f97c650d
      Jeff Layton 提交于
      When svc_recv returns an unexpected error, lockd will print a warning
      and exit. This problematic for several reasons. In particular, it will
      cause the reference counts for the thread to be wrong, and can lead to a
      potential BUG() call.
      
      Rather than exiting on error from svc_recv, have the thread do a 1s
      sleep and then retry the loop. This is unlikely to cause any harm, and
      if the error turns out to be something temporary then it may be able to
      recover.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      f97c650d
    • J
      NFS: don't let nfs_callback_svc exit on unexpected svc_recv errors (try #2) · 06e02d66
      Jeff Layton 提交于
      When svc_recv returns an unexpected error, nfs_callback_svc will print a
      warning and exit. This problematic for several reasons. In particular,
      it will cause the reference counts for the thread to be wrong, and no
      new thread will be started until all nfs4 mounts are unmounted.
      
      Rather than exiting on error from svc_recv, have the thread do a 1s
      sleep and then retry the loop. This is unlikely to cause any harm, and
      if the error turns out to be something temporary then it may be able to
      recover.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      06e02d66
    • O
      nfsd: use static memory for callback program and stats · ff7d9756
      Olga Kornievskaia 提交于
      There's no need to dynamically allocate this memory, and doing so may
      create the possibility of races on shutdown of the rpc client.  (We've
      witnessed it only after adding rpcsec_gss support to the server, after
      which the rpc code can send destroys calls that expect to still be able
      to access the rpc_stats structure after it has been destroyed.)
      
      Such races are in theory possible if the module containing this "static"
      memory is removed very quickly after an rpc client is destroyed, but
      we haven't seen that happen.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      ff7d9756
    • J
      nfsd: fix comment · e1ba1ab7
      J. Bruce Fields 提交于
      Obvious comment nit.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      e1ba1ab7
    • J
      lockd: Fix stale nlmsvc_unlink_block comment · 3c61eecb
      J. Bruce Fields 提交于
      As of 5996a298 ("NLM: don't unlock on
      cancel requests") we no longer unlock in this case, so the comment is no
      longer accurate.
      
      Thanks to Stuart Friedberg for pointing out the inconsistency.
      
      Cc: Stuart Friedberg <sfriedberg@hp.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      3c61eecb
    • C
      NFSD: Remove NFSv4 dependency on NFSv3 · 1a448fdb
      Chuck Lever 提交于
      Clean up: Because NFSD_V4 "depends on" NFSD_V3, it appears as a child of
      the NFSD_V3 menu entry, and is not visible if NFSD_V3 is unselected.
      
      Replace the dependency on NFSD_V3 with a "select NFSD_V3".  This makes
      NFSD_V4 look and work just like NFS_V3, while ensuring that NFSD_V3 is
      enabled if NFSD_V4 is.
      
      Sam Ravnborg adds:
      
      "This use of select is questionable. In general it is bad to select
      a symbol with dependencies.
      
      In this case the dependencies of NFSD_V3 are duplicated for NFSD_V4
      so we will not se erratic configurations but do you remember to
      update NFSD_V4 when you add a depends on NFSD_V3?
      
      But I see no other clean way to do it right now."
      
      Later he said:
      
      "My comment was more to say we have things to address in kconfig.
      This is abuse in the acceptable range."
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      1a448fdb
    • C
      SUNRPC: Remove PROC_FS dependency · 3329ba05
      Chuck Lever 提交于
      Recently, commit 440bcc59 added a reverse dependency to fs/Kconfig to
      ensure that PROC_FS was enabled if SUNRPC_GSS was enabled.
      
      Apparently this isn't necessary because the auth_gss components under
      net/sunrpc will build correctly even if PROC_FS is disabled, though
      RPCSEC_GSS will not work without /proc.
      
      It also violates the guideline in Documentation/kbuild/kconfig-language.txt
      that states "In general use select only for non-visible symbols (no prompts
      anywhere) and for symbols with no dependencies."
      
      To address these issues, remove the dependency.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      3329ba05
    • C
      NFSD: Use "depends on" for PROC_FS dependency · 6ffd4be6
      Chuck Lever 提交于
      Recently, commit 440bcc59 added a reverse dependency to fs/Kconfig to
      ensure that PROC_FS was enabled if NFSD_V4 was enabled.
      
      There is a guideline in Documentation/kbuild/kconfig-language.txt that
      states "In general use select only for non-visible symbols (no prompts
      anywhere) and for symbols with no dependencies."
      
      A quick grep around other Kconfig files reveals that no entry currently
      uses "select PROC_FS" -- every one uses "depends on".  Thus CONFIG_NFSD_V4
      should use "depends on PROC_FS" as well.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      6ffd4be6
    • J
      nfsd: move most of fh_verify to separate function · 03550fac
      J. Bruce Fields 提交于
      Move the code that actually parses the filehandle and looks up the
      dentry and export to a separate function.  This simplifies the reference
      counting a little and moves fh_verify() a little closer to the kernel
      ideal of small, minimally-indentended functions.  Clean up a few other
      minor style sins along the way.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      Cc: Neil Brown <neilb@suse.de>
      03550fac
    • F
      nfsd: initialize lease type in nfs4_open_delegation() · 9167f501
      Felix Blyakher 提交于
      While lease is correctly checked by supplying the type argument to
      vfs_setlease(), it's stored with fl_type uninitialized. This breaks the
      logic when checking the type of the lease.  The fix is to initialize
      fl_type.
      
      The old code still happened to function correctly since F_RDLCK is zero,
      and we only implement read delegations currently (nor write
      delegations).  But that's no excuse for not fixing this.
      Signed-off-by: NFelix Blyakher <felixb@sgi.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      9167f501
    • J
      NFS: convert nfs4 callback thread to kthread API · a277e33c
      Jeff Layton 提交于
      There's a general push to convert kernel threads to use the (much
      cleaner) kthread API. This patch converts the NFSv4 callback kernel
      thread to the kthread API. In addition to being generally cleaner this
      also removes the dependency on signals when shutting down the thread.
      
      Note that this patch depends on the recent patches to svc_recv() to
      make it check kthread_should_stop() periodically. Those patches are
      in Bruce's tree at the moment and are slated for 2.6.26 along with
      the lockd conversion, so this conversion is probably also appropriate
      for 2.6.26.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Acked-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      a277e33c
    • H
      nfsd: fix sparse warning in vfs.c · 3ba15148
      Harvey Harrison 提交于
      fs/nfsd/vfs.c:991:27: warning: Using plain integer as NULL pointer
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      3ba15148
    • H
      nfsd: fix sparse warnings · a254b246
      Harvey Harrison 提交于
      Add extern to nfsd/nfsd.h
      fs/nfsd/nfssvc.c:146:5: warning: symbol 'nfsd_nrthreads' was not declared. Should it be static?
      fs/nfsd/nfssvc.c:261:5: warning: symbol 'nfsd_nrpools' was not declared. Should it be static?
      fs/nfsd/nfssvc.c:269:5: warning: symbol 'nfsd_get_nrthreads' was not declared. Should it be static?
      fs/nfsd/nfssvc.c:281:5: warning: symbol 'nfsd_set_nrthreads' was not declared. Should it be static?
      fs/nfsd/export.c:1534:23: warning: symbol 'nfs_exports_op' was not declared. Should it be static?
      
      Add include of auth.h
      fs/nfsd/auth.c:27:5: warning: symbol 'nfsd_setuser' was not declared. Should it be static?
      
      Make static, move forward declaration closer to where it's needed.
      fs/nfsd/nfs4state.c:1877:1: warning: symbol 'laundromat_main' was not declared. Should it be static?
      
      Make static, forward declaration was already marked static.
      fs/nfsd/nfs4idmap.c:206:1: warning: symbol 'idtoname_parse' was not declared. Should it be static?
      fs/nfsd/vfs.c:1156:1: warning: symbol 'nfsd_create_setattr' was not declared. Should it be static?
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      a254b246
    • J
      lockd: convert nsm_mutex to a spinlock · d8421202
      J. Bruce Fields 提交于
      There's no reason for a mutex here, except to allow an allocation under
      the lock, which we can avoid with the usual trick of preallocating
      memory for the new object and freeing it if it turns out to be
      unnecessary.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      d8421202
    • J
      lockd: clean up __nsm_find() · a95e56e7
      J. Bruce Fields 提交于
      Use list_for_each_entry().  Also, in keeping with kernel style, make the
      normal case (kzalloc succeeds) unindented and handle the abnormal case
      with a goto.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      a95e56e7
    • J
      lockd: fix race in nlm_release() · 164f98ad
      J. Bruce Fields 提交于
      The sm_count is decremented to zero but left on the nsm_handles list.
      So in the space between decrementing sm_count and acquiring nsm_mutex,
      it is possible for another task to find this nsm_handle, increment the
      use count and then enter nsm_release itself.
      
      Thus there's nothing to prevent the nsm being freed before we acquire
      nsm_mutex here.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      164f98ad
    • H
      lockd: fix sparse warning in svcshare.c · 93245d11
      Harvey Harrison 提交于
      fs/lockd/svcshare.c:74:50: warning: Using plain integer as NULL pointer
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      93245d11
    • A
      make nfsd_create_setattr() static · f2b0dee2
      Adrian Bunk 提交于
      This patch makes the needlessly global nfsd_create_setattr() static.
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      f2b0dee2