Patch "cachefiles: Fix missing pos updates in cachefiles_ondemand_fd_write_iter()" has been added to the 6.11-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

    cachefiles: Fix missing pos updates in cachefiles_ondemand_fd_write_iter()

to the 6.11-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:
     cachefiles-fix-missing-pos-updates-in-cachefiles_ond.patch
and it can be found in the queue-6.11 subdirectory.

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



commit 0148ae9b4f8d1513563233ec1f67db99aa5d375f
Author: Zizhi Wo <wozizhi@xxxxxxxxxx>
Date:   Thu Nov 7 19:06:46 2024 +0800

    cachefiles: Fix missing pos updates in cachefiles_ondemand_fd_write_iter()
    
    [ Upstream commit 56f4856b425a30e1d8b3e41e6cde8bfba90ba5f8 ]
    
    In the erofs on-demand loading scenario, read and write operations are
    usually delivered through "off" and "len" contained in read req in user
    mode. Naturally, pwrite is used to specify a specific offset to complete
    write operations.
    
    However, if the write(not pwrite) syscall is called multiple times in the
    read-ahead scenario, we need to manually update ki_pos after each write
    operation to update file->f_pos.
    
    This step is currently missing from the cachefiles_ondemand_fd_write_iter
    function, added to address this issue.
    
    Fixes: c8383054506c ("cachefiles: notify the user daemon when looking up cookie")
    Signed-off-by: Zizhi Wo <wozizhi@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241107110649.3980193-3-wozizhi@xxxxxxxxxx
    Acked-by: David Howells <dhowells@xxxxxxxxxx>
    Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
index bdd321017f1c4..38ca6dce8ef29 100644
--- a/fs/cachefiles/ondemand.c
+++ b/fs/cachefiles/ondemand.c
@@ -77,8 +77,10 @@ static ssize_t cachefiles_ondemand_fd_write_iter(struct kiocb *kiocb,
 
 	trace_cachefiles_ondemand_fd_write(object, file_inode(file), pos, len);
 	ret = __cachefiles_write(object, file, pos, iter, NULL, NULL);
-	if (!ret)
+	if (!ret) {
 		ret = len;
+		kiocb->ki_pos += ret;
+	}
 
 	return ret;
 }




[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