1. 25 Jul, 2008 1 commit
    • Miklos Szeredi's avatar
      locks: add special return value for asynchronous locks · bde74e4b
      Miklos Szeredi authored
      Use a special error value FILE_LOCK_DEFERRED to mean that a locking
      operation returned asynchronously.  This is returned by
        posix_lock_file() for sleeping locks to mean that the lock has been
        queued on the block list, and will be woken up when it might become
        available and needs to be retried (either fl_lmops->fl_notify() is
        called or fl_wait is woken up).
        f_op->lock() to mean either the above, or that the filesystem will
        call back with fl_lmops->fl_grant() when the result of the locking
        operation is known.  The filesystem can do this for sleeping as well
        as non-sleeping locks.
      This is to make sure, that return values of -EAGAIN and -EINPROGRESS by
      filesystems are not mistaken to mean an asynchronous locking.
      This also makes error handling in fs/locks.c and lockd/svclock.c slightly
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: David Teigland <teigland@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  2. 15 Jul, 2008 5 commits
  3. 30 Apr, 2008 1 commit
  4. 25 Apr, 2008 1 commit
    • J. Bruce Fields's avatar
      locks: don't call ->copy_lock methods on return of conflicting locks · 1a747ee0
      J. Bruce Fields authored
      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: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
  5. 23 Apr, 2008 2 commits
    • J. Bruce Fields's avatar
      lockd: Fix stale nlmsvc_unlink_block comment · 3c61eecb
      J. Bruce Fields authored
      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: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    • Jeff Layton's avatar
      NLM: Convert lockd to use kthreads · d751a7cd
      Jeff Layton authored
      Have lockd_up start lockd using kthread_run. With this change,
      lockd_down now blocks until lockd actually exits, so there's no longer
      need for the waitqueue code at the end of lockd_down. This also means
      that only one lockd can be running at a time which simplifies the code
      within lockd's main loop.
      This also adds a check for kthread_should_stop in the main loop of
      nlmsvc_retry_blocked and after that function returns. There's no sense
      continuing to retry blocks if lockd is coming down anyway.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
  6. 10 Feb, 2008 2 commits
  7. 01 Feb, 2008 2 commits
  8. 09 Oct, 2007 1 commit
  9. 26 Sep, 2007 1 commit
  10. 26 Jul, 2007 1 commit
  11. 07 May, 2007 6 commits
    • Marc Eshel's avatar
      lockd: add code to handle deferred lock requests · 1a8322b2
      Marc Eshel authored
      Rewrite nlmsvc_lock() to use the asynchronous interface.
      As with testlock, we answer nlm requests in nlmsvc_lock by first looking up
      the block and then using the results we find in the block if B_QUEUED is
      set, and calling vfs_lock_file() otherwise.
      If this a new lock request and we get -EINPROGRESS return on a non-blocking
      request then we defer the request.
      Also modify nlmsvc_unlock() to call the filesystem method if appropriate.
      Signed-off-by: default avatarMarc Eshel <eshel@almaden.ibm.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    • Marc Eshel's avatar
      lockd: always preallocate block in nlmsvc_lock() · f8120480
      Marc Eshel authored
      Normally we could skip ever having to allocate a block in the case where
      the client asks for a non-blocking lock, or asks for a blocking lock that
      succeeds immediately.
      However we're going to want to always look up a block first in order to
      check whether we're revisiting a deferred lock call, and to be prepared to
      handle the case where the filesystem returns -EINPROGRESS--in that case we
      want to make sure the lock we've given the filesystem is the one embedded
      in the block that we'll use to track the deferred request.
      Signed-off-by: default avatarMarc Eshel <eshel@almaden.ibm.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    • Marc Eshel's avatar
      lockd: handle test_lock deferrals · 5ea0d750
      Marc Eshel authored
      Rewrite nlmsvc_testlock() to use the new asynchronous interface: instead of
      immediately doing a posix_test_lock(), we first look for a matching block.
      If the subsequent test_lock returns anything other than -EINPROGRESS, we
      then remove the block we've found and return the results.
      If it returns -EINPROGRESS, then we defer the lock request.
      In the case where the block we find in the first step has B_QUEUED set,
      we bypass the vfs_test_lock entirely, instead using the block to decide how
      to respond:
      	with nlm_lck_denied if B_TIMED_OUT is set.
      	with nlm_granted if B_GOT_CALLBACK is set.
      	by dropping if neither B_TIMED_OUT nor B_GOT_CALLBACK is set
      Signed-off-by: default avatarMarc Eshel <eshel@almaden.ibm.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    • Marc Eshel's avatar
      lockd: pass cookie in nlmsvc_testlock · 85f3f1b3
      Marc Eshel authored
      Change NLM internal interface to pass more information for test lock; we
      need this to make sure the cookie information is pushed down to the place
      where we do request deferral, which is handled for testlock by the
      following patch.
      Signed-off-by: default avatarMarc Eshel <eshel@almaden.ibm.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    • Marc Eshel's avatar
      lockd: handle fl_grant callbacks · 0e4ac9d9
      Marc Eshel authored
      Add code to handle file system callback when the lock is finally granted.
      Signed-off-by: default avatarMarc Eshel <eshel@almaden.ibm.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    • Marc Eshel's avatar
      lockd: save lock state on deferral · 2b36f412
      Marc Eshel authored
      We need to keep some state for a pending asynchronous lock request, so this
      patch adds that state to struct nlm_block.
      This also adds a function which defers the request, by calling
      rqstp->rq_chandle.defer and storing the resulting deferred request in a
      nlm_block structure which we insert into lockd's global block list.  That
      new function isn't called yet, so it's dead code until a later patch.
      Signed-off-by: default avatarMarc Eshel <eshel@almaden.ibm.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
  12. 06 May, 2007 2 commits
  13. 03 Feb, 2007 1 commit
  14. 13 Dec, 2006 1 commit
  15. 08 Dec, 2006 1 commit
  16. 20 Oct, 2006 1 commit
  17. 04 Oct, 2006 5 commits
  18. 02 Oct, 2006 1 commit
  19. 03 Aug, 2006 1 commit
  20. 30 Jun, 2006 1 commit
  21. 19 Apr, 2006 1 commit
  22. 21 Mar, 2006 1 commit
  23. 20 Mar, 2006 1 commit