Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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()

+43 -19
+1 -6
fs/nls/Kconfig
··· 618 618 the Unicode/ISO9646 universal character set. 619 619 620 620 config NLS_UCS2_UTILS 621 - tristate "NLS UCS-2 UTILS" 622 - help 623 - Set of older UCS-2 conversion utilities and tables used by some 624 - filesystems including SMB/CIFS. This includes upper case conversion 625 - tables. This will automatically be selected when the filesystem 626 - that uses it is selected. 621 + tristate 627 622 628 623 endif # NLS
+6 -5
fs/smb/client/cached_dir.c
··· 18 18 19 19 static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids, 20 20 const char *path, 21 - bool lookup_only) 21 + bool lookup_only, 22 + __u32 max_cached_dirs) 22 23 { 23 24 struct cached_fid *cfid; 24 25 ··· 44 43 spin_unlock(&cfids->cfid_list_lock); 45 44 return NULL; 46 45 } 47 - if (cfids->num_entries >= MAX_CACHED_FIDS) { 46 + if (cfids->num_entries >= max_cached_dirs) { 48 47 spin_unlock(&cfids->cfid_list_lock); 49 48 return NULL; 50 49 } ··· 146 145 const char *npath; 147 146 148 147 if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache || 149 - is_smb1_server(tcon->ses->server)) 148 + is_smb1_server(tcon->ses->server) || (dir_cache_timeout == 0)) 150 149 return -EOPNOTSUPP; 151 150 152 151 ses = tcon->ses; ··· 163 162 if (!utf16_path) 164 163 return -ENOMEM; 165 164 166 - cfid = find_or_create_cached_dir(cfids, path, lookup_only); 165 + cfid = find_or_create_cached_dir(cfids, path, lookup_only, tcon->max_cached_dirs); 167 166 if (cfid == NULL) { 168 167 kfree(utf16_path); 169 168 return -ENOENT; ··· 583 582 return 0; 584 583 spin_lock(&cfids->cfid_list_lock); 585 584 list_for_each_entry_safe(cfid, q, &cfids->entries, entry) { 586 - if (time_after(jiffies, cfid->time + HZ * 30)) { 585 + if (time_after(jiffies, cfid->time + HZ * dir_cache_timeout)) { 587 586 list_del(&cfid->entry); 588 587 list_add(&cfid->entry, &entry); 589 588 cfids->num_entries--;
+1 -1
fs/smb/client/cached_dir.h
··· 49 49 struct cached_dirents dirents; 50 50 }; 51 51 52 - #define MAX_CACHED_FIDS 16 52 + /* default MAX_CACHED_FIDS is 16 */ 53 53 struct cached_fids { 54 54 /* Must be held when: 55 55 * - accessing the cfids->entries list
+12
fs/smb/client/cifsfs.c
··· 117 117 MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server for " 118 118 "CIFS/SMB1 dialect (N/A for SMB3) " 119 119 "Default: 32767 Range: 2 to 32767."); 120 + unsigned int dir_cache_timeout = 30; 121 + module_param(dir_cache_timeout, uint, 0644); 122 + MODULE_PARM_DESC(dir_cache_timeout, "Number of seconds to cache directory contents for which we have a lease. Default: 30 " 123 + "Range: 1 to 65000 seconds, 0 to disable caching dir contents"); 120 124 #ifdef CONFIG_CIFS_STATS2 121 125 unsigned int slow_rsp_threshold = 1; 122 126 module_param(slow_rsp_threshold, uint, 0644); ··· 699 695 seq_printf(s, ",snapshot=%llu", tcon->snapshot_time); 700 696 if (tcon->handle_timeout) 701 697 seq_printf(s, ",handletimeout=%u", tcon->handle_timeout); 698 + if (tcon->max_cached_dirs != MAX_CACHED_FIDS) 699 + seq_printf(s, ",max_cached_dirs=%u", tcon->max_cached_dirs); 702 700 703 701 /* 704 702 * Display file and directory attribute timeout in seconds. ··· 1683 1677 cifs_max_pending = CIFS_MAX_REQ; 1684 1678 cifs_dbg(FYI, "cifs_max_pending set to max of %u\n", 1685 1679 CIFS_MAX_REQ); 1680 + } 1681 + 1682 + /* Limit max to about 18 hours, and setting to zero disables directory entry caching */ 1683 + if (dir_cache_timeout > 65000) { 1684 + dir_cache_timeout = 65000; 1685 + cifs_dbg(VFS, "dir_cache_timeout set to max of 65000 seconds\n"); 1686 1686 } 1687 1687 1688 1688 cifsiod_wq = alloc_workqueue("cifsiod", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
+2 -2
fs/smb/client/cifsfs.h
··· 152 152 #endif /* CONFIG_CIFS_NFSD_EXPORT */ 153 153 154 154 /* when changing internal version - update following two lines at same time */ 155 - #define SMB3_PRODUCT_BUILD 44 156 - #define CIFS_VERSION "2.44" 155 + #define SMB3_PRODUCT_BUILD 45 156 + #define CIFS_VERSION "2.45" 157 157 #endif /* _CIFSFS_H */
+2
fs/smb/client/cifsglob.h
··· 1210 1210 __u32 max_chunks; 1211 1211 __u32 max_bytes_chunk; 1212 1212 __u32 max_bytes_copy; 1213 + __u32 max_cached_dirs; 1213 1214 #ifdef CONFIG_CIFS_FSCACHE 1214 1215 u64 resource_id; /* server resource id */ 1215 1216 struct fscache_volume *fscache; /* cookie for share */ ··· 2017 2016 extern unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */ 2018 2017 extern unsigned int cifs_min_small; /* min size of small buf pool */ 2019 2018 extern unsigned int cifs_max_pending; /* MAX requests at once to server*/ 2019 + extern unsigned int dir_cache_timeout; /* max time for directory lease caching of dir */ 2020 2020 extern bool disable_legacy_dialects; /* forbid vers=1.0 and vers=2.0 mounts */ 2021 2021 extern atomic_t mid_count; 2022 2022
+1
fs/smb/client/connect.c
··· 2657 2657 tcon->retry = ctx->retry; 2658 2658 tcon->nocase = ctx->nocase; 2659 2659 tcon->broken_sparse_sup = ctx->no_sparse; 2660 + tcon->max_cached_dirs = ctx->max_cached_dirs; 2660 2661 if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) 2661 2662 tcon->nohandlecache = ctx->nohandlecache; 2662 2663 else
+10 -1
fs/smb/client/fs_context.c
··· 150 150 fsparam_u32("closetimeo", Opt_closetimeo), 151 151 fsparam_u32("echo_interval", Opt_echo_interval), 152 152 fsparam_u32("max_credits", Opt_max_credits), 153 + fsparam_u32("max_cached_dirs", Opt_max_cached_dirs), 153 154 fsparam_u32("handletimeout", Opt_handletimeout), 154 155 fsparam_u64("snapshot", Opt_snapshot), 155 156 fsparam_u32("max_channels", Opt_max_channels), ··· 1166 1165 if (result.uint_32 > 1) 1167 1166 ctx->multichannel = true; 1168 1167 break; 1168 + case Opt_max_cached_dirs: 1169 + if (result.uint_32 < 1) { 1170 + cifs_errorf(fc, "%s: Invalid max_cached_dirs, needs to be 1 or more\n", 1171 + __func__); 1172 + goto cifs_parse_mount_err; 1173 + } 1174 + ctx->max_cached_dirs = result.uint_32; 1175 + break; 1169 1176 case Opt_handletimeout: 1170 1177 ctx->handle_timeout = result.uint_32; 1171 1178 if (ctx->handle_timeout > SMB3_MAX_HANDLE_TIMEOUT) { ··· 1601 1592 ctx->acregmax = CIFS_DEF_ACTIMEO; 1602 1593 ctx->acdirmax = CIFS_DEF_ACTIMEO; 1603 1594 ctx->closetimeo = SMB3_DEF_DCLOSETIMEO; 1604 - 1595 + ctx->max_cached_dirs = MAX_CACHED_FIDS; 1605 1596 /* Most clients set timeout to 0, allows server to use its default */ 1606 1597 ctx->handle_timeout = 0; /* See MS-SMB2 spec section 2.2.14.2.12 */ 1607 1598
+3 -1
fs/smb/client/fs_context.h
··· 128 128 Opt_closetimeo, 129 129 Opt_echo_interval, 130 130 Opt_max_credits, 131 + Opt_max_cached_dirs, 131 132 Opt_snapshot, 132 133 Opt_max_channels, 133 134 Opt_handletimeout, ··· 262 261 __u32 handle_timeout; /* persistent and durable handle timeout in ms */ 263 262 unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */ 264 263 unsigned int max_channels; 264 + unsigned int max_cached_dirs; 265 265 __u16 compression; /* compression algorithm 0xFFFF default 0=disabled */ 266 266 bool rootfs:1; /* if it's a SMB root file system */ 267 267 bool witness:1; /* use witness protocol */ ··· 289 287 */ 290 288 #define SMB3_MAX_DCLOSETIMEO (1 << 30) 291 289 #define SMB3_DEF_DCLOSETIMEO (1 * HZ) /* even 1 sec enough to help eg open/write/close/open/read */ 292 - 290 + #define MAX_CACHED_FIDS 16 293 291 extern char *cifs_sanitize_prepath(char *prepath, gfp_t gfp); 294 292 295 293 #endif
+1 -1
fs/smb/client/fscache.c
··· 48 48 sharename = extract_sharename(tcon->tree_name); 49 49 if (IS_ERR(sharename)) { 50 50 cifs_dbg(FYI, "%s: couldn't extract sharename\n", __func__); 51 - return -EINVAL; 51 + return PTR_ERR(sharename); 52 52 } 53 53 54 54 slen = strlen(sharename);
+1
fs/smb/client/smb2ops.c
··· 2683 2683 smb2_copy_fs_info_to_kstatfs(info, buf); 2684 2684 2685 2685 qfs_exit: 2686 + trace_smb3_qfs_done(xid, tcon->tid, tcon->ses->Suid, tcon->tree_name, rc); 2686 2687 free_rsp_buf(buftype, rsp_iov.iov_base); 2687 2688 return rc; 2688 2689 }
+1 -1
fs/smb/client/trace.h
··· 691 691 TP_ARGS(xid, tid, sesid, unc_name, rc)) 692 692 693 693 DEFINE_SMB3_TCON_EVENT(tcon); 694 - 694 + DEFINE_SMB3_TCON_EVENT(qfs_done); 695 695 696 696 /* 697 697 * For smb2/smb3 open (including create and mkdir) calls
+1 -1
fs/smb/common/smb2pdu.h
··· 406 406 /* Capabilities flags */ 407 407 #define SMB2_GLOBAL_CAP_DFS 0x00000001 408 408 #define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */ 409 - #define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */ 409 + #define SMB2_GLOBAL_CAP_LARGE_MTU 0x00000004 /* Resp only New to SMB2.1 */ 410 410 #define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */ 411 411 #define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */ 412 412 #define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */
+1
include/linux/oid_registry.h
··· 67 67 OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */ 68 68 69 69 OID_ntlmssp, /* 1.3.6.1.4.1.311.2.2.10 */ 70 + OID_negoex, /* 1.3.6.1.4.1.311.2.2.30 */ 70 71 71 72 OID_spnego, /* 1.3.6.1.5.5.2 */ 72 73