Skip to contentSkip to conversation

cifs: Unset CIFS_MOUNT_POSIX_PATHS flag when following dfs mounts

PATCH Applied Sachin Prabhu 3 participants 3 messages Jun 16, 2015 – Jun 29, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: Unset CIFS_MOUNT_POSIX_PATHS flag when following dfs mounts

In a dfs setup where the client transitions from a server which supports posix paths to a server which doesn't support posix paths, the flag CIFS_MOUNT_POSIX_PATHS is not reset. This leads to the wrong directory separator being used causing smb commands to fail.

Consider the following case where a dfs share on a samba server points to a share on windows smb server.

 # mount -t cifs -o .. //vm140-31/dfsroot/testwin/
 # ls -l /mnt; touch /mnt/a
 total 0
 touch: cannot touch ‘/mnt/a’: No such file or directory
---
 fs/cifs/connect.c | 2 ++
 1 file changed, 2 insertions(+)
fs/cifs/connect.c +2 -0
index 8383d5e..a59370b 100644
@@ -3461,6 +3461,8 @@ try_mount_again:
 		else if (ses)
 			cifs_put_smb_ses(ses);
 
+		cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_POSIX_PATHS;
+
 		free_xid(xid);
 	}
 #endif
Signature · 1 line
2.4.3

A message that is not in the archive (sent off-list or not yet received): 1434468977-25651-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

Applied
#2 lore raw

merged into cifs-2.6.git

Let me know if any other patches that you want to review ASAP for merge window.

Quoted 37 lines · Sachin Prabhu

In a dfs setup where the client transitions from a server which supports posix paths to a server which doesn't support posix paths, the flag CIFS_MOUNT_POSIX_PATHS is not reset. This leads to the wrong directory separator being used causing smb commands to fail.

Consider the following case where a dfs share on a samba server points to a share on windows smb server.

 # mount -t cifs -o .. //vm140-31/dfsroot/testwin/
 # ls -l /mnt; touch /mnt/a
 total 0
 touch: cannot touch ‘/mnt/a’: No such file or directory
---
 fs/cifs/connect.c | 2 ++
 1 file changed, 2 insertions(+)
fs/cifs/connect.c +2 -1
index 8383d5e..a59370b 100644
@@ -3461,6 +3461,8 @@ try_mount_again:
                else if (ses)
                        cifs_put_smb_ses(ses);
 
+               cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_POSIX_PATHS;
+
                free_xid(xid);
        }
 #endif
--

2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Thanks,

Steve
Acked-by
#3 lore raw
In reply to a message not in the archive
Quoted 22 lines · On Tue, 16 Jun 2015 16:36:17 +0100 Sachin Prabhu…

In a dfs setup where the client transitions from a server which supports posix paths to a server which doesn't support posix paths, the flag CIFS_MOUNT_POSIX_PATHS is not reset. This leads to the wrong directory separator being used causing smb commands to fail.

Consider the following case where a dfs share on a samba server points to a share on windows smb server.

 # mount -t cifs -o .. //vm140-31/dfsroot/testwin/
 # ls -l /mnt; touch /mnt/a
 total 0
 touch: cannot touch ‘/mnt/a’: No such file or directory
---
 fs/cifs/connect.c | 2 ++
 1 file changed, 2 insertions(+)
fs/cifs/connect.c +0 -0
index 8383d5e..a59370b 100644

fs/cifs/connect.c try_mount_again: · line 3468

Quoted 8 lines
fs/cifs/connect.c +2 -0
@@ -3461,6 +3461,8 @@ try_mount_again:
 		else if (ses)
 			cifs_put_smb_ses(ses);
 
+		cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_POSIX_PATHS;
+
 		free_xid(xid);
 	}
 #endif