[Devel] [PATCH vz7] fuse: revert Dcache is always invalid

Maxim Patlasov mpatlasov at virtuozzo.com
Tue Jul 18 01:06:13 MSK 2017


The patch reverts 4ae1fa01a5d865c3a96e0753be26b1d874f25827 initially
sent by Pavel Emelyanov three years ago with description:

> The existing behavior -- a dentry is valid for some time period. Then
> revalidation in the userpsace is required. This is wrong for PCS, since
> dentry effectively becomes invalid once a file is closed, i.e. -- always.

This justification above does not look reasonable anymore because, as AK
pointed out:

> What's about correctness of the statement, it is even formally wrong.
> No matter how frequently you invalidate, the file can disappear right
> after lookup, so that full disable of dcache is meaningless.

The policy must be set by fused. Currently it always gives entry_valid=0
ensuring that behavior stays the same with or without 4ae1..5827. But the
policy is going to change in near future to support usecases of directories
with > 100000 entries. Hence reverting 4ae1..5827 is required: otherwise fused
won't be able to utilize readdirplus.

Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/fuse/dir.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 1d41bfe..68e09f9 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -187,7 +187,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
 	inode = ACCESS_ONCE(entry->d_inode);
 	if (inode && is_bad_inode(inode))
 		goto invalid;
-	else if (1) {
+	else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
+		 (flags & LOOKUP_REVAL)) {
 		int err;
 		struct fuse_entry_out outarg;
 		struct fuse_req *req;
@@ -245,6 +246,13 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
 				       entry_attr_timeout(&outarg),
 				       attr_version);
 		fuse_change_entry_timeout(entry, &outarg);
+	} else if (inode) {
+		fc = get_fuse_conn(inode);
+		if (fc->readdirplus_auto) {
+			parent = dget_parent(entry);
+			fuse_advise_use_readdirplus(parent->d_inode);
+			dput(parent);
+		}
 	}
 	ret = 1;
 out:



More information about the Devel mailing list