Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39f15003 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
  [CIFS] Fix memory overwrite when saving nativeFileSystem field during mount
  [CIFS]  Rename compose_mount_options to cifs_compose_mount_options.
  [CIFS] work around bug in Samba server handling for posix open
  [CIFS] Use posix open on file open when server supports it
  cifs: fix buffer format byte on NT Rename/hardlink
  [CIFS] Add definitions for remoteably fsctl calls
  [CIFS] add extra null attr check
  [CIFS] fix build error
  [CIFS] reopen file via newer posix open protocol operation if available
  [CIFS] Add new nostrictsync cifs mount option to avoid slow SMB flush
  [CIFS] DFS no longer experimental
  [CIFS] Send SMB flush in cifs_fsync
parents 7676b8fd b363b330
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -6,7 +6,16 @@ the server to treat subsequent connections, especially those that
are authenticated as guest, as reconnections, invalidating the earlier
user's smb session.  This fix allows cifs to mount multiple times to the
same server with different userids without risking invalidating earlier
established security contexts.
established security contexts.  fsync now sends SMB Flush operation
to better ensure that we wait for server to write all of the data to
server disk (not just write it over the network).  Add new mount
parameter to allow user to disable sending the (slow) SMB flush on
fsync if desired (fsync still flushes all cached write data to the server).
Posix file open support added (turned off after one attempt if server
fails to support it properly, as with Samba server versions prior to 3.3.2)
Fix "redzone overwritten" bug in cifs_put_tcon (CIFSTcon may allocate too
little memory for the "nativeFileSystem" field returned by the server
during mount). 

Version 1.56
------------
+12 −9
Original line number Diff line number Diff line
@@ -118,6 +118,18 @@ config CIFS_DEBUG2
	   option can be turned off unless you are debugging
	   cifs problems.  If unsure, say N.

config CIFS_DFS_UPCALL
	  bool "DFS feature support"
	  depends on CIFS && KEYS
	  help
	    Distributed File System (DFS) support is used to access shares
	    transparently in an enterprise name space, even if the share
	    moves to a different server.  This feature also enables
	    an upcall mechanism for CIFS which contacts userspace helper
	    utilities to provide server name resolution (host names to
	    IP addresses) which is needed for implicit mounts of DFS junction
	    points. If unsure, say N.

config CIFS_EXPERIMENTAL
	  bool "CIFS Experimental Features (EXPERIMENTAL)"
	  depends on CIFS && EXPERIMENTAL
@@ -131,12 +143,3 @@ config CIFS_EXPERIMENTAL
	    (which is disabled by default). See the file fs/cifs/README
	    for more details.  If unsure, say N.
config CIFS_DFS_UPCALL
	  bool "DFS feature support (EXPERIMENTAL)"
	  depends on CIFS_EXPERIMENTAL
	  depends on KEYS
	  help
	    Enables an upcall mechanism for CIFS which contacts userspace
	    helper utilities to provide server name resolution (host names to
	    IP addresses) which is needed for implicit mounts of DFS junction
	    points. If unsure, say N.
+18 −4
Original line number Diff line number Diff line
@@ -472,6 +472,19 @@ A partial list of the supported mount options follows:
		even if the cifs server would support posix advisory locks.
		"forcemand" is accepted as a shorter form of this mount
		option.
 nostrictsync   If this mount option is set, when an application does an
		fsync call then the cifs client does not send an SMB Flush
		to the server (to force the server to write all dirty data
		for this file immediately to disk), although cifs still sends
		all dirty (cached) file data to the server and waits for the
		server to respond to the write.  Since SMB Flush can be
		very slow, and some servers may be reliable enough (to risk
		delaying slightly flushing the data to disk on the server),
		turning on this option may be useful to improve performance for
		applications that fsync too much, at a small risk of server
		crash.  If this mount option is not set, by default cifs will
		send an SMB flush request (and wait for a response) on every
		fsync call.
 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 server
@@ -692,13 +705,14 @@ require this helper. Note that NTLMv2 security (which does not require the
cifs.upcall helper program), instead of using Kerberos, is sufficient for
some use cases.

Enabling DFS support (used to access shares transparently in an MS-DFS
global name space) requires that CONFIG_CIFS_EXPERIMENTAL be enabled.  In
addition, DFS support for target shares which are specified as UNC
DFS support allows transparent redirection to shares in an MS-DFS name space.
In addition, DFS support for target shares which are specified as UNC
names which begin with host names (rather than IP addresses) requires
a user space helper (such as cifs.upcall) to be present in order to
translate host names to ip address, and the user space helper must also
be configured in the file /etc/request-key.conf
be configured in the file /etc/request-key.conf.  Samba, Windows servers and
many NAS appliances support DFS as a way of constructing a global name
space to ease network configuration and improve reliability.

To use cifs Kerberos and DFS support, the Linux keyutils package should be
installed and something like the following lines should be added to the
+2 −0
Original line number Diff line number Diff line
@@ -340,6 +340,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
				seq_printf(m, "\nWrites: %d Bytes: %lld",
					atomic_read(&tcon->num_writes),
					(long long)(tcon->bytes_written));
				seq_printf(m, "\nFlushes: %d",
					atomic_read(&tcon->num_flushes));
				seq_printf(m, "\nLocks: %d HardLinks: %d "
					      "Symlinks: %d",
					atomic_read(&tcon->num_locks),
+16 −20
Original line number Diff line number Diff line
@@ -104,9 +104,9 @@ static char *cifs_get_share_name(const char *node_name)


/**
 * compose_mount_options	-	creates mount options for refferral
 * cifs_compose_mount_options	-	creates mount options for refferral
 * @sb_mountdata:	parent/root DFS mount options (template)
 * @dentry:		point where we are going to mount
 * @fullpath:		full path in UNC format
 * @ref:		server's referral
 * @devname:		pointer for saving device name
 *
@@ -116,8 +116,8 @@ static char *cifs_get_share_name(const char *node_name)
 * Returns: pointer to new mount options or ERR_PTR.
 * Caller is responcible for freeing retunrned value if it is not error.
 */
static char *compose_mount_options(const char *sb_mountdata,
				   struct dentry *dentry,
char *cifs_compose_mount_options(const char *sb_mountdata,
				   const char *fullpath,
				   const struct dfs_info3_param *ref,
				   char **devname)
{
@@ -128,7 +128,6 @@ static char *compose_mount_options(const char *sb_mountdata,
	char *srvIP = NULL;
	char sep = ',';
	int off, noff;
	char *fullpath;

	if (sb_mountdata == NULL)
		return ERR_PTR(-EINVAL);
@@ -202,17 +201,6 @@ static char *compose_mount_options(const char *sb_mountdata,
		goto compose_mount_options_err;
	}

	/*
	 * this function gives us a path with a double backslash prefix. We
	 * require a single backslash for DFS. Temporarily increment fullpath
	 * to put it in the proper form and decrement before freeing it.
	 */
	fullpath = build_path_from_dentry(dentry);
	if (!fullpath) {
		rc = -ENOMEM;
		goto compose_mount_options_err;
	}
	++fullpath;
	tkn_e = strchr(tkn_e + 1, '\\');
	if (tkn_e || (strlen(fullpath) - ref->path_consumed)) {
		strncat(mountdata, &sep, 1);
@@ -221,8 +209,6 @@ static char *compose_mount_options(const char *sb_mountdata,
			strcat(mountdata, tkn_e + 1);
		strcat(mountdata, fullpath + ref->path_consumed);
	}
	--fullpath;
	kfree(fullpath);

	/*cFYI(1,("%s: parent mountdata: %s", __func__,sb_mountdata));*/
	/*cFYI(1, ("%s: submount mountdata: %s", __func__, mountdata ));*/
@@ -245,10 +231,20 @@ static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
	struct vfsmount *mnt;
	char *mountdata;
	char *devname = NULL;
	char *fullpath;

	cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
	mountdata = compose_mount_options(cifs_sb->mountdata,
						dentry, ref, &devname);
	/*
	 * this function gives us a path with a double backslash prefix. We
	 * require a single backslash for DFS.
	 */
	fullpath = build_path_from_dentry(dentry);
	if (!fullpath)
		return ERR_PTR(-ENOMEM);

	mountdata = cifs_compose_mount_options(cifs_sb->mountdata,
			fullpath + 1, ref, &devname);
	kfree(fullpath);

	if (IS_ERR(mountdata))
		return (struct vfsmount *)mountdata;
Loading