1. 31 3月, 2014 2 次提交
    • J
      locks: clean up comment typo · 46dad760
      Jeff Layton 提交于
      Acked-by: NJ. Bruce Fields <bfields@fieldses.org>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      46dad760
    • J
      locks: close potential race between setlease and open · 24cbe784
      Jeff Layton 提交于
      As Al Viro points out, there is an unlikely, but possible race between
      opening a file and setting a lease on it. generic_add_lease is done with
      the i_lock held, but the inode->i_flock check in break_lease is
      lockless. It's possible for another task doing an open to do the entire
      pathwalk and call break_lease between the point where generic_add_lease
      checks for a conflicting open and adds the lease to the list. If this
      occurs, we can end up with a lease set on the file with a conflicting
      open.
      
      To guard against that, check again for a conflicting open after adding
      the lease to the i_flock list. If the above race occurs, then we can
      simply unwind the lease setting and return -EAGAIN.
      
      Because we take dentry references and acquire write access on the file
      before calling break_lease, we know that if the i_flock list is empty
      when the open caller goes to check it then the necessary refcounts have
      already been incremented. Thus the additional check for a conflicting
      open will see that there is one and the setlease call will fail.
      
      Cc: Bruce Fields <bfields@fieldses.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Reported-by: NAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@fieldses.org>
      24cbe784
  2. 13 11月, 2013 1 次提交
  3. 09 11月, 2013 2 次提交
  4. 25 10月, 2013 1 次提交
  5. 08 7月, 2013 1 次提交
  6. 05 7月, 2013 1 次提交
  7. 29 6月, 2013 12 次提交
  8. 23 2月, 2013 1 次提交
  9. 27 9月, 2012 1 次提交
  10. 21 8月, 2012 1 次提交
    • J
      vfs: don't treat fl_type as a bitmap · 0ee5c6d6
      Jeff Layton 提交于
      The rules for fl_type are rather convoluted. Typically it's treated as
      holding specific values, except in the case of LOCK_MAND, in which case
      it can be or'ed with LOCK_READ|LOCK_WRITE.
      
      On some arches F_WRLCK == 2 and F_UNLCK == 3, so and'ing with F_WRLCK will also
      catch the F_UNLCK case. It's unlikely in either case here that we'd ever see
      F_UNLCK since those shouldn't end up on any lists, but it's still best to be
      consistent.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      0ee5c6d6
  11. 02 8月, 2012 1 次提交
  12. 28 7月, 2012 1 次提交
  13. 27 7月, 2012 1 次提交
  14. 24 7月, 2012 1 次提交
  15. 14 7月, 2012 1 次提交
  16. 30 5月, 2012 1 次提交
  17. 03 5月, 2012 1 次提交
  18. 02 4月, 2012 1 次提交
  19. 27 12月, 2011 1 次提交
    • L
      vfs: fix handling of lock allocation failure in lease-break case · 6d4b9e38
      Linus Torvalds 提交于
      Bruce Fields notes that commit 778fc546 ("locks: fix tracking of
      inprogress lease breaks") introduced a possible error pointer
      dereference on failure to allocate memory.  locks_conflict() will
      dereference the passed-in new lease lock structure that may be an error pointer.
      
      This means an open (without O_NONBLOCK set) on a file with a lease
      applied (generally only done when Samba or nfsd (with v4) is running)
      could crash if a kmalloc() fails.
      
      So instead of playing games with IS_ERROR() all over the place, just
      check the allocation failure early.  That makes the code more
      straightforward, and avoids this possible bad pointer dereference.
      Based-on-patch-by: NJ. Bruce Fields <bfields@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6d4b9e38
  20. 28 9月, 2011 1 次提交
    • P
      doc: fix broken references · 395cf969
      Paul Bolle 提交于
      There are numerous broken references to Documentation files (in other
      Documentation files, in comments, etc.). These broken references are
      caused by typo's in the references, and by renames or removals of the
      Documentation files. Some broken references are simply odd.
      
      Fix these broken references, sometimes by dropping the irrelevant text
      they were part of.
      Signed-off-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      395cf969
  21. 21 9月, 2011 1 次提交
  22. 20 8月, 2011 4 次提交
    • J
      locks: setlease cleanup · c1f24ef4
      J. Bruce Fields 提交于
      There's an incorrect comment here.  Also clean up the logic: the
      "rdlease" and "wrlease" locals are confusingly named, and don't really
      add anything since we can make a decision as soon as we hit one of these
      cases.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      c1f24ef4
    • J
      locks: fix tracking of inprogress lease breaks · 778fc546
      J. Bruce Fields 提交于
      We currently use a bit in fl_flags to record whether a lease is being
      broken, and set fl_type to the type (RDLCK or UNLCK) that it will
      eventually have.  This means that once the lease break starts, we forget
      what the lease's type *used* to be.  Breaking a read lease will then
      result in blocking read opens, even though there's no conflict--because
      the lease type is now F_UNLCK and we can no longer tell whether it was
      previously a read or write lease.
      
      So, instead keep fl_type as the original type (the type which we
      enforce), and keep track of whether we're unlocking or merely
      downgrading by replacing the single FL_INPROGRESS flag by
      FL_UNLOCK_PENDING and FL_DOWNGRADE_PENDING flags.
      
      To get this right we also need to track separate downgrade and break
      times, to handle the case where a write-leased file gets conflicting
      opens first for read, then later for write.
      
      (I first considered just eliminating the downgrade behavior
      completely--nfsv4 doesn't need it, and nobody as far as I can tell
      actually uses it currently--but Jeremy Allison tells me that Windows
      oplocks do behave this way, so Samba will probably use this some day.)
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      778fc546
    • J
      locks: move F_INPROGRESS from fl_type to fl_flags field · 710b7216
      J. Bruce Fields 提交于
      F_INPROGRESS isn't exposed to userspace.  To me it makes more sense in
      fl_flags....
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      710b7216
    • J
      locks: minor lease cleanup · ab83fa4b
      J. Bruce Fields 提交于
      Use a helper function, to simplify upcoming changes.
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      ab83fa4b
  23. 21 7月, 2011 1 次提交
    • J
      locks: rename lock-manager ops · 8fb47a4f
      J. Bruce Fields 提交于
      Both the filesystem and the lock manager can associate operations with a
      lock.  Confusingly, one of them (fl_release_private) actually has the
      same name in both operation structures.
      
      It would save some confusion to give the lock-manager ops different
      names.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      8fb47a4f
  24. 16 7月, 2011 1 次提交