Skip to content

Commit

Permalink
fs: improve DCACHE_REFERENCED usage
Browse files Browse the repository at this point in the history
dentry referenced bit is only set when installing the dentry back
onto the LRU. However with lazy LRU, the dentry can already be on
the LRU list at dput time, thus missing out on setting the referenced
bit. Fix this.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Nick Piggin authored and Al Viro committed Oct 26, 2010
1 parent 312d3ca commit 265ac90
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,16 @@ void dput(struct dentry *dentry)
if (dentry->d_op->d_delete(dentry))
goto unhash_it;
}

/* Unreachable? Get rid of it */
if (d_unhashed(dentry))
goto kill_it;
if (list_empty(&dentry->d_lru)) {
dentry->d_flags |= DCACHE_REFERENCED;

/* Otherwise leave it cached and ensure it's on the LRU */
dentry->d_flags |= DCACHE_REFERENCED;
if (list_empty(&dentry->d_lru))
dentry_lru_add(dentry);
}

spin_unlock(&dentry->d_lock);
spin_unlock(&dcache_lock);
return;
Expand Down

0 comments on commit 265ac90

Please sign in to comment.