lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220621125651.14954-1-11123156@vivo.com>
Date:   Tue, 21 Jun 2022 20:56:51 +0800
From:   wubo <11123156@...o.com>
To:     miklos@...redi.hu
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Wu Bo <bo.wu@...o.com>
Subject: [PATCH] fuse: force sync attr when inode is invalidated

From: Wu Bo <bo.wu@...o.com>

Now the fuse driver only trust it's local inode size when
writeback_cache is enabled. Even the userspace server tell the driver
the inode cache is invalidated, the size attrabute will not update. And
will keep it's out-of-date size till the inode cache is dropped. This is
not reasonable.

Signed-off-by: Wu Bo <bo.wu@...o.com>
---
 fs/fuse/inode.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 8c0665c5dff8..a4e62c7f2b83 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -162,6 +162,11 @@ static ino_t fuse_squash_ino(u64 ino64)
 	return ino;
 }
 
+static bool fuse_force_sync(struct fuse_inode *fi)
+{
+	return fi->i_time == 0;
+}
+
 void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
 				   u64 attr_valid, u32 cache_mask)
 {
@@ -222,8 +227,10 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
 u32 fuse_get_cache_mask(struct inode *inode)
 {
 	struct fuse_conn *fc = get_fuse_conn(inode);
+	struct fuse_inode *fi = get_fuse_inode(inode);
+	bool is_force_sync = fuse_force_sync(fi);
 
-	if (!fc->writeback_cache || !S_ISREG(inode->i_mode))
+	if (!fc->writeback_cache || !S_ISREG(inode->i_mode) || is_force_sync)
 		return 0;
 
 	return STATX_MTIME | STATX_CTIME | STATX_SIZE;
@@ -437,6 +444,7 @@ int fuse_reverse_inval_inode(struct fuse_conn *fc, u64 nodeid,
 	fi = get_fuse_inode(inode);
 	spin_lock(&fi->lock);
 	fi->attr_version = atomic64_inc_return(&fc->attr_version);
+	fi->i_time = 0;
 	spin_unlock(&fi->lock);
 
 	fuse_invalidate_attr(inode);
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ