1. 11 Dec, 2022 1 commit
    • Jeff Layton's avatar
      nfsd: rework refcounting in filecache · ac3a2585
      Jeff Layton authored
      The filecache refcounting is a bit non-standard for something searchable
      by RCU, in that we maintain a sentinel reference while it's hashed. This
      in turn requires that we have to do things differently in the "put"
      depending on whether its hashed, which we believe to have led to races.
      
      There are other problems in here too. nfsd_file_close_inode_sync can end
      up freeing an nfsd_file while there are still outstanding references to
      it, and there are a number of subtle ToC/ToU races.
      
      Rework the code so that the refcount is what drives the lifecycle. When
      the refcount goes to zero, then unhash and rcu free the object. A task
      searching for a nfsd_file is allowed to bump its refcount, but only if
      it's not already 0. Ensure that we don't make any other changes to it
      until a reference is held.
      
      With this change, the LRU carries a reference. Take special care to deal
      with it when removing an entry from the list, and ensure that we only
      repurpose the nf_lru list_head when the refcount is 0 to ensure
      exclusive access to it.
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      ac3a2585
  2. 10 Dec, 2022 21 commits
  3. 28 Nov, 2022 18 commits