From: Paulo Alcantara <pc@manguebit.com>
To: smfrench@gmail.com
Cc: linux-cifs@vger.kernel.org, Paulo Alcantara <pc@manguebit.com>
Subject: [PATCH 7/9] smb: client: stop flooding dmesg with automounts
Date: Wed, 18 Sep 2024 02:15:40 -0300 [thread overview]
Message-ID: <20240918051542.64349-7-pc@manguebit.com> (raw)
In-Reply-To: <20240918051542.64349-1-pc@manguebit.com>
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@manguebit.com>
---
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
next prev parent reply other threads:[~2024-09-18 5:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 5:15 [PATCH 1/9] smb: client: avoid unnecessary reconnects when refreshing referrals Paulo Alcantara
2024-09-18 5:15 ` [PATCH 2/9] smb: client: improve purging of cached referrals Paulo Alcantara
2024-09-18 5:15 ` [PATCH 3/9] smb: client: fix DFS interlink failover Paulo Alcantara
2024-09-18 5:15 ` [PATCH 4/9] smb: client: stop flooding dmesg in smb2_calc_signature() Paulo Alcantara
2024-09-25 2:23 ` Steve French
2024-09-25 14:30 ` Paulo Alcantara
2024-09-18 5:15 ` [PATCH 5/9] smb: client: print failed session logoffs with FYI Paulo Alcantara
2024-09-18 5:15 ` [PATCH 6/9] smb: client: stop flooding dmesg on failed session setups Paulo Alcantara
2024-09-18 5:15 ` Paulo Alcantara [this message]
2024-09-18 5:15 ` [PATCH 8/9] smb: client: fix DFS failover in multiuser mounts Paulo Alcantara
2024-09-18 5:15 ` [PATCH 9/9] smb: client: propagate error from cifs_construct_tcon() Paulo Alcantara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240918051542.64349-7-pc@manguebit.com \
--to=pc@manguebit.com \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox