generated from delphix/.github
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 8
Commit c658797
nfsd: rework refcounting in filecache
BugLink: https://bugs.launchpad.net/bugs/2065435
[ Upstream commit ac3a258 ]
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: Jeff Layton <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
Signed-off-by: Manuel Diewald <[email protected]>
Signed-off-by: Roxana Nicolescu <[email protected]>1 parent b3942d7 commit c658797Copy full SHA for c658797
File tree
Expand file treeCollapse file tree
2 files changed
+189
-180
lines changedOpen diff view settings
Filter options
- fs/nfsd
Expand file treeCollapse file tree
2 files changed
+189
-180
lines changedOpen diff view settings
0 commit comments