1. 08 7月, 2008 2 次提交
    • B
      nfsd: take file and mnt write in nfs4_upgrade_open · e518f056
      Benny Halevy 提交于
      testing with newpynfs revealed this warning:
      Jul  3 07:32:50 buml kernel: writeable file with no mnt_want_write()
      Jul  3 07:32:50 buml kernel: ------------[ cut here ]------------
      Jul  3 07:32:50 buml kernel: WARNING: at /usr0/export/dev/bhalevy/git/linux-pnfs-bh-nfs41/include/linux/fs.h:855 drop_file_write_access+0x6b/0x7e()
      Jul  3 07:32:50 buml kernel: Modules linked in: nfsd auth_rpcgss exportfs nfs lockd nfs_acl sunrpc
      Jul  3 07:32:50 buml kernel: Call Trace:
      Jul  3 07:32:50 buml kernel: 6eaadc88:  [<6002f471>] warn_on_slowpath+0x54/0x8e
      Jul  3 07:32:50 buml kernel: 6eaadcc8:  [<601b790d>] printk+0xa0/0x793
      Jul  3 07:32:50 buml kernel: 6eaadd38:  [<601b6205>] __mutex_lock_slowpath+0x1db/0x1ea
      Jul  3 07:32:50 buml kernel: 6eaadd68:  [<7107d4d5>] nfs4_preprocess_seqid_op+0x2a6/0x31c [nfsd]
      Jul  3 07:32:50 buml kernel: 6eaadda8:  [<60078dc9>] drop_file_write_access+0x6b/0x7e
      Jul  3 07:32:50 buml kernel: 6eaaddc8:  [<710804e4>] nfsd4_open_downgrade+0x114/0x1de [nfsd]
      Jul  3 07:32:50 buml kernel: 6eaade08:  [<71076215>] nfsd4_proc_compound+0x1ba/0x2dc [nfsd]
      Jul  3 07:32:50 buml kernel: 6eaade48:  [<71068221>] nfsd_dispatch+0xe5/0x1c2 [nfsd]
      Jul  3 07:32:50 buml kernel: 6eaade88:  [<71312f81>] svc_process+0x3fd/0x714 [sunrpc]
      Jul  3 07:32:50 buml kernel: 6eaadea8:  [<60039a81>] kernel_sigprocmask+0xf3/0x100
      Jul  3 07:32:50 buml kernel: 6eaadee8:  [<7106874b>] nfsd+0x182/0x29b [nfsd]
      Jul  3 07:32:50 buml kernel: 6eaadf48:  [<60021cc9>] run_kernel_thread+0x41/0x4a
      Jul  3 07:32:50 buml kernel: 6eaadf58:  [<710685c9>] nfsd+0x0/0x29b [nfsd]
      Jul  3 07:32:50 buml kernel: 6eaadf98:  [<60021cb0>] run_kernel_thread+0x28/0x4a
      Jul  3 07:32:50 buml kernel: 6eaadfc8:  [<60013829>] new_thread_handler+0x72/0x9c
      Jul  3 07:32:50 buml kernel:
      Jul  3 07:32:50 buml kernel: ---[ end trace 2426dd7cb2fba3bf ]---
      
      Bruce Fields suggested this (Thanks!):
      maybe we need to be doing a mnt_want_write on open_upgrade and mnt_put_write on downgrade?
      
      This patch adds a call to mnt_want_write and file_take_write (which is
      doing the actual work).
      
      The counter-calls mnt_drop_write a file_release_write are now being properly
      called by drop_file_write_access in the exact path printed by the warning
      above.
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      e518f056
    • J
      nfsd: document open share bit tracking · 4f83aa30
      J. Bruce Fields 提交于
      It's not immediately obvious from the code why we're doing this.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      Cc: Benny Halevy <bhalevy@panasas.com>
      4f83aa30
  2. 05 7月, 2008 1 次提交
  3. 03 7月, 2008 5 次提交
  4. 02 7月, 2008 1 次提交
  5. 01 7月, 2008 2 次提交
    • J
      nfsd: treat all shutdown signals as equivalent · 100766f8
      Jeff Layton 提交于
      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: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      100766f8
    • N
      nfsd: fix spurious EACCESS in reconnect_path() · 496d6c32
      Neil Brown 提交于
      Thanks to Frank Van Maarseveen for the original problem report: "A
      privileged process on an NFS client which drops privileges after using
      them to change the current working directory, will experience incorrect
      EACCES after an NFS server reboot. This problem can also occur after
      memory pressure on the server, particularly when the client side is
      quiet for some time."
      
      This occurs because the filehandle points to a directory whose parents
      are no longer in the dentry cache, and we're attempting to reconnect the
      directory to its parents without adequate permissions to perform lookups
      in the parent directories.
      
      We can therefore fix the problem by acquiring the necessary capabilities
      before attempting the reconnection.  We do this only in the
      no_subtree_check case, since the documented behavior of the
      subtree_check export option requires the server to check that the user
      has lookup permissions on all parents.
      
      The subtree_check case still has a problem, since reconnect_path()
      unnecessarily requires both read and lookup permissions on all parent
      directories.  However, a fix in that case would be more delicate, and
      use of subtree_check is already discouraged for other reasons.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Cc: Frank van Maarseveen <frankvm@frankvm.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      496d6c32
  6. 24 6月, 2008 10 次提交
  7. 19 5月, 2008 2 次提交
  8. 30 4月, 2008 1 次提交
  9. 29 4月, 2008 1 次提交
  10. 26 4月, 2008 4 次提交
    • J
      nfsd: don't allow setting ctime over v4 · e36cd4a2
      J. Bruce Fields 提交于
      Presumably this is left over from earlier drafts of v4, which listed
      TIME_METADATA as writeable.  It's read-only in rfc 3530, and shouldn't
      be modifiable anyway.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      e36cd4a2
    • J
      locks: don't call ->copy_lock methods on return of conflicting locks · 1a747ee0
      J. Bruce Fields 提交于
      The file_lock structure is used both as a heavy-weight representation of
      an active lock, with pointers to reference-counted structures, etc., and
      as a simple container for parameters that describe a file lock.
      
      The conflicting lock returned from __posix_lock_file is an example of
      the latter; so don't call the filesystem or lock manager callbacks when
      copying to it.  This also saves the need for an unnecessary
      locks_init_lock in the nfsv4 server.
      
      Thanks to Trond for pointing out the error.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      1a747ee0
    • W
      lockd: unlock lockd locks held for a certain filesystem · 17efa372
      Wendy Cheng 提交于
      Add /proc/fs/nfsd/unlock_filesystem, which allows e.g.:
      
      shell> echo /mnt/sfs1 > /proc/fs/nfsd/unlock_filesystem
      
      so that a filesystem can be unmounted before allowing a peer nfsd to
      take over nfs service for the filesystem.
      Signed-off-by: NS. Wendy Cheng <wcheng@redhat.com>
      Cc: Lon Hohberger  <lhh@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      
       fs/lockd/svcsubs.c          |   66 +++++++++++++++++++++++++++++++++++++++-----
       fs/nfsd/nfsctl.c            |   65 +++++++++++++++++++++++++++++++++++++++++++
       include/linux/lockd/lockd.h |    7 ++++
       3 files changed, 131 insertions(+), 7 deletions(-)
      17efa372
    • W
      lockd: unlock lockd locks associated with a given server ip · 4373ea84
      Wendy Cheng 提交于
      For high-availability NFS service, we generally need to be able to drop
      file locks held on the exported filesystem before moving clients to a
      new server.  Currently the only way to do that is by shutting down lockd
      entirely, which is often undesireable (for example, if you want to
      continue exporting other filesystems).
      
      This patch allows the administrator to release all locks held by clients
      accessing the client through a given server ip address, by echoing that
      address to a new file, /proc/fs/nfsd/unlock_ip, as in:
      
      shell> echo 10.1.1.2 > /proc/fs/nfsd/unlock_ip
      
      The expected sequence of events can be:
      1. Tear down the IP address
      2. Unexport the path
      3. Write IP to /proc/fs/nfsd/unlock_ip to unlock files
      4. Signal peer to begin take-over.
      
      For now we only support IPv4 addresses and NFSv2/v3 (NFSv4 locks are not
      affected).
      
      Also, if unmounting the filesystem is required, we assume at step 3 that
      clients using the given server ip are the only clients holding locks on
      the given filesystem; otherwise, an additional patch is required to
      allow revoking all locks held by lockd on a given filesystem.
      Signed-off-by: NS. Wendy Cheng <wcheng@redhat.com>
      Cc: Lon Hohberger  <lhh@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      
       fs/lockd/svcsubs.c          |   66 +++++++++++++++++++++++++++++++++++++++-----
       fs/nfsd/nfsctl.c            |   65 +++++++++++++++++++++++++++++++++++++++++++
       include/linux/lockd/lockd.h |    7 ++++
       3 files changed, 131 insertions(+), 7 deletions(-)
      4373ea84
  11. 24 4月, 2008 11 次提交
    • 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
    • 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: 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
    • 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
    • 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
    • C
      NFSD: Remove NFSD_TCP kernel build option · 5ea0dd61
      Chuck Lever 提交于
      Likewise, distros usually leave CONFIG_NFSD_TCP enabled.
      
      TCP support in the Linux NFS server is stable enough that we can leave it
      on always.  CONFIG_NFSD_TCP adds about 10 lines of code, and defaults to
      "Y" anyway.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      5ea0dd61
    • J
      nfsd: clarify readdir/mountpoint-crossing code · c0ce6ec8
      J. Bruce Fields 提交于
      The code here is difficult to understand; attempt to clarify somewhat by
      pulling out one of the more mystifying conditionals into a separate
      function.
      
      While we're here, also add lease_time to the list of attributes that we
      don't really need to cross a mountpoint to fetch.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      Cc: Peter Staubach <staubach@redhat.com>
      c0ce6ec8
    • J
      nfsd4: kill unnecessary check in preprocess_stateid_op · 6a85fa3a
      J. Bruce Fields 提交于
      This condition is always true.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      6a85fa3a