smb: client: don't clobber ->i_rdev from cached reparse points
authorPaulo Alcantara <pc@manguebit.com>
Fri, 19 Jan 2024 04:08:29 +0000 (01:08 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2024 14:22:45 +0000 (16:22 +0200)
[ Upstream commit 66c9314b61ed5b7bfcff0d89359aa0f975c0ab53 ]

Don't clobber ->i_rdev from valid reparse inodes over readdir(2) as it
can't be provided by query dir responses.

Signed-off-by: Paulo Alcantara <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/readdir.c

index 47f5a82bc2507d457f0ddd8d67b7c1d36a4fc09a..73ff9bd059682e8d0f572147576264779ab125d9 100644 (file)
@@ -133,14 +133,14 @@ retry:
                                 * Query dir responses don't provide enough
                                 * information about reparse points other than
                                 * their reparse tags.  Save an invalidation by
-                                * not clobbering the existing mode, size and
-                                * symlink target (if any) when reparse tag and
-                                * ctime haven't changed.
+                                * not clobbering some existing attributes when
+                                * reparse tag and ctime haven't changed.
                                 */
                                rc = 0;
                                if (fattr->cf_cifsattrs & ATTR_REPARSE) {
                                        if (likely(reparse_inode_match(inode, fattr))) {
                                                fattr->cf_mode = inode->i_mode;
+                                               fattr->cf_rdev = inode->i_rdev;
                                                fattr->cf_eof = CIFS_I(inode)->server_eof;
                                                fattr->cf_symlink_target = NULL;
                                        } else {