瀏覽代碼

[CIFS] Add nodfs mount option
Older samba server (eg. 3.0.24 from Debian etch) don't work correctly,
if DFS paths are used. Such server claim that they support DFS, but fail
to process some requests with DFS paths. Starting with Linux 2.6.26,
the cifs clients starts sending DFS paths in such situations, rendering
it unuseable with older samba servers.

The nodfs mount options forces a share to be used with non DFS paths,
even if the server claims, that it supports it.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Acked-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>

Steve French 17 年之前
父節點
當前提交
2c1b861539
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 3 0
      fs/cifs/README
  2. 9 0
      fs/cifs/connect.c

+ 3 - 0
fs/cifs/README

@@ -463,6 +463,9 @@ A partial list of the supported mount options follows:
 		with cifs style mandatory byte range locks (and most
 		with cifs style mandatory byte range locks (and most
 		cifs servers do not yet support requesting advisory
 		cifs servers do not yet support requesting advisory
 		byte range locks).
 		byte range locks).
+ nodfs          Disable DFS (global name space support) even if the
+		server claims to support it.  This can help work around
+		a problem with parsing of DFS paths with Samba 3.0.24 server.
  remount        remount the share (often used to change from ro to rw mounts
  remount        remount the share (often used to change from ro to rw mounts
 	        or vice versa)
 	        or vice versa)
  cifsacl        Report mode bits (e.g. on stat) based on the Windows ACL for
  cifsacl        Report mode bits (e.g. on stat) based on the Windows ACL for

+ 9 - 0
fs/cifs/connect.c

@@ -90,6 +90,7 @@ struct smb_vol {
 	bool nocase:1;     /* request case insensitive filenames */
 	bool nocase:1;     /* request case insensitive filenames */
 	bool nobrl:1;      /* disable sending byte range locks to srv */
 	bool nobrl:1;      /* disable sending byte range locks to srv */
 	bool seal:1;       /* request transport encryption on share */
 	bool seal:1;       /* request transport encryption on share */
+	bool nodfs:1;
 	unsigned int rsize;
 	unsigned int rsize;
 	unsigned int wsize;
 	unsigned int wsize;
 	unsigned int sockopt;
 	unsigned int sockopt;
@@ -1218,6 +1219,8 @@ cifs_parse_mount_options(char *options, const char *devname,
 			vol->sfu_emul = 1;
 			vol->sfu_emul = 1;
 		} else if (strnicmp(data, "nosfu", 5) == 0) {
 		} else if (strnicmp(data, "nosfu", 5) == 0) {
 			vol->sfu_emul = 0;
 			vol->sfu_emul = 0;
+		} else if (strnicmp(data, "nodfs", 5) == 0) {
+			vol->nodfs = 1;
 		} else if (strnicmp(data, "posixpaths", 10) == 0) {
 		} else if (strnicmp(data, "posixpaths", 10) == 0) {
 			vol->posix_paths = 1;
 			vol->posix_paths = 1;
 		} else if (strnicmp(data, "noposixpaths", 12) == 0) {
 		} else if (strnicmp(data, "noposixpaths", 12) == 0) {
@@ -2197,6 +2200,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
 						volume_info.UNC,
 						volume_info.UNC,
 						tcon, cifs_sb->local_nls);
 						tcon, cifs_sb->local_nls);
 					cFYI(1, ("CIFS Tcon rc = %d", rc));
 					cFYI(1, ("CIFS Tcon rc = %d", rc));
+					if (volume_info.nodfs) {
+						tcon->Flags &=
+							~SMB_SHARE_IS_IN_DFS;
+						cFYI(1, ("DFS disabled (%d)",
+							tcon->Flags));
+					}
 				}
 				}
 				if (!rc) {
 				if (!rc) {
 					atomic_inc(&pSesInfo->inUse);
 					atomic_inc(&pSesInfo->inUse);