1. 08 10月, 2014 7 次提交
    • J
      locks: define a lm_setup handler for leases · 1c7dd2ff
      Jeff Layton 提交于
      ...and move the fasync setup into it for fcntl lease calls. At the same
      time, change the semantics of how the file_lock double-pointer is
      handled. Up until now, on a successful lease return you got a pointer to
      the lock on the list. This is bad, since that pointer can no longer be
      relied on as valid once the inode->i_lock has been released.
      
      Change the code to instead just zero out the pointer if the lease we
      passed in ended up being used. Then the callers can just check to see
      if it's NULL after the call and free it if it isn't.
      
      The priv argument has the same semantics. The lm_setup function can
      zero the pointer out to signal to the caller that it should not be
      freed after the function returns.
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      1c7dd2ff
    • J
      locks: plumb a "priv" pointer into the setlease routines · e6f5c789
      Jeff Layton 提交于
      In later patches, we're going to add a new lock_manager_operation to
      finish setting up the lease while still holding the i_lock.  To do
      this, we'll need to pass a little bit of info in the fcntl setlease
      case (primarily an fasync structure). Plumb the extra pointer into
      there in advance of that.
      
      We declare this pointer as a void ** to make it clear that this is
      private info, and that the caller isn't required to set this unless
      the lm_setup specifically requires it.
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      e6f5c789
    • J
      nfsd: don't keep a pointer to the lease in nfs4_file · 0c637be8
      Jeff Layton 提交于
      Now that we don't need to pass in an actual lease pointer to
      vfs_setlease on unlock, we can stop tracking a pointer to the lease in
      the nfs4_file.
      
      Switch all of the places that check the fi_lease to check fi_deleg_file
      instead. We always set that at the same time so it will have the same
      semantics.
      
      Cc: J. Bruce Fields <bfields@fieldses.org>
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      0c637be8
    • J
      locks: clean up vfs_setlease kerneldoc comments · e51673aa
      Jeff Layton 提交于
      Some of the latter paragraphs seem ambiguous and just plain wrong.
      In particular the break_lease comment makes no sense. We call
      break_lease (and break_deleg) from all sorts of vfs-layer functions,
      so there is clearly such a method.
      
      Also get rid of some of the other comments about what's needed for
      a full implementation.
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      e51673aa
    • J
      locks: generic_delete_lease doesn't need a file_lock at all · 0efaa7e8
      Jeff Layton 提交于
      Ensure that it's OK to pass in a NULL file_lock double pointer on
      a F_UNLCK request and convert the vfs_setlease F_UNLCK callers to
      do just that.
      
      Finally, turn the BUG_ON in generic_setlease into a WARN_ON_ONCE
      with an error return. That's a problem we can handle without
      crashing the box if it occurs.
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      0efaa7e8
    • J
      nfsd: fix potential lease memory leak in nfs4_setlease · 415b96c5
      Jeff Layton 提交于
      It's unlikely to ever occur, but if there were already a lease set on
      the file then we could end up getting back a different pointer on a
      successful setlease attempt than the one we allocated. If that happens,
      the one we allocated could leak.
      
      In practice, I don't think this will happen due to the fact that we only
      try to set up the lease once per nfs4_file, but this error handling is a
      bit more correct given the current lease API.
      
      Cc: J. Bruce Fields <bfields@fieldses.org>
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      415b96c5
    • J
      locks: close potential race in lease_get_mtime · bfe86024
      Jeff Layton 提交于
      lease_get_mtime is called without the i_lock held, so there's no
      guarantee about the stability of the list. Between the time when we
      assign "flock" and then dereference it to check whether it's a lease
      and for write, the lease could be freed.
      
      Ensure that that doesn't occur by taking the i_lock before trying
      to check the lease.
      
      Cc: J. Bruce Fields <bfields@fieldses.org>
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      bfe86024
  2. 10 9月, 2014 11 次提交
  3. 03 9月, 2014 2 次提交
  4. 29 8月, 2014 5 次提交
  5. 19 8月, 2014 1 次提交
    • R
      nfsd: allow turning off nfsv3 readdir_plus · 18c01ab3
      Rajesh Ghanekar 提交于
      One of our customer's application only needs file names, not file
      attributes. With directories having 10K+ inodes (assuming buffer cache
      has directory blocks cached having file names, but inode cache is
      limited and hence need eviction of older cached inodes), older inodes
      are evicted periodically. So if they keep on doing readdir(2) from NSF
      client on multiple directories, some directory's files are periodically
      removed from inode cache and hence new readdir(2) on same directory
      requires disk access to bring back inodes again to inode cache.
      
      As READDIRPLUS request fetches attributes also, doing getattr on each
      file on server, it causes unnecessary disk accesses. If READDIRPLUS on
      NFS client is returned with -ENOTSUPP, NFS client uses READDIR request
      which just gets the names of the files in a directory, not attributes,
      hence avoiding disk accesses on server.
      
      There's already a corresponding client-side mount option, but an export
      option reduces the need for configuration across multiple clients.
      
      This flag affects NFSv3 only.  If it turns out it's needed for NFSv4 as
      well then we may have to figure out how to extend the behavior to NFSv4,
      but it's not currently obvious how to do that.
      Signed-off-by: NRajesh Ghanekar <rajesh_ghanekar@symantec.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      18c01ab3
  6. 18 8月, 2014 14 次提交