Commit fd3a5940 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull smb client fixes from Steve French:

 - six smb3 client fixes including ones to allow controlling smb3
   directory caching timeout and limits, and one debugging improvement

 - one fix for nls Kconfig (don't need to expose NLS_UCS2_UTILS option)

 - one minor spnego registry update

* tag '6.6-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
  spnego: add missing OID to oid registry
  smb3: fix minor typo in SMB2_GLOBAL_CAP_LARGE_MTU
  cifs: update internal module version number for cifs.ko
  smb3: allow controlling maximum number of cached directories
  smb3: add trace point for queryfs (statfs)
  nls: Hide new NLS_UCS2_UTILS
  smb3: allow controlling length of time directory entries are cached with dir leases
  smb: propagate error code of extract_sharename()
parents a3c57ab7 5d153cd1
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -618,11 +618,6 @@ config NLS_UTF8
	  the Unicode/ISO9646 universal character set.

config NLS_UCS2_UTILS
	tristate "NLS UCS-2 UTILS"
	help
	  Set of older UCS-2 conversion utilities and tables used by some
	  filesystems including SMB/CIFS.  This includes upper case conversion
	  tables. This will automatically be selected when the filesystem
	  that uses it is selected.
	tristate

endif # NLS
+6 −5
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ static void smb2_close_cached_fid(struct kref *ref);

static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,
						    const char *path,
						    bool lookup_only)
						    bool lookup_only,
						    __u32 max_cached_dirs)
{
	struct cached_fid *cfid;

@@ -43,7 +44,7 @@ static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,
		spin_unlock(&cfids->cfid_list_lock);
		return NULL;
	}
	if (cfids->num_entries >= MAX_CACHED_FIDS) {
	if (cfids->num_entries >= max_cached_dirs) {
		spin_unlock(&cfids->cfid_list_lock);
		return NULL;
	}
@@ -145,7 +146,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
	const char *npath;

	if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache ||
	    is_smb1_server(tcon->ses->server))
	    is_smb1_server(tcon->ses->server) || (dir_cache_timeout == 0))
		return -EOPNOTSUPP;

	ses = tcon->ses;
@@ -162,7 +163,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
	if (!utf16_path)
		return -ENOMEM;

	cfid = find_or_create_cached_dir(cfids, path, lookup_only);
	cfid = find_or_create_cached_dir(cfids, path, lookup_only, tcon->max_cached_dirs);
	if (cfid == NULL) {
		kfree(utf16_path);
		return -ENOENT;
@@ -582,7 +583,7 @@ cifs_cfids_laundromat_thread(void *p)
			return 0;
		spin_lock(&cfids->cfid_list_lock);
		list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
			if (time_after(jiffies, cfid->time + HZ * 30)) {
			if (time_after(jiffies, cfid->time + HZ * dir_cache_timeout)) {
				list_del(&cfid->entry);
				list_add(&cfid->entry, &entry);
				cfids->num_entries--;
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ struct cached_fid {
	struct cached_dirents dirents;
};

#define MAX_CACHED_FIDS 16
/* default MAX_CACHED_FIDS is 16 */
struct cached_fids {
	/* Must be held when:
	 * - accessing the cfids->entries list
+12 −0
Original line number Diff line number Diff line
@@ -117,6 +117,10 @@ module_param(cifs_max_pending, uint, 0444);
MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server for "
				   "CIFS/SMB1 dialect (N/A for SMB3) "
				   "Default: 32767 Range: 2 to 32767.");
unsigned int dir_cache_timeout = 30;
module_param(dir_cache_timeout, uint, 0644);
MODULE_PARM_DESC(dir_cache_timeout, "Number of seconds to cache directory contents for which we have a lease. Default: 30 "
				 "Range: 1 to 65000 seconds, 0 to disable caching dir contents");
#ifdef CONFIG_CIFS_STATS2
unsigned int slow_rsp_threshold = 1;
module_param(slow_rsp_threshold, uint, 0644);
@@ -695,6 +699,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
		seq_printf(s, ",snapshot=%llu", tcon->snapshot_time);
	if (tcon->handle_timeout)
		seq_printf(s, ",handletimeout=%u", tcon->handle_timeout);
	if (tcon->max_cached_dirs != MAX_CACHED_FIDS)
		seq_printf(s, ",max_cached_dirs=%u", tcon->max_cached_dirs);

	/*
	 * Display file and directory attribute timeout in seconds.
@@ -1679,6 +1685,12 @@ init_cifs(void)
			 CIFS_MAX_REQ);
	}

	/* Limit max to about 18 hours, and setting to zero disables directory entry caching */
	if (dir_cache_timeout > 65000) {
		dir_cache_timeout = 65000;
		cifs_dbg(VFS, "dir_cache_timeout set to max of 65000 seconds\n");
	}

	cifsiod_wq = alloc_workqueue("cifsiod", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
	if (!cifsiod_wq) {
		rc = -ENOMEM;
+2 −2
Original line number Diff line number Diff line
@@ -152,6 +152,6 @@ extern const struct export_operations cifs_export_ops;
#endif /* CONFIG_CIFS_NFSD_EXPORT */

/* when changing internal version - update following two lines at same time */
#define SMB3_PRODUCT_BUILD 44
#define CIFS_VERSION   "2.44"
#define SMB3_PRODUCT_BUILD 45
#define CIFS_VERSION   "2.45"
#endif				/* _CIFSFS_H */
Loading