Patch "fuse: write inode in fuse_release()" has been added to the 5.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fuse: write inode in fuse_release()

to the 5.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fuse-write-inode-in-fuse_release.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8674a3b26deade1bbd04e752246293b72bf6863c
Author: Miklos Szeredi <mszeredi@xxxxxxxxxx>
Date:   Wed Apr 20 16:05:41 2022 +0200

    fuse: write inode in fuse_release()
    
    [ Upstream commit 035ff33cf4db101250fb980a3941bf078f37a544 ]
    
    A race between write(2) and close(2) allows pages to be dirtied after
    fuse_flush -> write_inode_now().  If these pages are not flushed from
    fuse_release(), then there might not be a writable open file later.  So any
    remaining dirty pages must be written back before the file is released.
    
    This is a partial revert of the blamed commit.
    
    Reported-by: syzbot+6e1efbd8efaaa6860e91@xxxxxxxxxxxxxxxxxxxxxxxxx
    Fixes: 36ea23374d1f ("fuse: write inode in fuse_vma_close() instead of fuse_release()")
    Cc: <stable@xxxxxxxxxxxxxxx> # v5.16
    Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 05caa2b9272e..60885ff9157c 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -338,6 +338,15 @@ static int fuse_open(struct inode *inode, struct file *file)
 
 static int fuse_release(struct inode *inode, struct file *file)
 {
+	struct fuse_conn *fc = get_fuse_conn(inode);
+
+	/*
+	 * Dirty pages might remain despite write_inode_now() call from
+	 * fuse_flush() due to writes racing with the close.
+	 */
+	if (fc->writeback_cache)
+		write_inode_now(inode, 1);
+
 	fuse_release_common(file, false);
 
 	/* return value is ignored by VFS */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux