[Devel] [PATCH RHEL8 COMMIT] fuse: disable invalid inode dirtying for vstorage

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 24 14:40:07 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.49
------>
commit b5fb9f306e8b4d93f1195baf5bfb8cb21c460812
Author: Alexey Kuznetsov <kuznet at acronis.com>
Date:   Thu Jun 24 07:32:13 2021 +0000

    fuse: disable invalid inode dirtying for vstorage
    
    Amazing history behind this thing. Original patch which broke
    vstorage was committed by Maxim Patlasov back in 2014, mainstream
    commit 31f3267b4ba16b12fb9dd3b1953ea0f221cc2ab4.
    
    The purpose was to _help_ vstorage, but actual implementation reached us
    only recently with one of the latest rhel7 updates, so that we had no
    chances to enjoy its "advantages" and to find out that the patch is
    actually disasterous. :-)
    
    It is about ctime. It is quite important unix concept
    with an interesting semantics.
    
    Traditional (and correct!) way to handle it in fuse is to leave its
    handling entirely to fuse userspace daemon. The cached attributes are
    just invalidated in cases, when an operation might update ctime, and
    will be refetched on demand.
    
    But vstorage does not have ctime.
    So, following this way, ctime is never updated. Maxim suggested to rely
    on ctime stored in virtual inode, which is an advantage for vstorage.
    But apparently it was modified at review stage and mark_inode_dirty
    was added there, which is actually pointless both for vstorage and
    for all fuse daemons on top of unixish fses, where ctime
    cannot be changed from user space, it is updated only implicitly, by fs itself.
    And even for full userspace ext4 and similar things, they update
    ctime implicitly at corresponding operations. So, it is totally
    and completely pointless. But we are not going to argue with fuse
    maintainer, I hope.
    
    So, just disable this part for vstorage.
    
    The patch does not need backport to vz7. Previous patch already prevented
    illegal access to not-leased file. There is still useless overhead of calling
    noop SETATTR to vstorage-mount when file is still open, but we can
    live with this.
    
    Affects: #PSBM-130883
    https://jira.sw.ru/browse/PSBM-130883
    
    Signed-off-by: Alexey Kuznetsov <kuznet at acronis.com>
---
 fs/fuse/dir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index b558aab71c47..d1aa3412addf 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -718,7 +718,8 @@ void fuse_update_ctime(struct inode *inode)
 {
 	if (!IS_NOCMTIME(inode)) {
 		inode->i_ctime = current_time(inode);
-		mark_inode_dirty_sync(inode);
+		if (!get_fuse_conn(inode)->close_wait)
+			mark_inode_dirty_sync(inode);
 	}
 }
 


More information about the Devel mailing list