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

Commit db563fc2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
  cifs: handle the TCP_Server_Info->tsk field more carefully
  cifs: fix unlinking of rename target when server doesn't support open file renames
  [CIFS] improve setlease handling
  [CIFS] fix saving of resume key before CIFSFindNext
  cifs: make cifs_rename handle -EACCES errors
  [CIFS] fix build error
  [CIFS] undo changes in cifs_rename_pending_delete if it errors out
  cifs: track DeletePending flag in cifsInodeInfo
  cifs: don't use CREATE_DELETE_ON_CLOSE in cifs_rename_pending_delete
  [CIFS] eliminate usage of kthread_stop for cifsd
  [CIFS] Add nodfs mount option
parents eb810715 b1c8d2b4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
Version 1.55
------------
Various fixes to make delete of open files behavior more predictable
(when delete of an open file fails we mark the file as "delete-on-close"
in a way that more servers accept, but only if we can first rename the
file to a temporary name).  Add experimental support for more safely
handling fcntl(F_SETLEASE).

Version 1.54
------------
Fix premature write failure on congested networks (we would give up
@@ -13,6 +21,7 @@ on dns_upcall (resolving DFS referralls). Fix plain text password
authentication (requires setting SecurityFlags to 0x30030 to enable
lanman and plain text though).  Fix writes to be at correct offset when
file is open with O_APPEND and file is on a directio (forcediretio) mount.
Fix bug in rewinding readdir directory searches.  Add nodfs mount option.

Version 1.53
------------
+19 −0
Original line number Diff line number Diff line
@@ -463,6 +463,9 @@ A partial list of the supported mount options follows:
		with cifs style mandatory byte range locks (and most
		cifs servers do not yet support requesting advisory
		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
	        or vice versa)
 cifsacl        Report mode bits (e.g. on stat) based on the Windows ACL for
@@ -488,6 +491,19 @@ A partial list of the supported mount options follows:
		Note that this differs from the sign mount option in that it
		causes encryption of data sent over this mounted share but other
		shares mounted to the same server are unaffected.
 locallease     This option is rarely needed. Fcntl F_SETLEASE is
		used by some applications such as Samba and NFSv4 server to
		check to see whether a file is cacheable.  CIFS has no way
		to explicitly request a lease, but can check whether a file
		is cacheable (oplocked).  Unfortunately, even if a file
		is not oplocked, it could still be cacheable (ie cifs client
		could grant fcntl leases if no other local processes are using
		the file) for cases for example such as when the server does not
		support oplocks and the user is sure that the only updates to
		the file will be from this client. Specifying this mount option
		will allow the cifs client to check for leases (only) locally
		for files which are not oplocked instead of denying leases
		in that case. (EXPERIMENTAL)
 sec            Security mode.  Allowed values are:
			none	attempt to connection as a null user (no name)
			krb5    Use Kerberos version 5 authentication
@@ -638,6 +654,9 @@ requires enabling CONFIG_CIFS_EXPERIMENTAL
	cifsacl support needed to retrieve approximated mode bits based on
		the contents on the CIFS ACL.

	lease support: cifs will check the oplock state before calling into
	the vfs to see if we can grant a lease on a file.

	DNOTIFY fcntl: needed for support of directory change 
			    notification and perhaps later for file leases)

+42 −0
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ cifs_alloc_inode(struct super_block *sb)
	file data or metadata */
	cifs_inode->clientCanCacheRead = false;
	cifs_inode->clientCanCacheAll = false;
	cifs_inode->delete_pending = false;
	cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */

	/* Can not set i_flags here - they get immediately overwritten
@@ -620,6 +621,37 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
	return generic_file_llseek_unlocked(file, offset, origin);
}

#ifdef CONFIG_CIFS_EXPERIMENTAL
static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
{
	/* note that this is called by vfs setlease with the BKL held
	   although I doubt that BKL is needed here in cifs */
	struct inode *inode = file->f_path.dentry->d_inode;

	if (!(S_ISREG(inode->i_mode)))
		return -EINVAL;

	/* check if file is oplocked */
	if (((arg == F_RDLCK) &&
		(CIFS_I(inode)->clientCanCacheRead)) ||
	    ((arg == F_WRLCK) &&
		(CIFS_I(inode)->clientCanCacheAll)))
		return generic_setlease(file, arg, lease);
	else if (CIFS_SB(inode->i_sb)->tcon->local_lease &&
			!CIFS_I(inode)->clientCanCacheRead)
		/* If the server claims to support oplock on this
		   file, then we still need to check oplock even
		   if the local_lease mount option is set, but there
		   are servers which do not support oplock for which
		   this mount option may be useful if the user
		   knows that the file won't be changed on the server
		   by anyone else */
		return generic_setlease(file, arg, lease);
	else
		return -EAGAIN;
}
#endif

struct file_system_type cifs_fs_type = {
	.owner = THIS_MODULE,
	.name = "cifs",
@@ -698,6 +730,7 @@ const struct file_operations cifs_file_ops = {

#ifdef CONFIG_CIFS_EXPERIMENTAL
	.dir_notify = cifs_dir_notify,
	.setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
};

@@ -718,6 +751,7 @@ const struct file_operations cifs_file_direct_ops = {
	.llseek = cifs_llseek,
#ifdef CONFIG_CIFS_EXPERIMENTAL
	.dir_notify = cifs_dir_notify,
	.setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
};
const struct file_operations cifs_file_nobrl_ops = {
@@ -738,6 +772,7 @@ const struct file_operations cifs_file_nobrl_ops = {

#ifdef CONFIG_CIFS_EXPERIMENTAL
	.dir_notify = cifs_dir_notify,
	.setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
};

@@ -757,6 +792,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = {
	.llseek = cifs_llseek,
#ifdef CONFIG_CIFS_EXPERIMENTAL
	.dir_notify = cifs_dir_notify,
	.setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
};

@@ -949,6 +985,12 @@ static int cifs_oplock_thread(void *dummyarg)
				the call */
			/* mutex_lock(&inode->i_mutex);*/
			if (S_ISREG(inode->i_mode)) {
#ifdef CONFIG_CIFS_EXPERIMENTAL
				if (CIFS_I(inode)->clientCanCacheAll == 0)
					break_lease(inode, FMODE_READ);
				else if (CIFS_I(inode)->clientCanCacheRead == 0)
					break_lease(inode, FMODE_WRITE);
#endif
				rc = filemap_fdatawrite(inode->i_mapping);
				if (CIFS_I(inode)->clientCanCacheRead == 0) {
					waitrc = filemap_fdatawait(
+1 −1
Original line number Diff line number Diff line
@@ -101,5 +101,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
extern const struct export_operations cifs_export_ops;
#endif /* EXPERIMENTAL */

#define CIFS_VERSION   "1.54"
#define CIFS_VERSION   "1.55"
#endif				/* _CIFSFS_H */
+2 −0
Original line number Diff line number Diff line
@@ -285,6 +285,7 @@ struct cifsTconInfo {
	bool seal:1;      /* transport encryption for this mounted share */
	bool unix_ext:1;  /* if false disable Linux extensions to CIFS protocol
				for this mount even if server would support */
	bool local_lease:1; /* check leases (only) on local system not remote */
	/* BB add field for back pointer to sb struct(s)? */
};

@@ -353,6 +354,7 @@ struct cifsInodeInfo {
	bool clientCanCacheRead:1;	/* read oplock */
	bool clientCanCacheAll:1;	/* read and writebehind oplock */
	bool oplockPending:1;
	bool delete_pending:1;		/* DELETE_ON_CLOSE is set */
	struct inode vfs_inode;
};

Loading