Skip to content

Commit a1c0d00

Browse files
Paulo Alcantarasmfrench
authored andcommitted
cifs: share dfs connections and supers
When matching DFS superblocks we can't rely on either the server's address or tcon's UNC name from mount(2) as the existing servers and tcons might be connected to somewhere else. Instead, check if superblock is dfs, and if so, match its original source pathname with the new mount's source pathname. For DFS connections, instead of checking server's address, match its referral path as it could be connected to different targets. Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent a73a26d commit a1c0d00

File tree

9 files changed

+323
-369
lines changed

9 files changed

+323
-369
lines changed

fs/cifs/cifs_debug.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,14 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
372372
seq_printf(m, "\nIn Send: %d In MaxReq Wait: %d",
373373
atomic_read(&server->in_send),
374374
atomic_read(&server->num_waiters));
375+
if (IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)) {
376+
if (server->origin_fullpath)
377+
seq_printf(m, "\nDFS origin full path: %s",
378+
server->origin_fullpath);
379+
if (server->leaf_fullpath)
380+
seq_printf(m, "\nDFS leaf full path: %s",
381+
server->leaf_fullpath);
382+
}
375383

376384
seq_printf(m, "\n\n\tSessions: ");
377385
i = 0;

fs/cifs/cifsglob.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,6 @@ struct TCP_Server_Info {
738738
bool use_swn_dstaddr;
739739
struct sockaddr_storage swn_dstaddr;
740740
#endif
741-
#ifdef CONFIG_CIFS_DFS_UPCALL
742-
bool is_dfs_conn; /* if a dfs connection */
743741
struct mutex refpath_lock; /* protects leaf_fullpath */
744742
/*
745743
* Canonical DFS full paths that were used to chase referrals in mount and reconnect.
@@ -753,7 +751,6 @@ struct TCP_Server_Info {
753751
* format: \\HOST\SHARE\[OPTIONAL PATH]
754752
*/
755753
char *origin_fullpath, *leaf_fullpath, *current_fullpath;
756-
#endif
757754
};
758755

759756
static inline bool is_smb1(struct TCP_Server_Info *server)
@@ -1767,11 +1764,9 @@ struct cifs_mount_ctx {
17671764
struct TCP_Server_Info *server;
17681765
struct cifs_ses *ses;
17691766
struct cifs_tcon *tcon;
1770-
#ifdef CONFIG_CIFS_DFS_UPCALL
17711767
struct cifs_ses *root_ses;
17721768
uuid_t mount_id;
17731769
char *origin_fullpath, *leaf_fullpath;
1774-
#endif
17751770
};
17761771

17771772
static inline void free_dfs_info_param(struct dfs_info3_param *param)

fs/cifs/cifsproto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
242242
unsigned int page_offset,
243243
unsigned int to_read);
244244
extern int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb);
245+
void cifs_mount_put_conns(struct cifs_mount_ctx *mnt_ctx);
245246
int cifs_mount_get_session(struct cifs_mount_ctx *mnt_ctx);
247+
int cifs_is_path_remote(struct cifs_mount_ctx *mnt_ctx);
246248
int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx);
247249
extern int cifs_match_super(struct super_block *, void *);
248250
extern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx);

0 commit comments

Comments
 (0)