Commit 0a049935 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

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: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 561f82a3
...@@ -1805,7 +1805,7 @@ exit_cifs(void) ...@@ -1805,7 +1805,7 @@ exit_cifs(void)
cifs_dbg(NOISY, "exit_smb3\n"); cifs_dbg(NOISY, "exit_smb3\n");
unregister_filesystem(&cifs_fs_type); unregister_filesystem(&cifs_fs_type);
unregister_filesystem(&smb3_fs_type); unregister_filesystem(&smb3_fs_type);
cifs_dfs_release_automount_timer(); cifs_release_automount_timer();
exit_cifs_idmap(); exit_cifs_idmap();
#ifdef CONFIG_CIFS_SWN_UPCALL #ifdef CONFIG_CIFS_SWN_UPCALL
cifs_genl_exit(); cifs_genl_exit();
......
...@@ -81,7 +81,7 @@ extern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start, ...@@ -81,7 +81,7 @@ extern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start,
extern const struct inode_operations cifs_file_inode_ops; extern const struct inode_operations cifs_file_inode_ops;
extern const struct inode_operations cifs_symlink_inode_ops; extern const struct inode_operations cifs_symlink_inode_ops;
extern const struct inode_operations cifs_dfs_referral_inode_operations; extern const struct inode_operations cifs_namespace_inode_operations;
/* Functions related to files and directories */ /* Functions related to files and directories */
...@@ -119,9 +119,9 @@ extern const struct dentry_operations cifs_dentry_ops; ...@@ -119,9 +119,9 @@ extern const struct dentry_operations cifs_dentry_ops;
extern const struct dentry_operations cifs_ci_dentry_ops; extern const struct dentry_operations cifs_ci_dentry_ops;
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
extern struct vfsmount *cifs_dfs_d_automount(struct path *path); extern struct vfsmount *cifs_d_automount(struct path *path);
#else #else
static inline struct vfsmount *cifs_dfs_d_automount(struct path *path) static inline struct vfsmount *cifs_d_automount(struct path *path)
{ {
return ERR_PTR(-EREMOTE); return ERR_PTR(-EREMOTE);
} }
......
...@@ -296,9 +296,9 @@ extern void cifs_put_tcp_session(struct TCP_Server_Info *server, ...@@ -296,9 +296,9 @@ extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
extern void cifs_put_tcon(struct cifs_tcon *tcon); extern void cifs_put_tcon(struct cifs_tcon *tcon);
#if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) #if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
extern void cifs_dfs_release_automount_timer(void); extern void cifs_release_automount_timer(void);
#else /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */ #else /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
#define cifs_dfs_release_automount_timer() do { } while (0) #define cifs_release_automount_timer() do { } while (0)
#endif /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */ #endif /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
void cifs_proc_init(void); void cifs_proc_init(void);
......
...@@ -797,7 +797,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags) ...@@ -797,7 +797,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
const struct dentry_operations cifs_dentry_ops = { const struct dentry_operations cifs_dentry_ops = {
.d_revalidate = cifs_d_revalidate, .d_revalidate = cifs_d_revalidate,
.d_automount = cifs_dfs_d_automount, .d_automount = cifs_d_automount,
/* d_delete: cifs_d_delete, */ /* not needed except for debugging */ /* d_delete: cifs_d_delete, */ /* not needed except for debugging */
}; };
...@@ -872,5 +872,5 @@ const struct dentry_operations cifs_ci_dentry_ops = { ...@@ -872,5 +872,5 @@ const struct dentry_operations cifs_ci_dentry_ops = {
.d_revalidate = cifs_d_revalidate, .d_revalidate = cifs_d_revalidate,
.d_hash = cifs_ci_hash, .d_hash = cifs_ci_hash,
.d_compare = cifs_ci_compare, .d_compare = cifs_ci_compare,
.d_automount = cifs_dfs_d_automount, .d_automount = cifs_d_automount,
}; };
...@@ -60,7 +60,7 @@ static void cifs_set_ops(struct inode *inode) ...@@ -60,7 +60,7 @@ static void cifs_set_ops(struct inode *inode)
case S_IFDIR: case S_IFDIR:
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
if (IS_AUTOMOUNT(inode)) { if (IS_AUTOMOUNT(inode)) {
inode->i_op = &cifs_dfs_referral_inode_operations; inode->i_op = &cifs_namespace_inode_operations;
} else { } else {
#else /* NO DFS support, treat as a directory */ #else /* NO DFS support, treat as a directory */
{ {
......
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
/* /*
* Contains the CIFS DFS referral mounting routines used for handling * Contains mounting routines used for handling traversal via SMB junctions.
* traversal via DFS junction point
* *
* Copyright (c) 2007 Igor Mammedov * Copyright (c) 2007 Igor Mammedov
* Copyright (C) International Business Machines Corp., 2008 * Copyright (C) International Business Machines Corp., 2008
...@@ -24,27 +23,28 @@ ...@@ -24,27 +23,28 @@
#include "dfs.h" #include "dfs.h"
#include "fs_context.h" #include "fs_context.h"
static LIST_HEAD(cifs_dfs_automount_list); static LIST_HEAD(cifs_automount_list);
static void cifs_dfs_expire_automounts(struct work_struct *work); static void cifs_expire_automounts(struct work_struct *work);
static DECLARE_DELAYED_WORK(cifs_dfs_automount_task, static DECLARE_DELAYED_WORK(cifs_automount_task,
cifs_dfs_expire_automounts); cifs_expire_automounts);
static int cifs_dfs_mountpoint_expiry_timeout = 500 * HZ; static int cifs_mountpoint_expiry_timeout = 500 * HZ;
static void cifs_dfs_expire_automounts(struct work_struct *work) static void cifs_expire_automounts(struct work_struct *work)
{ {
struct list_head *list = &cifs_dfs_automount_list; struct list_head *list = &cifs_automount_list;
mark_mounts_for_expiry(list); mark_mounts_for_expiry(list);
if (!list_empty(list)) if (!list_empty(list))
schedule_delayed_work(&cifs_dfs_automount_task, schedule_delayed_work(&cifs_automount_task,
cifs_dfs_mountpoint_expiry_timeout); cifs_mountpoint_expiry_timeout);
} }
void cifs_dfs_release_automount_timer(void) void cifs_release_automount_timer(void)
{ {
BUG_ON(!list_empty(&cifs_dfs_automount_list)); if (WARN_ON(!list_empty(&cifs_automount_list)))
cancel_delayed_work_sync(&cifs_dfs_automount_task); return;
cancel_delayed_work_sync(&cifs_automount_task);
} }
/** /**
...@@ -132,7 +132,7 @@ static int set_dest_addr(struct smb3_fs_context *ctx) ...@@ -132,7 +132,7 @@ static int set_dest_addr(struct smb3_fs_context *ctx)
/* /*
* Create a vfsmount that we can automount * Create a vfsmount that we can automount
*/ */
static struct vfsmount *cifs_dfs_do_automount(struct path *path) static struct vfsmount *cifs_do_automount(struct path *path)
{ {
int rc; int rc;
struct dentry *mntpt = path->dentry; struct dentry *mntpt = path->dentry;
...@@ -214,25 +214,25 @@ static struct vfsmount *cifs_dfs_do_automount(struct path *path) ...@@ -214,25 +214,25 @@ static struct vfsmount *cifs_dfs_do_automount(struct path *path)
/* /*
* Attempt to automount the referral * Attempt to automount the referral
*/ */
struct vfsmount *cifs_dfs_d_automount(struct path *path) struct vfsmount *cifs_d_automount(struct path *path)
{ {
struct vfsmount *newmnt; struct vfsmount *newmnt;
cifs_dbg(FYI, "%s: %pd\n", __func__, path->dentry); cifs_dbg(FYI, "%s: %pd\n", __func__, path->dentry);
newmnt = cifs_dfs_do_automount(path); newmnt = cifs_do_automount(path);
if (IS_ERR(newmnt)) { if (IS_ERR(newmnt)) {
cifs_dbg(FYI, "leaving %s [automount failed]\n" , __func__); cifs_dbg(FYI, "leaving %s [automount failed]\n" , __func__);
return newmnt; return newmnt;
} }
mntget(newmnt); /* prevent immediate expiration */ mntget(newmnt); /* prevent immediate expiration */
mnt_set_expiry(newmnt, &cifs_dfs_automount_list); mnt_set_expiry(newmnt, &cifs_automount_list);
schedule_delayed_work(&cifs_dfs_automount_task, schedule_delayed_work(&cifs_automount_task,
cifs_dfs_mountpoint_expiry_timeout); cifs_mountpoint_expiry_timeout);
cifs_dbg(FYI, "leaving %s [ok]\n" , __func__); cifs_dbg(FYI, "leaving %s [ok]\n" , __func__);
return newmnt; return newmnt;
} }
const struct inode_operations cifs_dfs_referral_inode_operations = { const struct inode_operations cifs_namespace_inode_operations = {
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment