1. 28 1月, 2009 1 次提交
    • J
      nfsd: only set file_lock.fl_lmops in nfsd4_lockt if a stateowner is found · fa82a491
      Jeff Layton 提交于
      nfsd4_lockt does a search for a lockstateowner when building the lock
      struct to test. If one is found, it'll set fl_owner to it. Regardless of
      whether that happens, it'll also set fl_lmops. Given that this lock is
      basically a "lightweight" lock that's just used for checking conflicts,
      setting fl_lmops is probably not appropriate for it.
      
      This behavior exposed a bug in DLM's GETLK implementation where it
      wasn't clearing out the fields in the file_lock before filling in
      conflicting lock info. While we were able to fix this in DLM, it
      still seems pointless and dangerous to set the fl_lmops this way
      when we may have a NULL lockstateowner.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@pig.fieldses.org>
      fa82a491
  2. 08 1月, 2009 2 次提交
  3. 07 1月, 2009 1 次提交
  4. 24 12月, 2008 2 次提交
  5. 25 11月, 2008 1 次提交
  6. 31 10月, 2008 1 次提交
  7. 23 10月, 2008 1 次提交
  8. 04 10月, 2008 1 次提交
    • J
      nfsd: common grace period control · af558e33
      J. Bruce Fields 提交于
      Rewrite grace period code to unify management of grace period across
      lockd and nfsd.  The current code has lockd and nfsd cooperate to
      compute a grace period which is satisfactory to them both, and then
      individually enforce it.  This creates a slight race condition, since
      the enforcement is not coordinated.  It's also more complicated than
      necessary.
      
      Here instead we have lockd and nfsd each inform common code when they
      enter the grace period, and when they're ready to leave the grace
      period, and allow normal locking only after both of them are ready to
      leave.
      
      We also expect the locks_start_grace()/locks_end_grace() interface here
      to be simpler to build on for future cluster/high-availability work,
      which may require (for example) putting individual filesystems into
      grace, or enforcing grace periods across multiple cluster nodes.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      af558e33
  9. 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
  10. 24 6月, 2008 2 次提交
    • M
      nfsd: rename MAY_ flags · 8837abca
      Miklos Szeredi 提交于
      Rename nfsd_permission() specific MAY_* flags to NFSD_MAY_* to make it
      clear, that these are not used outside nfsd, and to avoid name and
      number space conflicts with the VFS.
      
      [comment from hch: rename MAY_READ, MAY_WRITE and MAY_EXEC as well]
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      8837abca
    • J
      knfsd: clean up nfsd filesystem interfaces · 3dd98a3b
      Jeff Layton 提交于
      Several of the nfsd filesystem interfaces allow changes to parameters
      that don't have any effect on a running nfsd service. They are only ever
      checked when nfsd is started. This patch fixes it so that changes to
      those procfiles return -EBUSY if nfsd is already running to make it
      clear that changes on the fly don't work.
      
      The patch should also close some relatively harmless races between
      changing the info in those interfaces and starting nfsd, since these
      variables are being moved under the protection of the nfsd_mutex.
      
      Finally, the nfsv4recoverydir file always returns -EINVAL if read. This
      patch fixes it to return the recoverydir path as expected.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      3dd98a3b
  11. 19 5月, 2008 1 次提交
  12. 26 4月, 2008 1 次提交
    • 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
  13. 24 4月, 2008 5 次提交
  14. 19 4月, 2008 1 次提交
  15. 15 2月, 2008 2 次提交
  16. 02 2月, 2008 12 次提交
  17. 10 10月, 2007 4 次提交
    • P
      Cleanup macros for distinguishing mandatory locks · a16877ca
      Pavel Emelyanov 提交于
      The combination of S_ISGID bit set and S_IXGRP bit unset is used to mark the
      inode as "mandatory lockable" and there's a macro for this check called
      MANDATORY_LOCK(inode).  However, fs/locks.c and some filesystems still perform
      the explicit i_mode checking.  Besides, Andrew pointed out, that this macro is
      buggy itself, as it dereferences the inode arg twice.
      
      Convert this macro into static inline function and switch its users to it,
      making the code shorter and more readable.
      
      The __mandatory_lock() helper is to be used in places where the IS_MANDLOCK()
      for superblock is already known to be true.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Ron Minnich <rminnich@sandia.gov>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      a16877ca
    • J
      knfsd: nfsv4 delegation recall should take reference on client · cfdcad4d
      J. Bruce Fields 提交于
      It's not enough to take a reference on the delegation object itself; we
      need to ensure that the rpc_client won't go away just as we're about to
      make an rpc call.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      cfdcad4d
    • J
      knfsd: don't shutdown callbacks until nfsv4 client is freed · 1b1a9b31
      J. Bruce Fields 提交于
      If a callback still holds a reference on the client, then it may be
      about to perform an rpc call, so it isn't safe to call rpc_shutdown().
      (Though rpc_shutdown() does wait for any outstanding rpc's, it can't
      know if a new rpc is about to be issued with that client.)
      
      So, wait to shutdown the rpc_client until the reference count on the
      client has gone to zero.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      1b1a9b31
    • J
      knfsd: let nfsd manage timing out its own leases · 0272e1fd
      J. Bruce Fields 提交于
      Currently there's a race that can cause an oops in generic_setlease.
      
      (In detail: nfsd, when it removes a lease, does so by calling
      vfs_setlease() with F_UNLCK and a pointer to the fl_flock field, which
      in turn points to nfsd's existing lease; but the first thing the
      setlease code does is call time_out_leases().  If the lease happens to
      already be beyond the lease break time, that will free the lease and (in
      nfsd's release_private callback) set fl_flock to NULL, leading to a NULL
      deference soon after in vfs_setlease().)
      
      There are probably other things to fix here too, but it seems inherently
      racy to allow either locks.c or nfsd to time out this lease.  Instead
      just set the fl_break_time to 0 (preventing locks.c from ever timing out
      this lock) and leave it up to nfsd's laundromat thread to deal with it.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      0272e1fd