]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cifs: Show reason why autodisabling serverino support
authorPali Rohár <pali@kernel.org>
Mon, 6 Jul 2026 18:29:36 +0000 (20:29 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 9 Jul 2026 13:03:19 +0000 (08:03 -0500)
Extend cifs_autodisable_serverino() function to print also text message why
the function was called.

The text message is printed just once for mount then autodisabling
serverino support. Once the serverino support is disabled for mount it will
not be re-enabled. So those text messages do not cause flooding logs.

This change allows to debug issues why cifs.ko decide to turn off server
inode number support and hence disable support for detection of hardlinks.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsproto.h
fs/smb/client/connect.c
fs/smb/client/dfs_cache.c
fs/smb/client/inode.c
fs/smb/client/misc.c
fs/smb/client/readdir.c

index c4ababcb51a388e90336ba78331a8577ee1d93c7..00168839c12319900689d5b5c88cc7ad75cc74ef 100644 (file)
@@ -317,7 +317,7 @@ int generate_smb311signingkey(struct cifs_ses *ses,
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
-void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
+void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb, const char *reason, int rc);
 bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
 int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
                     struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
index a187398fbabd9f3c29c6b131dcd0eeeee3c8182d..ba749ec25a59fa99a4901a24956c0f3a1b982169 100644 (file)
@@ -3876,7 +3876,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
         * After reconnecting to a different server, unique ids won't match anymore, so we disable
         * serverino. This prevents dentry revalidation to think the dentry are stale (ESTALE).
         */
-       cifs_autodisable_serverino(cifs_sb);
+       cifs_autodisable_serverino(cifs_sb, "DFS failover may potentially connect to a different server, inode numbers won't match anymore", 0);
        /*
         * Force the use of prefix path to support failover on DFS paths that resolve to targets
         * that have different prefix paths.
index 44409ba44e1dde929bb77f9d8e490c0318235edc..8cd93cd2f00f9862a2aa65ad7f48b1fffec9f0cd 100644 (file)
@@ -1328,7 +1328,7 @@ int dfs_cache_remount_fs(struct cifs_sb_info *cifs_sb)
         * After reconnecting to a different server, unique ids won't match anymore, so we disable
         * serverino. This prevents dentry revalidation to think the dentry are stale (ESTALE).
         */
-       cifs_autodisable_serverino(cifs_sb);
+       cifs_autodisable_serverino(cifs_sb, "DFS failover may potentially connect to a different server, inode numbers won't match anymore", 0);
        /*
         * Force the use of prefix path to support failover on DFS paths that resolve to targets
         * that have different prefix paths.
index 16a3ddff060f2edf70ac827eab44c4fd8dee313b..deed04dd9b914fb8a8e743c6d9b8c7491534f9fe 100644 (file)
@@ -1147,7 +1147,7 @@ static void cifs_set_fattr_ino(int xid, struct cifs_tcon *tcon, struct super_blo
                        fattr->cf_uniqueid = CIFS_I(*inode)->uniqueid;
                else {
                        fattr->cf_uniqueid = iunique(sb, ROOT_I);
-                       cifs_autodisable_serverino(cifs_sb);
+                       cifs_autodisable_serverino(cifs_sb, "Cannot retrieve inode number via get_srv_inum", rc);
                }
                return;
        }
@@ -1644,7 +1644,7 @@ retry_iget5_locked:
                        fattr->cf_flags &= ~CIFS_FATTR_INO_COLLISION;
 
                        if (inode_has_hashed_dentries(inode)) {
-                               cifs_autodisable_serverino(CIFS_SB(sb));
+                               cifs_autodisable_serverino(CIFS_SB(sb), "Inode number collision detected", 0);
                                iput(inode);
                                fattr->cf_uniqueid = iunique(sb, ROOT_I);
                                goto retry_iget5_locked;
@@ -1710,8 +1710,9 @@ struct inode *cifs_root_iget(struct super_block *sb)
 iget_root:
        if (!rc) {
                if (fattr.cf_flags & CIFS_FATTR_JUNCTION) {
+                       cifs_dbg(VFS, "Removing junction mark and disabling 'serverino' to prevent inode collisions\n");
                        fattr.cf_flags &= ~CIFS_FATTR_JUNCTION;
-                       cifs_autodisable_serverino(cifs_sb);
+                       cifs_autodisable_serverino(cifs_sb, "Cannot retrieve attributes for junction point", rc);
                }
                inode = cifs_iget(sb, &fattr);
        }
index ee1728eec8aa0a21d484b97a2928a3c8c6f556fd..e4bac2a0b85dcfead7812fa811b53f8ff3871b19 100644 (file)
@@ -278,7 +278,7 @@ dump_smb(void *buf, int smb_buf_length)
 }
 
 void
-cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
+cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb, const char *reason, int rc)
 {
        unsigned int sbflags = cifs_sb_flags(cifs_sb);
 
@@ -290,6 +290,10 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
 
                atomic_andnot(CIFS_MOUNT_SERVER_INUM, &cifs_sb->mnt_cifs_flags);
                cifs_sb->mnt_cifs_serverino_autodisabled = true;
+               if (rc)
+                       cifs_dbg(VFS, "%s: %d\n", reason, rc);
+               else
+                       cifs_dbg(VFS, "%s\n", reason);
                cifs_dbg(VFS, "Autodisabling the use of server inode numbers on %s\n",
                         tcon ? tcon->tree_name : "new server");
                cifs_dbg(VFS, "The server doesn't seem to support them properly or the files might be on different servers (DFS)\n");
index a50c86bbe60f3fc4d25e4cfaadefd428f137f69d..ee5996e6d7d8c70a4ec3f0cadf595baeca63993b 100644 (file)
@@ -415,7 +415,7 @@ ffirst_retry:
        if (rc == 0) {
                cifsFile->invalidHandle = false;
        } else if (rc == -EOPNOTSUPP && (sbflags & CIFS_MOUNT_SERVER_INUM)) {
-               cifs_autodisable_serverino(cifs_sb);
+               cifs_autodisable_serverino(cifs_sb, "Cannot retrieve inode number via query_dir_first", rc);
                goto ffirst_retry;
        }
 error_exit:
@@ -1029,7 +1029,7 @@ static int cifs_filldir(char *find_entry, struct file *file,
                fattr.cf_uniqueid = de.ino;
        } else {
                fattr.cf_uniqueid = iunique(sb, ROOT_I);
-               cifs_autodisable_serverino(cifs_sb);
+               cifs_autodisable_serverino(cifs_sb, "Cannot retrieve inode number from readdir", 0);
        }
 
        if ((sbflags & CIFS_MOUNT_MF_SYMLINKS) && couldbe_mf_symlink(&fattr))