resolves: RHEL-127499 - Enable debug logs in cifs.upcall
Signed-off-by: Paulo Alcantara <paalcant@redhat.com>
This commit is contained in:
parent
78f467b0f6
commit
987339fab6
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,3 +30,4 @@ cifs-utils-4.6.tar.bz2
|
||||
/cifs-utils-7.1.tar.bz2
|
||||
/cifs-utils-7.2.tar.bz2
|
||||
/cifs-utils-7.4.tar.bz2
|
||||
/cifs-utils-7.5.tar.bz2
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
%global bash_completion_dir %(pkg-config --variable=completionsdir bash-completion || echo /etc/bash_completion.d)
|
||||
|
||||
Name: cifs-utils
|
||||
Version: 7.4
|
||||
Version: 7.5
|
||||
Release: %autorelease
|
||||
Summary: Utilities for mounting and managing CIFS mounts
|
||||
|
||||
@ -24,8 +24,9 @@ Recommends: %{name}-info%{?_isa} = %{version}-%{release}
|
||||
|
||||
Source0: https://download.samba.org/pub/linux-cifs/cifs-utils/%{name}-%{version}.tar.bz2
|
||||
|
||||
Patch0: cifscreds-fix-parsing-of-commands-and-parameters.patch
|
||||
Patch1: docs-update-echo_interval-description.patch
|
||||
Patch0: cifs.upcall-add-option-to-enable-debug-logs.patch
|
||||
Patch1: docs-Enable-debug-logs.patch
|
||||
Patch2: cifs.upcall-Adjust-log-level.patch
|
||||
|
||||
%description
|
||||
The SMB/CIFS protocol is a standard file sharing protocol widely deployed
|
||||
|
||||
41
cifs.upcall-Adjust-log-level.patch
Normal file
41
cifs.upcall-Adjust-log-level.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 927123ede36fab4a68aea6f6a3495ad909430ed1 Mon Sep 17 00:00:00 2001
|
||||
From: Pierguido Lambri <plambri@redhat.com>
|
||||
Date: Fri, 30 Jan 2026 14:11:28 +0000
|
||||
Subject: [PATCH 3/3] cifs.upcall: Adjust log level
|
||||
|
||||
Because now only error message are logged, let's switch some messages
|
||||
from DEBUG to ERROR level.
|
||||
This will help see when an error occurred with cifs.upcall and
|
||||
eventually turn on the debug mode.
|
||||
|
||||
Signed-off-by: Pierguido Lambri <plambri@redhat.com>
|
||||
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
|
||||
---
|
||||
cifs.upcall.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cifs.upcall.c b/cifs.upcall.c
|
||||
index b57a48c743e4..9d0eecf3aa11 100644
|
||||
--- a/cifs.upcall.c
|
||||
+++ b/cifs.upcall.c
|
||||
@@ -1618,7 +1618,7 @@ int main(const int argc, char *const argv[])
|
||||
__func__);
|
||||
} else {
|
||||
if (!get_tgt_time(ccache)) {
|
||||
- syslog(LOG_DEBUG, "%s: valid TGT is not present in credential cache",
|
||||
+ syslog(LOG_ERR, "%s: valid TGT is not present in credential cache",
|
||||
__func__);
|
||||
krb5_cc_close(context, ccache);
|
||||
ccache = NULL;
|
||||
@@ -1721,7 +1721,7 @@ retry_new_hostname:
|
||||
}
|
||||
|
||||
if (rc) {
|
||||
- syslog(LOG_DEBUG, "Unable to obtain service ticket");
|
||||
+ syslog(LOG_ERR, "Unable to obtain service ticket");
|
||||
goto out;
|
||||
}
|
||||
|
||||
--
|
||||
2.52.0
|
||||
|
||||
68
cifs.upcall-add-option-to-enable-debug-logs.patch
Normal file
68
cifs.upcall-add-option-to-enable-debug-logs.patch
Normal file
@ -0,0 +1,68 @@
|
||||
From 3047b9ccefdcf6327bf060ebf0d40864c5b1a11e Mon Sep 17 00:00:00 2001
|
||||
From: Pierguido Lambri <plambri@redhat.com>
|
||||
Date: Fri, 30 Jan 2026 14:11:26 +0000
|
||||
Subject: [PATCH 1/3] cifs.upcall: add option to enable debug logs
|
||||
|
||||
cifs.upcall uses two levels of logs, DEBUG and ERR.
|
||||
However, when using systemd, these logs will always be recorded.
|
||||
When the system does a lot of upcalls, the journal could be filled
|
||||
with debug logs, which may not be useful at that time.
|
||||
Added then a new option '-d' to enable debug logs only when needed.
|
||||
This will set a logmask up to LOG_DEBUG instead of the default
|
||||
of LOG_ERR, thus reducing the amount of logs when no debug is needed.
|
||||
|
||||
Signed-off-by: Pierguido Lambri <plambri@redhat.com>
|
||||
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
|
||||
---
|
||||
cifs.upcall.c | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cifs.upcall.c b/cifs.upcall.c
|
||||
index 69e27a34f637..b57a48c743e4 100644
|
||||
--- a/cifs.upcall.c
|
||||
+++ b/cifs.upcall.c
|
||||
@@ -1356,10 +1356,11 @@ lowercase_string(char *c)
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
- fprintf(stderr, "Usage: %s [ -K /path/to/keytab] [-k /path/to/krb5.conf] [-E] [-t] [-v] [-l] [-e nsecs] key_serial\n", prog);
|
||||
+ fprintf(stderr, "Usage: %s [ -K /path/to/keytab] [-k /path/to/krb5.conf] [-d] [-E] [-t] [-v] [-l] [-e nsecs] key_serial\n", prog);
|
||||
}
|
||||
|
||||
static const struct option long_options[] = {
|
||||
+ {"debug", 0, NULL, 'd'},
|
||||
{"no-env-probe", 0, NULL, 'E'},
|
||||
{"krb5conf", 1, NULL, 'k'},
|
||||
{"legacy-uid", 0, NULL, 'l'},
|
||||
@@ -1379,6 +1380,7 @@ int main(const int argc, char *const argv[])
|
||||
size_t datalen;
|
||||
long rc = 1;
|
||||
int c;
|
||||
+ int mask;
|
||||
bool try_dns = false, legacy_uid = false , env_probe = true;
|
||||
char *buf;
|
||||
char hostbuf[NI_MAXHOST], *host;
|
||||
@@ -1395,12 +1397,19 @@ int main(const int argc, char *const argv[])
|
||||
hostbuf[0] = '\0';
|
||||
|
||||
openlog(prog, 0, LOG_DAEMON);
|
||||
+ mask = LOG_UPTO(LOG_ERR);
|
||||
+ setlogmask(mask);
|
||||
|
||||
- while ((c = getopt_long(argc, argv, "cEk:K:ltve:", long_options, NULL)) != -1) {
|
||||
+ while ((c = getopt_long(argc, argv, "cdEk:K:ltve:", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
/* legacy option -- skip it */
|
||||
break;
|
||||
+ case 'd':
|
||||
+ /* enable debug logs */
|
||||
+ mask = LOG_UPTO(LOG_DEBUG);
|
||||
+ setlogmask(mask);
|
||||
+ break;
|
||||
case 'E':
|
||||
/* skip probing initiating process env */
|
||||
env_probe = false;
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
From 828cb25224cd88b3599d5ca79a7c9435491896db Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Alcantara <pc@manguebit.org>
|
||||
Date: Tue, 25 Nov 2025 16:30:27 -0300
|
||||
Subject: [PATCH 1/2] cifscreds: fix parsing of commands and parameters
|
||||
|
||||
Fix the parsing of '--username' and '--timeout' options as both
|
||||
require an argument by fixing the value passed in @optstring when
|
||||
calling getopt_long(3).
|
||||
|
||||
Also fix the matching of commands by breaking the loop when an exact
|
||||
match is found. Otherwise `cifscreds clear ...` would return
|
||||
"Ambiguous command" due to "clearall" command.
|
||||
|
||||
* Before patch
|
||||
|
||||
$ ./cifscreds add -u testuser w22-root2.zelda.test
|
||||
error: Could not resolve address for testuser
|
||||
$ ./cifscreds add -u testuser -d ZELDA
|
||||
Password:
|
||||
$ grep 'cifs:[ad]' /proc/keys
|
||||
198de7a1 I--Q--- 1 perm 0d0d0000 0 0 logon cifs:d:testuser: 13
|
||||
^^ wrong desc
|
||||
$ ./cifscreds clear -u testuser w22-root2.zelda.test
|
||||
Ambiguous command
|
||||
$ ./cifscreds clear -u testuser -d ZELDA
|
||||
Ambiguous command
|
||||
|
||||
* After patch
|
||||
|
||||
$ ./cifscreds add -u testuser w22-root2.zelda.test
|
||||
Password:
|
||||
$ ./cifscreds add -u testuser -d ZELDA
|
||||
Password:
|
||||
$ grep 'cifs:[ad]' /proc/keys
|
||||
089183a9 I--Q--- 1 perm 0d0d0000 0 0 logon cifs:a:192.168.124.32: 17
|
||||
0ca5ed80 I--Q--- 1 perm 0d0d0000 0 0 logon cifs:d:ZELDA: 17
|
||||
$ ./cifscreds clear -u testuser w22-root2.zelda.test
|
||||
$ ./cifscreds clear -u testuser -d ZELDA
|
||||
|
||||
Reported-by: Xiaoli Feng <xifeng@redhat.com>
|
||||
Reported-by: Jay Shin <jaeshin@redhat.com>
|
||||
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
|
||||
Cc: Steve French <smfrench@gmail.com>
|
||||
Cc: linux-cifs@vger.kernel.org
|
||||
---
|
||||
cifscreds.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/cifscreds.c b/cifscreds.c
|
||||
index 295059f9683d..e8713be23d71 100644
|
||||
--- a/cifscreds.c
|
||||
+++ b/cifscreds.c
|
||||
@@ -71,7 +71,7 @@ static struct command commands[] = {
|
||||
static struct option longopts[] = {
|
||||
{"username", 1, NULL, 'u'},
|
||||
{"domain", 0, NULL, 'd' },
|
||||
- {"timeout", 0, NULL, 't' },
|
||||
+ {"timeout", 1, NULL, 't' },
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -477,7 +477,7 @@ int main(int argc, char **argv)
|
||||
if (argc == 1)
|
||||
return usage();
|
||||
|
||||
- while((n = getopt_long(argc, argv, "dut:", longopts, NULL)) != -1) {
|
||||
+ while((n = getopt_long(argc, argv, "du:t:", longopts, NULL)) != -1) {
|
||||
switch (n) {
|
||||
case 'd':
|
||||
arg.keytype = (char) n;
|
||||
@@ -507,7 +507,7 @@ int main(int argc, char **argv)
|
||||
if (cmd->name[n] == 0) {
|
||||
/* exact match */
|
||||
best = cmd;
|
||||
- continue;
|
||||
+ break;
|
||||
}
|
||||
|
||||
/* partial match */
|
||||
--
|
||||
2.51.1
|
||||
|
||||
41
docs-Enable-debug-logs.patch
Normal file
41
docs-Enable-debug-logs.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 224512b9e62c886fd8d9802bc50a7702c4fe4517 Mon Sep 17 00:00:00 2001
|
||||
From: Pierguido Lambri <plambri@redhat.com>
|
||||
Date: Fri, 30 Jan 2026 14:11:27 +0000
|
||||
Subject: [PATCH 2/3] docs: Enable debug logs
|
||||
|
||||
Documented a new option '-d' to enable debug logs.
|
||||
By default only error logs are enabled, with this new option
|
||||
debug logs can be enabled when needed.
|
||||
|
||||
Signed-off-by: Pierguido Lambri <plambri@redhat.com>
|
||||
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
|
||||
---
|
||||
cifs.upcall.rst.in | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cifs.upcall.rst.in b/cifs.upcall.rst.in
|
||||
index 09d0503591d6..895efc53ef50 100644
|
||||
--- a/cifs.upcall.rst.in
|
||||
+++ b/cifs.upcall.rst.in
|
||||
@@ -11,7 +11,7 @@ Userspace upcall helper for Common Internet File System (CIFS)
|
||||
SYNOPSIS
|
||||
********
|
||||
|
||||
- cifs.upcall [--trust-dns|-t] [--version|-v] [--legacy-uid|-l]
|
||||
+ cifs.upcall [--trust-dns|-t] [--version|-v] [--legacy-uid|-l] [--debug|-d]
|
||||
[--krb5conf=/path/to/krb5.conf|-k /path/to/krb5.conf]
|
||||
[--keytab=/path/to/keytab|-K /path/to/keytab] [--expire|-e nsecs] {keyid}
|
||||
|
||||
@@ -38,6 +38,9 @@ OPTIONS
|
||||
-c
|
||||
This option is deprecated and is currently ignored.
|
||||
|
||||
+--debug|-d
|
||||
+ Enable debug logs. By default no debug messages are logged, only errors.
|
||||
+
|
||||
--no-env-probe|-E
|
||||
Normally, ``cifs.upcall`` will probe the environment variable space of
|
||||
the process that initiated the upcall in order to fetch the value of
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From b9680e868d4bdf9337e542b08a559e9ca5ea6cc0 Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Alcantara <pc@manguebit.org>
|
||||
Date: Tue, 25 Nov 2025 17:54:04 -0300
|
||||
Subject: [PATCH 2/2] docs: update echo_interval description
|
||||
|
||||
It is '3 * echo_interval' since upstream commit f2caf901c1b7 ("cifs:
|
||||
Fix a race condition with cifs_echo_request").
|
||||
|
||||
Reported-by: Alexandros Panagiotou <apanagio@redhat.com>
|
||||
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
|
||||
Cc: Steve French <smfrench@gmail.com>
|
||||
Cc: linux-cifs@vger.kernel.org
|
||||
---
|
||||
mount.cifs.rst | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/mount.cifs.rst b/mount.cifs.rst
|
||||
index d4890706a0fe..4b6d47447c0e 100644
|
||||
--- a/mount.cifs.rst
|
||||
+++ b/mount.cifs.rst
|
||||
@@ -483,8 +483,8 @@ echo_interval=n
|
||||
sets the interval at which echo requests are sent to the server on an
|
||||
idling connection. This setting also affects the time required for a
|
||||
connection to an unresponsive server to timeout. Here n is the echo
|
||||
- interval in seconds. The reconnection happens at twice the value of the
|
||||
- echo_interval set for an unresponsive server.
|
||||
+ interval in seconds. The reconnection happens at three times the
|
||||
+ value of the echo_interval set for an unresponsive server.
|
||||
If this option is not given then the default value of 60 seconds is used.
|
||||
The minimum tunable value is 1 second and maximum can go up to 600 seconds.
|
||||
|
||||
--
|
||||
2.51.1
|
||||
|
||||
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (cifs-utils-7.4.tar.bz2) = 36fb64ed531e983752be243be488392ba52c3797ac638147a75998b8965448009e95d7ccda187c7d50d753b0ddb87a464a83044064b099d49fffe03a0b6ba739
|
||||
SHA512 (cifs-utils-7.5.tar.bz2) = d44b26ca3224160bcb4fc712eb6c6d09fcfee196197d46481e95333494eaae1a4851712fba9b922c203e3cd301c481b433ff49ec396428c12ff7db3c628ce9e9
|
||||
|
||||
Loading…
Reference in New Issue
Block a user