From 261aaba72fdba17b74a3a434d9f925b43d90e958 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Mon, 1 Oct 2018 10:07:05 +0200 Subject: fuse: use iversion for readdir cache verification Use the internal iversion counter to make sure modifications of the directory through this filesystem are not missed by the mtime check (due to mtime granularity). Signed-off-by: Miklos Szeredi --- fs/fuse/readdir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs/fuse/readdir.c') diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index dafd6543cca2..ab18b78f4755 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -8,6 +8,7 @@ #include "fuse_i.h" +#include #include #include #include @@ -447,6 +448,7 @@ retry_locked: /* Starting cache? Set cache mtime. */ if (!ctx->pos && !fi->rdc.size) { fi->rdc.mtime = inode->i_mtime; + fi->rdc.iversion = inode_query_iversion(inode); } spin_unlock(&fi->rdc.lock); return UNCACHED; @@ -457,7 +459,8 @@ retry_locked: * changed, and reset the cache if so. */ if (!ctx->pos) { - if (!timespec64_equal(&fi->rdc.mtime, &inode->i_mtime)) { + if (inode_peek_iversion(inode) != fi->rdc.iversion || + !timespec64_equal(&fi->rdc.mtime, &inode->i_mtime)) { fuse_rdc_reset(inode); goto retry_locked; } -- cgit v1.2.3