From d7f79573e653c0de37d796cc577f192aa336154d Mon Sep 17 00:00:00 2001
From: Anthony Iliopoulos <ailiop@suse.com>
Date: Feb 06 2024 14:06:26 +0000
Subject: 9p: missing chunk of "fs/9p: Don't update file type when

updating file attributes" (git-fixes).

---

diff --git a/patches.suse/9p-missing-chunk-of-fs-9p-Don-t-update-file-type-when-updating-file-attributes.patch b/patches.suse/9p-missing-chunk-of-fs-9p-Don-t-update-file-type-when-updating-file-attributes.patch
new file mode 100644
index 0000000..e63f48a
--- /dev/null
+++ b/patches.suse/9p-missing-chunk-of-fs-9p-Don-t-update-file-type-when-updating-file-attributes.patch
@@ -0,0 +1,46 @@
+From b577d0cd2104fdfcf0ded3707540a12be8ddd8b0 Mon Sep 17 00:00:00 2001
+From: Al Viro <viro@zeniv.linux.org.uk>
+Date: Sun, 31 Jan 2021 14:37:39 -0500
+Subject: [PATCH] 9p: missing chunk of "fs/9p: Don't update file type when
+ updating file attributes"
+Git-commit: b577d0cd2104fdfcf0ded3707540a12be8ddd8b0
+Patch-mainline: v5.13-rc1
+References: git-fixes
+
+In commit 45089142b149 Aneesh had missed one (admittedly, very unlikely
+to hit) case in v9fs_stat2inode_dotl().  However, the same considerations
+apply there as well - we have no business whatsoever to change ->i_rdev
+or the file type.
+
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Acked-by: Anthony Iliopoulos <ailiop@suse.com>
+
+---
+ fs/9p/vfs_inode_dotl.c | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
+index df0b87b05c42..e1c0240b51c0 100644
+--- a/fs/9p/vfs_inode_dotl.c
++++ b/fs/9p/vfs_inode_dotl.c
+@@ -663,14 +663,10 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
+ 		if (stat->st_result_mask & P9_STATS_NLINK)
+ 			set_nlink(inode, stat->st_nlink);
+ 		if (stat->st_result_mask & P9_STATS_MODE) {
+-			inode->i_mode = stat->st_mode;
+-			if ((S_ISBLK(inode->i_mode)) ||
+-						(S_ISCHR(inode->i_mode)))
+-				init_special_inode(inode, inode->i_mode,
+-								inode->i_rdev);
++			mode = stat->st_mode & S_IALLUGO;
++			mode |= inode->i_mode & ~S_IALLUGO;
++			inode->i_mode = mode;
+ 		}
+-		if (stat->st_result_mask & P9_STATS_RDEV)
+-			inode->i_rdev = new_decode_dev(stat->st_rdev);
+ 		if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE) &&
+ 		    stat->st_result_mask & P9_STATS_SIZE)
+ 			v9fs_i_size_write(inode, stat->st_size);
+-- 
+2.43.0
+
diff --git a/series.conf b/series.conf
index fd4b069..dd9bb0c 100644
--- a/series.conf
+++ b/series.conf
@@ -60801,6 +60801,7 @@
 	patches.suse/0010-overflow-Correct-check_shl_overflow-comment.patch
 	patches.suse/do_cifs_create-don-t-set-i_mode-of-something-we-had-not-created.patch
 	patches.suse/cifs-have-mkdir-handle-race-with-another-client-sanely.patch
+	patches.suse/9p-missing-chunk-of-fs-9p-Don-t-update-file-type-when-updating-file-attributes.patch
 	patches.suse/x86-kprobes-fix-to-check-non-boostable-prefixes-correctly.patch
 	patches.suse/s390-disassembler-increase-ebpf-disasm-buffer-size
 	patches.suse/media-ite-cir-check-for-receive-overflow.patch