1. 24 7月, 2014 1 次提交
  2. 23 7月, 2014 1 次提交
    • J
      nfsd: bump dl_time when unhashing delegation · d55a166c
      Jeff Layton 提交于
      There's a potential race between a lease break and DELEGRETURN call.
      
      Suppose a lease break comes in and queues the workqueue job for a
      delegation, but it doesn't run just yet. Then, a DELEGRETURN comes in
      finds the delegation and calls destroy_delegation on it to unhash it and
      put its primary reference.
      
      Next, the workqueue job runs and queues the delegation back onto the
      del_recall_lru list, issues the CB_RECALL and puts the final reference.
      With that, the final reference to the delegation is put, but it's still
      on the LRU list.
      
      When we go to unhash a delegation, it's because we intend to get rid of
      it soon afterward, so we don't want lease breaks to mess with it once
      that occurs. Fix this by bumping the dl_time whenever we unhash a
      delegation, to ensure that lease breaks don't monkey with it.
      
      I believe this is a regression due to commit 02e1215f (nfsd: Avoid
      taking state_lock while holding inode lock in nfsd_break_one_deleg).
      Prior to that, the state_lock was held in the lm_break callback itself,
      and that would have prevented this race.
      
      Cc: Trond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      d55a166c
  3. 22 7月, 2014 3 次提交
  4. 17 7月, 2014 4 次提交
  5. 11 7月, 2014 13 次提交
  6. 10 7月, 2014 9 次提交
  7. 09 7月, 2014 7 次提交
  8. 23 6月, 2014 1 次提交
  9. 18 6月, 2014 1 次提交
    • N
      NFSD: Don't hand out delegations for 30 seconds after recalling them. · 6282cd56
      NeilBrown 提交于
      If nfsd needs to recall a delegation for some reason it implies that there is
      contention on the file, so further delegations should not be handed out.
      
      The current code fails to do so, and the result is effectively a
      live-lock under some workloads: a client attempting a conflicting
      operation on a read-delegated file receives NFS4ERR_DELAY and retries
      the operation, but by the time it retries the server may already have
      given out another delegation.
      
      We could simply avoid delegations for (say) 30 seconds after any recall, but
      this is probably too heavy handed.
      
      We could keep a list of inodes (or inode numbers or filehandles) for recalled
      delegations, but that requires memory allocation and searching.
      
      The approach taken here is to use a bloom filter to record the filehandles
      which are currently blocked from delegation, and to accept the cost of a few
      false positives.
      
      We have 2 bloom filters, each of which is valid for 30 seconds.   When a
      delegation is recalled the filehandle is added to one filter and will remain
      disabled for between 30 and 60 seconds.
      
      We keep a count of the number of filehandles that have been added, so when
      that count is zero we can bypass all other tests.
      
      The bloom filters have 256 bits and 3 hash functions.  This should allow a
      couple of dozen blocked  filehandles with minimal false positives.  If many
      more filehandles are all blocked at once, behaviour will degrade towards
      rejecting all delegations for between 30 and 60 seconds, then resetting and
      allowing new delegations.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      6282cd56