Skip to content

Commit 8205ae3

Browse files
committed
Merge tag '5.17-rc-part2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: - multichannel fixes, addressing additional reconnect and DFS scenarios - reenabling fscache support (indexing rewrite, metadata caching e.g.) - send additional version information during NTLMSSP negotiate to improve debugging - fix for a mount race - DFS fixes - fix for a memory leak for stable * tag '5.17-rc-part2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: update internal module number smb3: send NTLMSSP version information cifs: Support fscache indexing rewrite cifs: cifs_ses_mark_for_reconnect should also update reconnect bits cifs: update tcpStatus during negotiate and sess setup cifs: make status checks in version independent callers cifs: remove repeated state change in dfs tree connect cifs: fix the cifs_reconnect path for DFS cifs: remove unused variable ses_selected cifs: protect all accesses to chan_* with chan_lock cifs: fix the connection state transitions with multichannel cifs: check reconnects for channels of active tcons too smb3: add new defines from protocol specification cifs: serialize all mount attempts cifs: quirk for STATUS_OBJECT_NAME_INVALID returned for non-ASCII dfs refs cifs: alloc_path_with_tree_prefix: do not append sep. if the path is empty cifs: clean up an inconsistent indenting cifs: free ntlmsspblob allocated in negotiate
2 parents 1cb69c8 + 5162015 commit 8205ae3

25 files changed

+573
-626
lines changed

fs/cifs/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ config CIFS_SMB_DIRECT
188188

189189
config CIFS_FSCACHE
190190
bool "Provide CIFS client caching support"
191-
depends on CIFS=m && FSCACHE_OLD_API || CIFS=y && FSCACHE_OLD_API=y
191+
depends on CIFS=m && FSCACHE || CIFS=y && FSCACHE=y
192192
help
193193
Makes CIFS FS-Cache capable. Say Y here if you want your CIFS data
194194
to be cached locally on disk through the general filesystem cache

fs/cifs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cifs-$(CONFIG_CIFS_DFS_UPCALL) += cifs_dfs_ref.o dfs_cache.o
2525

2626
cifs-$(CONFIG_CIFS_SWN_UPCALL) += netlink.o cifs_swn.o
2727

28-
cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
28+
cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o
2929

3030
cifs-$(CONFIG_CIFS_SMB_DIRECT) += smbdirect.o
3131

fs/cifs/cache.c

Lines changed: 0 additions & 105 deletions
This file was deleted.

fs/cifs/cifs_swn.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,11 @@ static int cifs_swn_resource_state_changed(struct cifs_swn_reg *swnreg, const ch
396396
switch (state) {
397397
case CIFS_SWN_RESOURCE_STATE_UNAVAILABLE:
398398
cifs_dbg(FYI, "%s: resource name '%s' become unavailable\n", __func__, name);
399-
cifs_ses_mark_for_reconnect(swnreg->tcon->ses);
399+
cifs_reconnect(swnreg->tcon->ses->server, true);
400400
break;
401401
case CIFS_SWN_RESOURCE_STATE_AVAILABLE:
402402
cifs_dbg(FYI, "%s: resource name '%s' become available\n", __func__, name);
403-
cifs_ses_mark_for_reconnect(swnreg->tcon->ses);
403+
cifs_reconnect(swnreg->tcon->ses->server, true);
404404
break;
405405
case CIFS_SWN_RESOURCE_STATE_UNKNOWN:
406406
cifs_dbg(FYI, "%s: resource name '%s' changed to unknown state\n", __func__, name);
@@ -498,10 +498,7 @@ static int cifs_swn_reconnect(struct cifs_tcon *tcon, struct sockaddr_storage *a
498498
goto unlock;
499499
}
500500

501-
spin_lock(&cifs_tcp_ses_lock);
502-
if (tcon->ses->server->tcpStatus != CifsExiting)
503-
tcon->ses->server->tcpStatus = CifsNeedReconnect;
504-
spin_unlock(&cifs_tcp_ses_lock);
501+
cifs_reconnect(tcon->ses->server, false);
505502

506503
unlock:
507504
mutex_unlock(&tcon->ses->server->srv_mutex);

fs/cifs/cifsfs.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ static void
397397
cifs_evict_inode(struct inode *inode)
398398
{
399399
truncate_inode_pages_final(&inode->i_data);
400+
if (inode->i_state & I_PINNING_FSCACHE_WB)
401+
cifs_fscache_unuse_inode_cookie(inode, true);
402+
cifs_fscache_release_inode_cookie(inode);
400403
clear_inode(inode);
401404
}
402405

@@ -721,6 +724,12 @@ static int cifs_show_stats(struct seq_file *s, struct dentry *root)
721724
}
722725
#endif
723726

727+
static int cifs_write_inode(struct inode *inode, struct writeback_control *wbc)
728+
{
729+
fscache_unpin_writeback(wbc, cifs_inode_cookie(inode));
730+
return 0;
731+
}
732+
724733
static int cifs_drop_inode(struct inode *inode)
725734
{
726735
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
@@ -733,6 +742,7 @@ static int cifs_drop_inode(struct inode *inode)
733742
static const struct super_operations cifs_super_ops = {
734743
.statfs = cifs_statfs,
735744
.alloc_inode = cifs_alloc_inode,
745+
.write_inode = cifs_write_inode,
736746
.free_inode = cifs_free_inode,
737747
.drop_inode = cifs_drop_inode,
738748
.evict_inode = cifs_evict_inode,
@@ -1625,13 +1635,9 @@ init_cifs(void)
16251635
goto out_destroy_cifsoplockd_wq;
16261636
}
16271637

1628-
rc = cifs_fscache_register();
1629-
if (rc)
1630-
goto out_destroy_deferredclose_wq;
1631-
16321638
rc = cifs_init_inodecache();
16331639
if (rc)
1634-
goto out_unreg_fscache;
1640+
goto out_destroy_deferredclose_wq;
16351641

16361642
rc = cifs_init_mids();
16371643
if (rc)
@@ -1693,8 +1699,6 @@ init_cifs(void)
16931699
cifs_destroy_mids();
16941700
out_destroy_inodecache:
16951701
cifs_destroy_inodecache();
1696-
out_unreg_fscache:
1697-
cifs_fscache_unregister();
16981702
out_destroy_deferredclose_wq:
16991703
destroy_workqueue(deferredclose_wq);
17001704
out_destroy_cifsoplockd_wq:
@@ -1730,7 +1734,6 @@ exit_cifs(void)
17301734
cifs_destroy_request_bufs();
17311735
cifs_destroy_mids();
17321736
cifs_destroy_inodecache();
1733-
cifs_fscache_unregister();
17341737
destroy_workqueue(deferredclose_wq);
17351738
destroy_workqueue(cifsoplockd_wq);
17361739
destroy_workqueue(decrypt_wq);

fs/cifs/cifsfs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,6 @@ extern struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type,
152152
extern const struct export_operations cifs_export_ops;
153153
#endif /* CONFIG_CIFS_NFSD_EXPORT */
154154

155-
#define CIFS_VERSION "2.34"
155+
#define SMB3_PRODUCT_BUILD 35
156+
#define CIFS_VERSION "2.35"
156157
#endif /* _CIFSFS_H */

fs/cifs/cifsglob.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ enum statusEnum {
117117
CifsInSessSetup,
118118
CifsNeedTcon,
119119
CifsInTcon,
120+
CifsNeedFilesInvalidate,
120121
CifsInFilesInvalidate
121122
};
122123

@@ -667,9 +668,6 @@ struct TCP_Server_Info {
667668
unsigned int total_read; /* total amount of data read in this pass */
668669
atomic_t in_send; /* requests trying to send */
669670
atomic_t num_waiters; /* blocked waiting to get in sendrecv */
670-
#ifdef CONFIG_CIFS_FSCACHE
671-
struct fscache_cookie *fscache; /* client index cache cookie */
672-
#endif
673671
#ifdef CONFIG_CIFS_STATS2
674672
atomic_t num_cmds[NUMBER_OF_SMB2_COMMANDS]; /* total requests by cmd */
675673
atomic_t smb2slowcmd[NUMBER_OF_SMB2_COMMANDS]; /* count resps > 1 sec */
@@ -923,6 +921,7 @@ struct cifs_chan {
923921
*/
924922
struct cifs_ses {
925923
struct list_head smb_ses_list;
924+
struct list_head rlist; /* reconnect list */
926925
struct list_head tcon_list;
927926
struct cifs_tcon *tcon_ipc;
928927
struct mutex session_mutex;
@@ -1110,7 +1109,7 @@ struct cifs_tcon {
11101109
__u32 max_bytes_copy;
11111110
#ifdef CONFIG_CIFS_FSCACHE
11121111
u64 resource_id; /* server resource id */
1113-
struct fscache_cookie *fscache; /* cookie for share */
1112+
struct fscache_volume *fscache; /* cookie for share */
11141113
#endif
11151114
struct list_head pending_opens; /* list of incomplete opens */
11161115
struct cached_fid crfid; /* Cached root fid */

fs/cifs/cifsproto.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ extern int SendReceiveBlockingLock(const unsigned int xid,
131131
struct smb_hdr *in_buf ,
132132
struct smb_hdr *out_buf,
133133
int *bytes_returned);
134+
void
135+
cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
136+
bool mark_smb_session);
134137
extern int cifs_reconnect(struct TCP_Server_Info *server,
135138
bool mark_smb_session);
136139
extern int checkSMB(char *buf, unsigned int len, struct TCP_Server_Info *srvr);
@@ -647,6 +650,11 @@ static inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
647650
int match_target_ip(struct TCP_Server_Info *server,
648651
const char *share, size_t share_len,
649652
bool *result);
653+
654+
int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid,
655+
struct cifs_tcon *tcon,
656+
struct cifs_sb_info *cifs_sb,
657+
const char *dfs_link_path);
650658
#endif
651659

652660
static inline int cifs_create_options(struct cifs_sb_info *cifs_sb, int options)

0 commit comments

Comments
 (0)