Commit 8e938e39 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag '6.9-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - Various get_inode_info_fixes

 - Fix for querying xattrs of cached dirs

 - Four minor cleanup fixes (including adding some header corrections
   and a missing flag)

 - Performance improvement for deferred close

 - Two query interface fixes

* tag '6.9-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
  smb311: additional compression flag defined in updated protocol spec
  smb311: correct incorrect offset field in compression header
  cifs: Move some extern decls from .c files to .h
  cifs: remove redundant variable assignment
  cifs: fixes for get_inode_info
  cifs: open_cached_dir(): add FILE_READ_EA to desired access
  cifs: reduce warning log level for server not advertising interfaces
  cifs: make sure server interfaces are requested only for SMB3+
  cifs: defer close file handles having RH lease
parents 7ee04901 e56bc745
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -239,7 +239,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
		.tcon = tcon,
		.path = path,
		.create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE),
		.desired_access =  FILE_READ_DATA | FILE_READ_ATTRIBUTES,
		.desired_access =  FILE_READ_DATA | FILE_READ_ATTRIBUTES |
				   FILE_READ_EA,
		.disposition = FILE_OPEN,
		.fid = pfid,
		.replay = !!(retries),
+0 −4
Original line number Diff line number Diff line
@@ -151,10 +151,6 @@ MODULE_PARM_DESC(disable_legacy_dialects, "To improve security it may be "
				  "vers=1.0 (CIFS/SMB1) and vers=2.0 are weaker"
				  " and less secure. Default: n/N/0");

extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_mid_poolp;

struct workqueue_struct	*cifsiod_wq;
struct workqueue_struct	*decrypt_wq;
struct workqueue_struct	*fileinfo_put_wq;
+5 −0
Original line number Diff line number Diff line
@@ -355,6 +355,9 @@ struct smb_version_operations {
	/* informational QFS call */
	void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
			 struct cifs_sb_info *);
	/* query for server interfaces */
	int (*query_server_interfaces)(const unsigned int, struct cifs_tcon *,
				       bool);
	/* check if a path is accessible or not */
	int (*is_path_accessible)(const unsigned int, struct cifs_tcon *,
				  struct cifs_sb_info *, const char *);
@@ -2104,6 +2107,8 @@ extern struct workqueue_struct *cifsoplockd_wq;
extern struct workqueue_struct *deferredclose_wq;
extern __u32 cifs_lock_secret;

extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_mid_poolp;

/* Operations for different SMB versions */
+5 −4
Original line number Diff line number Diff line
@@ -52,9 +52,6 @@
#include "fs_context.h"
#include "cifs_swn.h"

extern mempool_t *cifs_req_poolp;
extern bool disable_legacy_dialects;

/* FIXME: should these be tunable? */
#define TLINK_ERROR_EXPIRE	(1 * HZ)
#define TLINK_IDLE_EXPIRE	(600 * HZ)
@@ -123,12 +120,16 @@ static void smb2_query_server_interfaces(struct work_struct *work)
	struct cifs_tcon *tcon = container_of(work,
					struct cifs_tcon,
					query_interfaces.work);
	struct TCP_Server_Info *server = tcon->ses->server;

	/*
	 * query server network interfaces, in case they change
	 */
	if (!server->ops->query_server_interfaces)
		return;

	xid = get_xid();
	rc = SMB3_request_interfaces(xid, tcon, false);
	rc = server->ops->query_server_interfaces(xid, tcon, false);
	free_xid(xid);

	if (rc) {
+15 −5
Original line number Diff line number Diff line
@@ -486,7 +486,6 @@ struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
	cfile->uid = current_fsuid();
	cfile->dentry = dget(dentry);
	cfile->f_flags = file->f_flags;
	cfile->status_file_deleted = false;
	cfile->invalidHandle = false;
	cfile->deferred_close_scheduled = false;
	cfile->tlink = cifs_get_tlink(tlink);
@@ -1073,6 +1072,19 @@ void smb2_deferred_work_close(struct work_struct *work)
	_cifsFileInfo_put(cfile, true, false);
}

static bool
smb2_can_defer_close(struct inode *inode, struct cifs_deferred_close *dclose)
{
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
	struct cifsInodeInfo *cinode = CIFS_I(inode);

	return (cifs_sb->ctx->closetimeo && cinode->lease_granted && dclose &&
			(cinode->oplock == CIFS_CACHE_RHW_FLG ||
			 cinode->oplock == CIFS_CACHE_RH_FLG) &&
			!test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags));

}

int cifs_close(struct inode *inode, struct file *file)
{
	struct cifsFileInfo *cfile;
@@ -1086,10 +1098,8 @@ int cifs_close(struct inode *inode, struct file *file)
		cfile = file->private_data;
		file->private_data = NULL;
		dclose = kmalloc(sizeof(struct cifs_deferred_close), GFP_KERNEL);
		if ((cifs_sb->ctx->closetimeo && cinode->oplock == CIFS_CACHE_RHW_FLG)
		    && cinode->lease_granted &&
		    !test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags) &&
		    dclose && !(cfile->status_file_deleted)) {
		if ((cfile->status_file_deleted == false) &&
		    (smb2_can_defer_close(inode, dclose))) {
			if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) {
				inode_set_mtime_to_ts(inode,
						      inode_set_ctime_current(inode));
Loading