Skip to content

Commit 0a04993

Browse files
Paulo Alcantarasmfrench
authored andcommitted
smb: client: get rid of dfs naming in automount code
Automount code will handle both DFS links and reparse mount points. Also, get rid of BUG_ON() in cifs_release_automount_timer() while we're at it. Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 561f82a commit 0a04993

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

fs/smb/client/cifsfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ exit_cifs(void)
18051805
cifs_dbg(NOISY, "exit_smb3\n");
18061806
unregister_filesystem(&cifs_fs_type);
18071807
unregister_filesystem(&smb3_fs_type);
1808-
cifs_dfs_release_automount_timer();
1808+
cifs_release_automount_timer();
18091809
exit_cifs_idmap();
18101810
#ifdef CONFIG_CIFS_SWN_UPCALL
18111811
cifs_genl_exit();

fs/smb/client/cifsfs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start,
8181

8282
extern const struct inode_operations cifs_file_inode_ops;
8383
extern const struct inode_operations cifs_symlink_inode_ops;
84-
extern const struct inode_operations cifs_dfs_referral_inode_operations;
84+
extern const struct inode_operations cifs_namespace_inode_operations;
8585

8686

8787
/* Functions related to files and directories */
@@ -119,9 +119,9 @@ extern const struct dentry_operations cifs_dentry_ops;
119119
extern const struct dentry_operations cifs_ci_dentry_ops;
120120

121121
#ifdef CONFIG_CIFS_DFS_UPCALL
122-
extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
122+
extern struct vfsmount *cifs_d_automount(struct path *path);
123123
#else
124-
static inline struct vfsmount *cifs_dfs_d_automount(struct path *path)
124+
static inline struct vfsmount *cifs_d_automount(struct path *path)
125125
{
126126
return ERR_PTR(-EREMOTE);
127127
}

fs/smb/client/cifsproto.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
296296
extern void cifs_put_tcon(struct cifs_tcon *tcon);
297297

298298
#if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
299-
extern void cifs_dfs_release_automount_timer(void);
299+
extern void cifs_release_automount_timer(void);
300300
#else /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
301-
#define cifs_dfs_release_automount_timer() do { } while (0)
301+
#define cifs_release_automount_timer() do { } while (0)
302302
#endif /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
303303

304304
void cifs_proc_init(void);

fs/smb/client/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
797797

798798
const struct dentry_operations cifs_dentry_ops = {
799799
.d_revalidate = cifs_d_revalidate,
800-
.d_automount = cifs_dfs_d_automount,
800+
.d_automount = cifs_d_automount,
801801
/* d_delete: cifs_d_delete, */ /* not needed except for debugging */
802802
};
803803

@@ -872,5 +872,5 @@ const struct dentry_operations cifs_ci_dentry_ops = {
872872
.d_revalidate = cifs_d_revalidate,
873873
.d_hash = cifs_ci_hash,
874874
.d_compare = cifs_ci_compare,
875-
.d_automount = cifs_dfs_d_automount,
875+
.d_automount = cifs_d_automount,
876876
};

fs/smb/client/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void cifs_set_ops(struct inode *inode)
6060
case S_IFDIR:
6161
#ifdef CONFIG_CIFS_DFS_UPCALL
6262
if (IS_AUTOMOUNT(inode)) {
63-
inode->i_op = &cifs_dfs_referral_inode_operations;
63+
inode->i_op = &cifs_namespace_inode_operations;
6464
} else {
6565
#else /* NO DFS support, treat as a directory */
6666
{

fs/smb/client/namespace.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
/*
3-
* Contains the CIFS DFS referral mounting routines used for handling
4-
* traversal via DFS junction point
3+
* Contains mounting routines used for handling traversal via SMB junctions.
54
*
65
* Copyright (c) 2007 Igor Mammedov
76
* Copyright (C) International Business Machines Corp., 2008
@@ -24,27 +23,28 @@
2423
#include "dfs.h"
2524
#include "fs_context.h"
2625

27-
static LIST_HEAD(cifs_dfs_automount_list);
26+
static LIST_HEAD(cifs_automount_list);
2827

29-
static void cifs_dfs_expire_automounts(struct work_struct *work);
30-
static DECLARE_DELAYED_WORK(cifs_dfs_automount_task,
31-
cifs_dfs_expire_automounts);
32-
static int cifs_dfs_mountpoint_expiry_timeout = 500 * HZ;
28+
static void cifs_expire_automounts(struct work_struct *work);
29+
static DECLARE_DELAYED_WORK(cifs_automount_task,
30+
cifs_expire_automounts);
31+
static int cifs_mountpoint_expiry_timeout = 500 * HZ;
3332

34-
static void cifs_dfs_expire_automounts(struct work_struct *work)
33+
static void cifs_expire_automounts(struct work_struct *work)
3534
{
36-
struct list_head *list = &cifs_dfs_automount_list;
35+
struct list_head *list = &cifs_automount_list;
3736

3837
mark_mounts_for_expiry(list);
3938
if (!list_empty(list))
40-
schedule_delayed_work(&cifs_dfs_automount_task,
41-
cifs_dfs_mountpoint_expiry_timeout);
39+
schedule_delayed_work(&cifs_automount_task,
40+
cifs_mountpoint_expiry_timeout);
4241
}
4342

44-
void cifs_dfs_release_automount_timer(void)
43+
void cifs_release_automount_timer(void)
4544
{
46-
BUG_ON(!list_empty(&cifs_dfs_automount_list));
47-
cancel_delayed_work_sync(&cifs_dfs_automount_task);
45+
if (WARN_ON(!list_empty(&cifs_automount_list)))
46+
return;
47+
cancel_delayed_work_sync(&cifs_automount_task);
4848
}
4949

5050
/**
@@ -132,7 +132,7 @@ static int set_dest_addr(struct smb3_fs_context *ctx)
132132
/*
133133
* Create a vfsmount that we can automount
134134
*/
135-
static struct vfsmount *cifs_dfs_do_automount(struct path *path)
135+
static struct vfsmount *cifs_do_automount(struct path *path)
136136
{
137137
int rc;
138138
struct dentry *mntpt = path->dentry;
@@ -214,25 +214,25 @@ static struct vfsmount *cifs_dfs_do_automount(struct path *path)
214214
/*
215215
* Attempt to automount the referral
216216
*/
217-
struct vfsmount *cifs_dfs_d_automount(struct path *path)
217+
struct vfsmount *cifs_d_automount(struct path *path)
218218
{
219219
struct vfsmount *newmnt;
220220

221221
cifs_dbg(FYI, "%s: %pd\n", __func__, path->dentry);
222222

223-
newmnt = cifs_dfs_do_automount(path);
223+
newmnt = cifs_do_automount(path);
224224
if (IS_ERR(newmnt)) {
225225
cifs_dbg(FYI, "leaving %s [automount failed]\n" , __func__);
226226
return newmnt;
227227
}
228228

229229
mntget(newmnt); /* prevent immediate expiration */
230-
mnt_set_expiry(newmnt, &cifs_dfs_automount_list);
231-
schedule_delayed_work(&cifs_dfs_automount_task,
232-
cifs_dfs_mountpoint_expiry_timeout);
230+
mnt_set_expiry(newmnt, &cifs_automount_list);
231+
schedule_delayed_work(&cifs_automount_task,
232+
cifs_mountpoint_expiry_timeout);
233233
cifs_dbg(FYI, "leaving %s [ok]\n" , __func__);
234234
return newmnt;
235235
}
236236

237-
const struct inode_operations cifs_dfs_referral_inode_operations = {
237+
const struct inode_operations cifs_namespace_inode_operations = {
238238
};

0 commit comments

Comments
 (0)