From: Christian Brauner <brauner@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
Peter Zijlstra <peterz@infradead.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.cz>, Steve French <sfrench@samba.org>,
linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org,
linux-cifs@vger.kernel.org, linux-mm@kvack.org,
"Christian Brauner (Amutable)" <brauner@kernel.org>,
Paulo Alcantara <pc@manguebit.org>
Subject: [PATCH v2 4/5] smb: prevent TIF_NOTIFY_SIGNAL from interrupting
Date: Mon, 24 Aug 2026 14:08:19 +0200 [thread overview]
Message-ID: <20260824-work-tif_notify_signal-v2-4-6609e42b3157@kernel.org> (raw)
In-Reply-To: <20260824-work-tif_notify_signal-v2-0-6609e42b3157@kernel.org>
smb blocks every signal during some sends:
sigfillset(&mask);
sigprocmask(SIG_BLOCK, &mask, &oldmask);
An incomplete or partial send would cause the connection to become out
of sync. That in turn would cause the session to be torn down and
reconnected.
In commit 00be6f26a2a7 ("smb: client: transport: avoid reconnects
triggered by pending task work") smb hand-rolled its own solution. Have
it use the new no_notify_signal_save() critical section instead.
This stops io_uring from cancelling a send in flight but that's just
like it is today and it is bounded by sk_sndtimeo at around 15s.
Acked-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
fs/smb/client/transport.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
index fdf4e50c27ce..35fa699569e9 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -22,7 +22,6 @@
#include <linux/mempool.h>
#include <linux/sched/signal.h>
#include <linux/task_io_accounting_ops.h>
-#include <linux/task_work.h>
#include "cifsglob.h"
#include "cifsproto.h"
#include "cifs_debug.h"
@@ -172,15 +171,11 @@ smb_send_kvec(struct TCP_Server_Info *server, struct msghdr *smb_msg,
* after the retries we will kill the socket and
* reconnect which may clear the network problem.
*
- * Even if regular signals are masked, EINTR might be
- * propagated from sk_stream_wait_memory() to here when
- * TIF_NOTIFY_SIGNAL is used for task work. For example,
- * certain io_uring completions will use that. Treat
- * having EINTR with pending task work the same as EAGAIN
- * to avoid unnecessary reconnects.
+ * Task work must not abort the send, see signal_pending().
*/
- rc = sock_sendmsg(ssocket, smb_msg);
- if (rc == -EAGAIN || unlikely(rc == -EINTR && task_work_pending(current))) {
+ scoped_guard(no_notify_signal)
+ rc = sock_sendmsg(ssocket, smb_msg);
+ if (rc == -EAGAIN) {
retries++;
if (retries >= 14 ||
(!server->noblocksnd && (retries > 2))) {
--
2.53.0
next prev parent reply other threads:[~2026-08-24 12:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 12:08 [PATCH v2 0/5] Stop TIF_NOTIFY_SIGNAL from interrupting work that can't be restarted Christian Brauner
2026-08-24 12:08 ` [PATCH v2 1/5] signal: allow taks to temporarily block TIF_NOTIFY_SIGNAL Christian Brauner
2026-08-24 12:08 ` [PATCH v2 2/5] coredump: prevent TIF_NOTIFY_SIGNAL from interrupting coredumps Christian Brauner
2026-08-24 12:08 ` [PATCH v2 3/5] selftests/coredump: test that TIF_NOTIFY_SIGNAL doesn't truncate a coredump Christian Brauner
2026-08-24 12:08 ` Christian Brauner [this message]
2026-08-24 12:08 ` [PATCH v2 5/5] pid_namespace: prevent TIF_NOTIFY_SIGNAL from interrupting the reaper Christian Brauner
2026-08-24 15:03 ` [PATCH v2 0/5] Stop TIF_NOTIFY_SIGNAL from interrupting work that can't be restarted Oleg Nesterov
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=20260824-work-tif_notify_signal-v2-4-6609e42b3157@kernel.org \
--to=brauner@kernel.org \
--cc=axboe@kernel.dk \
--cc=bpf@vger.kernel.org \
--cc=jack@suse.cz \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oleg@redhat.com \
--cc=pc@manguebit.org \
--cc=peterz@infradead.org \
--cc=sfrench@samba.org \
--cc=viro@zeniv.linux.org.uk \
/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