Avoid logging info and expected errors when automounting DFS links and reparse mount points as a share might contain hundreds of them and the client would end up flooding dmesg. Signed-off-by: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx> --- fs/smb/client/cifsfs.c | 4 ++-- fs/smb/client/connect.c | 3 ++- fs/smb/client/dfs.c | 3 +-- fs/smb/client/fs_context.h | 2 +- fs/smb/client/namespace.c | 5 +++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 2a2523c93944..c91cf57f337c 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -910,7 +910,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, if (cifsFYI) { cifs_dbg(FYI, "%s: devname=%s flags=0x%x\n", __func__, old_ctx->source, flags); - } else { + } else if (!old_ctx->automount) { cifs_info("Attempting to mount %s\n", old_ctx->source); } @@ -937,7 +937,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, rc = cifs_mount(cifs_sb, cifs_sb->ctx); if (rc) { - if (!(flags & SB_SILENT)) + if (!(flags & SB_SILENT) && !old_ctx->automount) cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", rc); root = ERR_PTR(rc); diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index a382f532974a..e71b6933464a 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -3390,7 +3390,8 @@ int cifs_mount_get_session(struct cifs_mount_ctx *mnt_ctx) ses = cifs_get_smb_ses(server, ctx); if (IS_ERR(ses)) { rc = PTR_ERR(ses); - if (rc == -ENOKEY && ctx->sectype == Kerberos) + if (rc == -ENOKEY && ctx->sectype == Kerberos && + !ctx->automount) cifs_dbg(VFS, "Verify user has a krb5 ticket and keyutils is installed\n"); ses = NULL; goto out; diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c index 3f6077c68d68..96db96062a8a 100644 --- a/fs/smb/client/dfs.c +++ b/fs/smb/client/dfs.c @@ -263,11 +263,10 @@ static int update_fs_context_dstaddr(struct smb3_fs_context *ctx) struct sockaddr *addr = (struct sockaddr *)&ctx->dstaddr; int rc = 0; - if (!ctx->nodfs && ctx->dfs_automount) { + if (!ctx->nodfs && ctx->automount && ctx->dfs_conn) { rc = dns_resolve_server_name_to_ip(ctx->source, addr, NULL); if (!rc) cifs_set_port(addr, ctx->port); - ctx->dfs_automount = false; } return rc; } diff --git a/fs/smb/client/fs_context.h b/fs/smb/client/fs_context.h index 69f9d938b336..5135f7b2e8d3 100644 --- a/fs/smb/client/fs_context.h +++ b/fs/smb/client/fs_context.h @@ -282,7 +282,7 @@ struct smb3_fs_context { bool witness:1; /* use witness protocol */ char *leaf_fullpath; struct cifs_ses *dfs_root_ses; - bool dfs_automount:1; /* set for dfs automount only */ + bool automount:1; /* set for automounts */ enum cifs_reparse_type reparse_type; bool dfs_conn:1; /* set for dfs mounts */ }; diff --git a/fs/smb/client/namespace.c b/fs/smb/client/namespace.c index 0f788031b740..9bfc0a592d27 100644 --- a/fs/smb/client/namespace.c +++ b/fs/smb/client/namespace.c @@ -220,6 +220,7 @@ static struct vfsmount *cifs_do_automount(struct path *path) tmp.leaf_fullpath = NULL; tmp.UNC = tmp.prepath = NULL; tmp.dfs_root_ses = NULL; + tmp.automount = true; fs_context_set_ids(&tmp); rc = smb3_fs_context_dup(ctx, &tmp); @@ -240,9 +241,9 @@ static struct vfsmount *cifs_do_automount(struct path *path) ctx->source = NULL; goto out; } - ctx->dfs_automount = ctx->dfs_conn = is_dfs_mount(mntpt); + ctx->dfs_conn = is_dfs_mount(mntpt); cifs_dbg(FYI, "%s: ctx: source=%s UNC=%s prepath=%s dfs_automount=%d\n", - __func__, ctx->source, ctx->UNC, ctx->prepath, ctx->dfs_automount); + __func__, ctx->source, ctx->UNC, ctx->prepath, ctx->dfs_conn); mnt = fc_mount(fc); out: -- 2.46.0