Patch "9p: fix EBADF errors in cached mode" has been added to the 5.18-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

    9p: fix EBADF errors in cached mode

to the 5.18-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:
     9p-fix-ebadf-errors-in-cached-mode.patch
and it can be found in the queue-5.18 subdirectory.

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


>From b0017602fdf6bd3f344dd49eaee8b6ffeed6dbac Mon Sep 17 00:00:00 2001
From: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
Date: Tue, 14 Jun 2022 12:19:02 +0900
Subject: 9p: fix EBADF errors in cached mode

From: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>

commit b0017602fdf6bd3f344dd49eaee8b6ffeed6dbac upstream.

cached operations sometimes need to do invalid operations (e.g. read
on a write only file)
Historic fscache had added a "writeback fid", a special handle opened
RW as root, for this. The conversion to new fscache missed that bit.

This commit reinstates a slightly lesser variant of the original code
that uses the writeback fid for partial pages backfills if the regular
user fid had been open as WRONLY, and thus would lack read permissions.

Link: https://lkml.kernel.org/r/20220614033802.1606738-1-asmadeus@xxxxxxxxxxxxx
Fixes: eb497943fa21 ("9p: Convert to using the netfs helper lib to do reads and caching")
Cc: stable@xxxxxxxxxxxxxxx
Cc: David Howells <dhowells@xxxxxxxxxx>
Reported-By: Christian Schoenebeck <linux_oss@xxxxxxxxxxxxx>
Reviewed-by: Christian Schoenebeck <linux_oss@xxxxxxxxxxxxx>
Tested-by: Christian Schoenebeck <linux_oss@xxxxxxxxxxxxx>
Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/9p/vfs_addr.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -58,8 +58,21 @@ static void v9fs_issue_read(struct netfs
  */
 static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
 {
+	struct inode *inode = file_inode(file);
+	struct v9fs_inode *v9inode = V9FS_I(inode);
 	struct p9_fid *fid = file->private_data;
 
+	BUG_ON(!fid);
+
+	/* we might need to read from a fid that was opened write-only
+	 * for read-modify-write of page cache, use the writeback fid
+	 * for that */
+	if (rreq->origin == NETFS_READ_FOR_WRITE &&
+			(fid->mode & O_ACCMODE) == O_WRONLY) {
+		fid = v9inode->writeback_fid;
+		BUG_ON(!fid);
+	}
+
 	refcount_inc(&fid->count);
 	rreq->netfs_priv = fid;
 	return 0;


Patches currently in stable-queue which might be from asmadeus@xxxxxxxxxxxxx are

queue-5.18/9p-fix-fid-refcount-leak-in-v9fs_vfs_atomic_open_dotl.patch
queue-5.18/9p-fix-fid-refcount-leak-in-v9fs_vfs_get_link.patch
queue-5.18/9p-fix-refcounting-during-full-path-walks-for-fid-lookups.patch
queue-5.18/9p-fix-ebadf-errors-in-cached-mode.patch



[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