9p: missing chunk of "fs/9p: Don't update file type when updating file attributes"
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 31 Jan 2021 19:37:39 +0000 (14:37 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 13 Mar 2021 03:15:22 +0000 (22:15 -0500)
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>
fs/9p/vfs_inode_dotl.c

index df0b87b05c422cec585c26b5aaddddeedcae6193..e1c0240b51c0350c99605eb502f109f2949337f3 100644 (file)
@@ -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);