1. 03 4月, 2015 1 次提交
  2. 27 3月, 2015 1 次提交
  3. 14 3月, 2015 1 次提交
  4. 05 3月, 2015 1 次提交
    • J
      locks: fix fasync_struct memory leak in lease upgrade/downgrade handling · 0164bf02
      Jeff Layton 提交于
      Commit 8634b51f (locks: convert lease handling to file_lock_context)
      introduced a regression in the handling of lease upgrade/downgrades.
      
      In the event that we already have a lease on a file and are going to
      either upgrade or downgrade it, we skip doing any list insertion or
      deletion and simply re-call lm_setup on the existing lease.
      
      As of commit 8634b51f however, we end up calling lm_setup on the
      lease that was passed in, instead of on the existing lease. This causes
      us to leak the fasync_struct that was allocated in the event that there
      was not already an existing one (as it always appeared that there
      wasn't one).
      
      Fixes: 8634b51f (locks: convert lease handling to file_lock_context)
      Reported-and-Tested-by: NDaniel Wagner <daniel.wagner@bmw-carit.de>
      Signed-off-by: NJeff Layton <jeff.layton@primarydata.com>
      0164bf02
  5. 18 2月, 2015 3 次提交
    • J
      locks: fix list insertion when lock is split in two · 2e2f756f
      Jeff Layton 提交于
      In the case where we're splitting a lock in two, the current code
      the new "left" lock in the incorrect spot. It's inserted just
      before "right" when it should instead be inserted just before the
      new lock.
      
      When we add a new lock, set "fl" to that value so that we can
      add "left" before it.
      Reported-by: NAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: NJeff Layton <jeff.layton@primarydata.com>
      2e2f756f
    • J
      locks: remove conditional lock release in middle of flock_lock_file · 267f1128
      Jeff Layton 提交于
      As Linus pointed out:
      
          Say we have an existing flock, and now do a new one that conflicts. I
          see what looks like three separate bugs.
      
           - We go through the first loop, find a lock of another type, and
          delete it in preparation for replacing it
      
           - we *drop* the lock context spinlock.
      
           - BUG #1? So now there is no lock at all, and somebody can come in
          and see that unlocked state. Is that really valid?
      
           - another thread comes in while the first thread dropped the lock
          context lock, and wants to add its own lock. It doesn't see the
          deleted or pending locks, so it just adds it
      
           - the first thread gets the context spinlock again, and adds the lock
          that replaced the original
      
           - BUG #2? So now there are *two* locks on the thing, and the next
          time you do an unlock (or when you close the file), it will only
          remove/replace the first one.
      
      ...remove the "drop the spinlock" code in the middle of this function as
      it has always been suspicious. This should eliminate the potential race
      that can leave two locks for the same struct file on the list.
      
      He also pointed out another thing as a bug -- namely that you
      flock_lock_file removes the lock from the list unconditionally when
      doing a lock upgrade, without knowing whether it'll be able to set the
      new lock. Bruce pointed out that this is expected behavior and may help
      prevent certain deadlock situations.
      
      We may want to revisit that at some point, but it's probably best that
      we do so in the context of a different patchset.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJeff Layton <jeff.layton@primarydata.com>
      267f1128
    • J
      locks: only remove leases associated with the file being closed · c4e136cd
      Jeff Layton 提交于
      We don't want to remove all leases just because one filp was closed.
      Signed-off-by: NJeff Layton <jeff.layton@primarydata.com>
      c4e136cd
  6. 17 2月, 2015 1 次提交
  7. 03 2月, 2015 2 次提交
    • C
      fs: add FL_LAYOUT lease type · 11afe9f7
      Christoph Hellwig 提交于
      This (ab-)uses the file locking code to allow filesystems to recall
      outstanding pNFS layouts on a file.  This new lease type is similar but
      not quite the same as FL_DELEG.  A FL_LAYOUT lease can always be granted,
      an a per-filesystem lock (XFS iolock for the initial implementation)
      ensures not FL_LAYOUT leases granted when we would need to recall them.
      
      Also included are changes that allow multiple outstanding read
      leases of different types on the same file as long as they have a
      differnt owner.  This wasn't a problem until now as nfsd never set
      FL_LEASE leases, and no one else used FL_DELEG leases, but given that
      nfsd will also issues FL_LAYOUT leases we will have to handle it now.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      11afe9f7
    • C
      fs: track fl_owner for leases · 2ab99ee1
      Christoph Hellwig 提交于
      Just like for other lock types we should allow different owners to have
      a read lease on a file.  Currently this can't happen, but with the addition
      of pNFS layout leases we'll need this feature.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      2ab99ee1
  8. 22 1月, 2015 1 次提交
  9. 17 1月, 2015 10 次提交
  10. 13 1月, 2015 1 次提交
  11. 08 10月, 2014 12 次提交
  12. 10 9月, 2014 6 次提交