eCryptfs: Invalidate dcache entries when lower i_nlink is zero
authorTyler Hicks <tyhicks@canonical.com>
Wed, 5 Aug 2015 16:26:36 +0000 (11:26 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Oct 2015 02:46:06 +0000 (03:46 +0100)
commit209a7a67d225f9f1550c1576326a2194c044b21f
treecbafc0c20d3738e9f699e5dde83ea3bfc52706bb
parent392a99c8cf2b6d8ff119871006879b6173524731
eCryptfs: Invalidate dcache entries when lower i_nlink is zero

commit 5556e7e6d30e8e9b5ee51b0e5edd526ee80e5e36 upstream.

Consider eCryptfs dcache entries to be stale when the corresponding
lower inode's i_nlink count is zero. This solves a problem caused by the
lower inode being directly modified, without going through the eCryptfs
mount, leaving stale eCryptfs dentries cached and the eCryptfs inode's
i_nlink count not being cleared.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Richard Weinberger <richard@nod.at>
[bwh: Backported to 3.2:
 - Test d_revalidate pointer directly rather than a DCACHE_OP flag
 - Open-code d_inode()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ecryptfs/dentry.c