On Mon, Feb 9, 2015 at 8:23 AM, 王旭 <xuw2015@xxxxxxxxx> wrote: > Do not cache the overlay file dentries in dentry lru. For the fs dentry of > overlay is fake, the real operations happen either lower dentry or upper dentry. > So it's not helpful to performance. Lookup of an uncached dentry causes acquisition of parent's i_mutex. This can very much degrade performance if multiple lookups are being performed in the same directory at the same time. So I don't think dropping the overlay dentry is a good idea. > And for a special use, the fnctl F_SETLEASE F_WRLCK needs the dentry count is 1. > If we cache the ovl dentry, which will hold the reference for upper dentry, and > the fcntl will do operation on upper dentry, whose reference will be 2. And > finally the fcntl F_SETLEASE F_WRLCK will fail with -EAGAIN. The ltp fcntl24, > fcntl25 and fcntl26 test case cover it. The F_WRLOCK check looks somewhat bogus because it will succeed or fail depending on whether or not a file with multiple hard links has more than one of it's dentries cached. I guess that needs to be cleaned up similar to how F_RDLOCK is handled (i.e. have a separate opencount in the inode, instead of trying to guess that based on d_count and i_count). Thanks, Miklos > > Signed-off-by: George Wang <xuw@xxxxxxxxxx> > --- > fs/overlayfs/super.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c > index f16d318..80b9ea8 100644 > --- a/fs/overlayfs/super.c > +++ b/fs/overlayfs/super.c > @@ -256,6 +256,17 @@ static bool ovl_is_opaquedir(struct dentry *dentry) > return false; > } > > +static int ovl_dentry_delete(struct dentry *dentry) > +{ > + struct inode *inode = dentry->d_inode; > + > + //dir dentry holds ovl_dir_cache, which will speed up readdir > + if (inode && S_ISDIR(inode->i_mode)) > + return 0; > + > + return 1; > +} > + > static void ovl_dentry_release(struct dentry *dentry) > { > struct ovl_entry *oe = dentry->d_fsdata; > @@ -268,7 +279,8 @@ static void ovl_dentry_release(struct dentry *dentry) > } > > static const struct dentry_operations ovl_dentry_operations = { > - .d_release = ovl_dentry_release, > + .d_delete = ovl_dentry_delete, > + .d_release = ovl_dentry_release, > }; > > static struct ovl_entry *ovl_alloc_entry(void) > -- > 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html