* FAILED: patch "[PATCH] nilfs2: ignore non-fatal signals during synchronous log write wait" failed to apply to 6.1-stable tree
@ 2026-11-07 10:43 Sasha Levin
2026-11-10 13:22 ` [PATCH 6.1.y 1/2] nilfs2: correct return value kernel-doc descriptions for the rest Sasha Levin
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Sasha Levin @ 2026-11-07 10:43 UTC (permalink / raw)
To: konishi.ryusuke, wangjianjian3, slava; +Cc: stable
The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 7131aaa74bcc7c9da1f1d1c8724da75c775557a0
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107054332-failed-6.1-7131aaa74bcc@kernel.org' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 7131aaa74bcc7c9da1f1d1c8724da75c775557a0 Mon Sep 17 00:00:00 2001
From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date: Wed, 30 Sep 2026 03:26:54 +0900
Subject: [PATCH] nilfs2: ignore non-fatal signals during synchronous log write
wait
Based on a syzbot report, Wang Jianjian pointed out that following a
successful directory operation in nilfs_rename(), a synchronous write
requested within nilfs_transaction_commit(), triggered by a sync flag
set by nilfs_commit_chunk(), could be interrupted by a user signal.
This interruption leaves in-memory metadata updates intact while
returning an error, causing inconsistency with the VFS dentry cache and
ultimately triggering a kernel warning.
According to "signal(7)", local disks are not classified as "slow
devices" (such as terminals, FIFOs, or pipes) and their I/O operations
on disk devices are not interrupted by signals. In kernel space,
waiting for such disk I/O should therefore not be aborted by ordinary
(non-fatal) signals.
Suppress this issue by modifying nilfs_segctor_sync(), which waits for
the log writer thread to complete synchronous writes, to catch only
fatal signals via fatal_signal_pending() and return -EINTR rather than
-ERESTARTSYS. To complement this change and prevent the wait loop from
busy-looping when schedule() returns immediately due to a pending
non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
TASK_KILLABLE.
This serves as an effective interim stabilization measure without
structural changes until a comprehensive fix for metadata consistency
is implemented.
Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Cc: Wang Jianjian <wangjianjian3@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
---
fs/nilfs2/ioctl.c | 2 +-
fs/nilfs2/recovery.c | 2 +-
fs/nilfs2/segment.c | 10 +++++-----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 01a04080ef704..b2b67d6a1f097 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -965,10 +965,10 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
* Return: 0 on success, or one of the following negative error codes on
* failure:
* * %-EFAULT - Failure during execution of requested operation.
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error.
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index 9a70c28ec94c1..abe4101f7550c 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -790,11 +790,11 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
*
* Return: 0 on success, or one of the following negative error codes on
* failure:
+ * * %-EINTR - Interrupted.
* * %-EINVAL - Inconsistent filesystem state.
* * %-EIO - I/O error.
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
*/
int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
struct super_block *sb,
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 2f0e59847d026..af0c3560444f5 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2259,7 +2259,7 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
wake_up(&sci->sc_wait_daemon);
for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
+ set_current_state(TASK_KILLABLE);
/*
* Synchronize only while the log writer thread is alive.
@@ -2273,11 +2273,11 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
err = wait_req.err;
break;
}
- if (!signal_pending(current)) {
+ if (!fatal_signal_pending(current)) {
schedule();
continue;
}
- err = -ERESTARTSYS;
+ err = -EINTR;
break;
}
finish_wait(&sci->sc_wait_request, &wait_req.wq);
@@ -2311,10 +2311,10 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
*
* Return: 0 on success, or one of the following negative error codes on
* failure:
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error (including metadata corruption).
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
int nilfs_construct_segment(struct super_block *sb)
@@ -2341,10 +2341,10 @@ int nilfs_construct_segment(struct super_block *sb)
*
* Return: 0 on success, or one of the following negative error codes on
* failure:
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error (including metadata corruption).
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6.1.y 1/2] nilfs2: correct return value kernel-doc descriptions for the rest
2026-11-07 10:43 FAILED: patch "[PATCH] nilfs2: ignore non-fatal signals during synchronous log write wait" failed to apply to 6.1-stable tree Sasha Levin
@ 2026-11-10 13:22 ` Sasha Levin
2026-11-10 13:22 ` [PATCH 6.1.y 2/2] nilfs2: ignore non-fatal signals during synchronous log write wait Sasha Levin
2026-11-11 1:31 ` [PATCH 6.1.y] " Wang Jianjian
2026-11-11 1:55 ` Wang Jianjian
2 siblings, 1 reply; 9+ messages in thread
From: Sasha Levin @ 2026-11-10 13:22 UTC (permalink / raw)
To: stable; +Cc: Ryusuke Konishi, Brian G ., Andrew Morton, Sasha Levin
From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
[ Upstream commit 343d4a33f26d048fde4b02cfc3681f766b3f1b12 ]
Similar to the previous changes to fix return value descriptions, this
fixes the format of the return value descriptions of functions for the
rest.
Link: https://lkml.kernel.org/r/20250110010530.21872-6-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: "Brian G ." <gissf1@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 7131aaa74bcc ("nilfs2: ignore non-fatal signals during synchronous log write wait")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nilfs2/gcinode.c | 24 +++++++++-------------
fs/nilfs2/inode.c | 12 +++--------
fs/nilfs2/recovery.c | 32 +++++++++++------------------
fs/nilfs2/segbuf.c | 12 ++---------
fs/nilfs2/segment.c | 48 ++++++++++++++++---------------------------
fs/nilfs2/the_nilfs.c | 12 +++++------
6 files changed, 50 insertions(+), 90 deletions(-)
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 8cdb1dc76f612..1e7de19e58306 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -46,14 +46,11 @@
* specified by @pbn to the GC pagecache with the key @blkoff.
* This function sets @vbn (@pbn if @vbn is zero) in b_blocknr of the buffer.
*
- * Return Value: On success, 0 is returned. On Error, one of the following
- * negative error code is returned.
- *
- * %-EIO - I/O error.
- *
- * %-ENOMEM - Insufficient amount of memory available.
- *
- * %-ENOENT - The block specified with @pbn does not exist.
+ * Return: 0 on success, or one of the following negative error codes on
+ * failure:
+ * * %-EIO - I/O error (including metadata corruption).
+ * * %-ENOENT - The block specified with @pbn does not exist.
+ * * %-ENOMEM - Insufficient memory available.
*/
int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
sector_t pbn, __u64 vbn,
@@ -114,12 +111,11 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
* specified by @vbn to the GC pagecache. @pbn can be supplied by the
* caller to avoid translation of the disk block address.
*
- * Return Value: On success, 0 is returned. On Error, one of the following
- * negative error code is returned.
- *
- * %-EIO - I/O error.
- *
- * %-ENOMEM - Insufficient amount of memory available.
+ * Return: 0 on success, or one of the following negative error codes on
+ * failure:
+ * * %-EIO - I/O error (including metadata corruption).
+ * * %-ENOENT - Invalid virtual block address.
+ * * %-ENOMEM - Insufficient memory available.
*/
int nilfs_gccache_submit_read_node(struct inode *inode, sector_t pbn,
__u64 vbn, struct buffer_head **out_bh)
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index a20d52951f1ef..eaf4e61113afd 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -676,10 +676,7 @@ struct inode *nilfs_iget_for_gc(struct super_block *sb, unsigned long ino,
* or does nothing if the inode already has it. This function allocates
* an additional inode to maintain page cache of B-tree nodes one-on-one.
*
- * Return Value: On success, 0 is returned. On errors, one of the following
- * negative error code is returned.
- *
- * %-ENOMEM - Insufficient memory available.
+ * Return: 0 on success, or %-ENOMEM if memory is insufficient.
*/
int nilfs_attach_btree_node_cache(struct inode *inode)
{
@@ -740,11 +737,8 @@ void nilfs_detach_btree_node_cache(struct inode *inode)
* in one inode and the one for b-tree node pages is set up in the
* other inode, which is attached to the former inode.
*
- * Return Value: On success, a pointer to the inode for data pages is
- * returned. On errors, one of the following negative error code is returned
- * in a pointer type.
- *
- * %-ENOMEM - Insufficient memory available.
+ * Return: a pointer to the inode for data pages on success, or %-ENOMEM
+ * if memory is insufficient.
*/
struct inode *nilfs_iget_for_shadow(struct inode *inode)
{
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index ce30b51ac593c..b5207e4c50007 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -741,18 +741,13 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
* @sb: super block instance
* @ri: pointer to a nilfs_recovery_info struct to store search results.
*
- * Return Value: On success, 0 is returned. On error, one of the following
- * negative error code is returned.
- *
- * %-EINVAL - Inconsistent filesystem state.
- *
- * %-EIO - I/O error
- *
- * %-ENOSPC - No space left on device (only in a panic state).
- *
- * %-ERESTARTSYS - Interrupted.
- *
- * %-ENOMEM - Insufficient memory available.
+ * Return: 0 on success, or one of the following negative error codes on
+ * failure:
+ * * %-EINVAL - Inconsistent filesystem state.
+ * * %-EIO - I/O error.
+ * * %-ENOMEM - Insufficient memory available.
+ * * %-ENOSPC - No space left on device (only in a panic state).
+ * * %-ERESTARTSYS - Interrupted.
*/
int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
struct super_block *sb,
@@ -817,14 +812,11 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
* segment pointed by the superblock. It sets up struct the_nilfs through
* this search. It fills nilfs_recovery_info (ri) required for recovery.
*
- * Return Value: On success, 0 is returned. On error, one of the following
- * negative error code is returned.
- *
- * %-EINVAL - No valid segment found
- *
- * %-EIO - I/O error
- *
- * %-ENOMEM - Insufficient memory available.
+ * Return: 0 on success, or one of the following negative error codes on
+ * failure:
+ * * %-EINVAL - No valid segment found.
+ * * %-EIO - I/O error.
+ * * %-ENOMEM - Insufficient memory available.
*/
int nilfs_search_super_root(struct the_nilfs *nilfs,
struct nilfs_recovery_info *ri)
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index 6e59dc19a7324..7416fb6e3fd4b 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -403,12 +403,7 @@ static int nilfs_segbuf_submit_bh(struct nilfs_segment_buffer *segbuf,
* @segbuf: buffer storing a log to be written
* @nilfs: nilfs object
*
- * Return Value: On Success, 0 is returned. On Error, one of the following
- * negative error code is returned.
- *
- * %-EIO - I/O error
- *
- * %-ENOMEM - Insufficient memory available.
+ * Return: Always 0.
*/
static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf,
struct the_nilfs *nilfs)
@@ -449,10 +444,7 @@ static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf,
* nilfs_segbuf_wait - wait for completion of requested BIOs
* @segbuf: segment buffer
*
- * Return Value: On Success, 0 is returned. On Error, one of the following
- * negative error code is returned.
- *
- * %-EIO - I/O error
+ * Return: 0 on success, or %-EIO if I/O error is detected.
*/
static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf)
{
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index a412abdfbbf3e..92631394c8d29 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -191,12 +191,10 @@ static int nilfs_prepare_segment_lock(struct super_block *sb,
* When @vacancy_check flag is set, this function will check the amount of
* free space, and will wait for the GC to reclaim disk space if low capacity.
*
- * Return Value: On success, 0 is returned. On error, one of the following
- * negative error code is returned.
- *
- * %-ENOMEM - Insufficient memory available.
- *
- * %-ENOSPC - No space left on device
+ * Return: 0 on success, or one of the following negative error codes on
+ * failure:
+ * * %-ENOMEM - Insufficient memory available.
+ * * %-ENOSPC - No space left on device (if checking free space).
*/
int nilfs_transaction_begin(struct super_block *sb,
struct nilfs_transaction_info *ti,
@@ -2286,18 +2284,13 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
* nilfs_construct_segment - construct a logical segment
* @sb: super block
*
- * Return Value: On success, 0 is returned. On errors, one of the following
- * negative error code is returned.
- *
- * %-EROFS - Read only filesystem.
- *
- * %-EIO - I/O error
- *
- * %-ENOSPC - No space left on device (only in a panic state).
- *
- * %-ERESTARTSYS - Interrupted.
- *
- * %-ENOMEM - Insufficient memory available.
+ * Return: 0 on success, or one of the following negative error codes on
+ * failure:
+ * * %-EIO - I/O error (including metadata corruption).
+ * * %-ENOMEM - Insufficient memory available.
+ * * %-ENOSPC - No space left on device (only in a panic state).
+ * * %-ERESTARTSYS - Interrupted.
+ * * %-EROFS - Read only filesystem.
*/
int nilfs_construct_segment(struct super_block *sb)
{
@@ -2321,18 +2314,13 @@ int nilfs_construct_segment(struct super_block *sb)
* @start: start byte offset
* @end: end byte offset (inclusive)
*
- * Return Value: On success, 0 is returned. On errors, one of the following
- * negative error code is returned.
- *
- * %-EROFS - Read only filesystem.
- *
- * %-EIO - I/O error
- *
- * %-ENOSPC - No space left on device (only in a panic state).
- *
- * %-ERESTARTSYS - Interrupted.
- *
- * %-ENOMEM - Insufficient memory available.
+ * Return: 0 on success, or one of the following negative error codes on
+ * failure:
+ * * %-EIO - I/O error (including metadata corruption).
+ * * %-ENOMEM - Insufficient memory available.
+ * * %-ENOSPC - No space left on device (only in a panic state).
+ * * %-ERESTARTSYS - Interrupted.
+ * * %-EROFS - Read only filesystem.
*/
int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
loff_t start, loff_t end)
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index f9b10b4e22c01..013aea9dc355d 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -50,8 +50,8 @@ void nilfs_set_last_segment(struct the_nilfs *nilfs,
* alloc_nilfs - allocate a nilfs object
* @sb: super block instance
*
- * Return Value: On success, pointer to the_nilfs is returned.
- * On error, NULL is returned.
+ * Return: a pointer to the allocated nilfs object on success, or NULL on
+ * failure.
*/
struct the_nilfs *alloc_nilfs(struct super_block *sb)
{
@@ -202,8 +202,7 @@ static int nilfs_store_log_cursor(struct the_nilfs *nilfs,
* exponent information written in @sbp and stores it in @blocksize,
* or aborts with an error message if it's too large.
*
- * Return Value: On success, 0 is returned. If the block size is too
- * large, -EINVAL is returned.
+ * Return: 0 on success, or %-EINVAL if the block size is too large.
*/
static int nilfs_get_blocksize(struct super_block *sb,
struct nilfs_super_block *sbp, int *blocksize)
@@ -546,7 +545,7 @@ static int nilfs_valid_sb(struct nilfs_super_block *sbp)
* area, or if the parameters themselves are not normal, it is
* determined to be invalid.
*
- * Return Value: true if invalid, false if valid.
+ * Return: true if invalid, false if valid.
*/
static bool nilfs_sb2_bad_offset(struct nilfs_super_block *sbp, u64 offset)
{
@@ -677,8 +676,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
* reading the super block, getting disk layout information, initializing
* shared fields in the_nilfs).
*
- * Return Value: On success, 0 is returned. On error, a negative error
- * code is returned.
+ * Return: 0 on success, or a negative error code on failure.
*/
int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6.1.y 2/2] nilfs2: ignore non-fatal signals during synchronous log write wait
2026-11-10 13:22 ` [PATCH 6.1.y 1/2] nilfs2: correct return value kernel-doc descriptions for the rest Sasha Levin
@ 2026-11-10 13:22 ` Sasha Levin
0 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-11-10 13:22 UTC (permalink / raw)
To: stable
Cc: Ryusuke Konishi, syzbot+f6c7e1f1809f235eeb90, Wang Jianjian,
Viacheslav Dubeyko, Sasha Levin
From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
[ Upstream commit 7131aaa74bcc7c9da1f1d1c8724da75c775557a0 ]
Based on a syzbot report, Wang Jianjian pointed out that following a
successful directory operation in nilfs_rename(), a synchronous write
requested within nilfs_transaction_commit(), triggered by a sync flag
set by nilfs_commit_chunk(), could be interrupted by a user signal.
This interruption leaves in-memory metadata updates intact while
returning an error, causing inconsistency with the VFS dentry cache and
ultimately triggering a kernel warning.
According to "signal(7)", local disks are not classified as "slow
devices" (such as terminals, FIFOs, or pipes) and their I/O operations
on disk devices are not interrupted by signals. In kernel space,
waiting for such disk I/O should therefore not be aborted by ordinary
(non-fatal) signals.
Suppress this issue by modifying nilfs_segctor_sync(), which waits for
the log writer thread to complete synchronous writes, to catch only
fatal signals via fatal_signal_pending() and return -EINTR rather than
-ERESTARTSYS. To complement this change and prevent the wait loop from
busy-looping when schedule() returns immediately due to a pending
non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
TASK_KILLABLE.
This serves as an effective interim stabilization measure without
structural changes until a comprehensive fix for metadata consistency
is implemented.
Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Cc: Wang Jianjian <wangjianjian3@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nilfs2/ioctl.c | 2 +-
fs/nilfs2/recovery.c | 2 +-
fs/nilfs2/segment.c | 10 +++++-----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 4e964549bc4ce..cbbe49bb4926b 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -960,10 +960,10 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
* Return: 0 on success, or one of the following negative error codes on
* failure:
* * %-EFAULT - Failure during execution of requested operation.
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error.
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index b5207e4c50007..af1b2a6a93db7 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -743,11 +743,11 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
*
* Return: 0 on success, or one of the following negative error codes on
* failure:
+ * * %-EINTR - Interrupted.
* * %-EINVAL - Inconsistent filesystem state.
* * %-EIO - I/O error.
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
*/
int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
struct super_block *sb,
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 92631394c8d29..e1f4859b2db54 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2234,7 +2234,7 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
wake_up(&sci->sc_wait_daemon);
for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
+ set_current_state(TASK_KILLABLE);
/*
* Synchronize only while the log writer thread is alive.
@@ -2248,11 +2248,11 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
err = wait_req.err;
break;
}
- if (!signal_pending(current)) {
+ if (!fatal_signal_pending(current)) {
schedule();
continue;
}
- err = -ERESTARTSYS;
+ err = -EINTR;
break;
}
finish_wait(&sci->sc_wait_request, &wait_req.wq);
@@ -2286,10 +2286,10 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
*
* Return: 0 on success, or one of the following negative error codes on
* failure:
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error (including metadata corruption).
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
int nilfs_construct_segment(struct super_block *sb)
@@ -2316,10 +2316,10 @@ int nilfs_construct_segment(struct super_block *sb)
*
* Return: 0 on success, or one of the following negative error codes on
* failure:
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error (including metadata corruption).
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6.1.y] nilfs2: ignore non-fatal signals during synchronous log write wait
2026-11-07 10:43 FAILED: patch "[PATCH] nilfs2: ignore non-fatal signals during synchronous log write wait" failed to apply to 6.1-stable tree Sasha Levin
2026-11-10 13:22 ` [PATCH 6.1.y 1/2] nilfs2: correct return value kernel-doc descriptions for the rest Sasha Levin
@ 2026-11-11 1:31 ` Wang Jianjian
2026-11-11 1:59 ` Ryusuke Konishi
2026-11-11 1:59 ` wangjianjian (C)
2026-11-11 1:55 ` Wang Jianjian
2 siblings, 2 replies; 9+ messages in thread
From: Wang Jianjian @ 2026-11-11 1:31 UTC (permalink / raw)
To: stable
Cc: Ryusuke Konishi, syzbot+f6c7e1f1809f235eeb90, Wang Jianjian,
Viacheslav Dubeyko
From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Based on a syzbot report, Wang Jianjian pointed out that following a
successful directory operation in nilfs_rename(), a synchronous write
requested within nilfs_transaction_commit(), triggered by a sync flag
set by nilfs_commit_chunk(), could be interrupted by a user signal.
This interruption leaves in-memory metadata updates intact while
returning an error, causing inconsistency with the VFS dentry cache and
ultimately triggering a kernel warning.
According to "signal(7)", local disks are not classified as "slow
devices" (such as terminals, FIFOs, or pipes) and their I/O operations
on disk devices are not interrupted by signals. In kernel space,
waiting for such disk I/O should therefore not be aborted by ordinary
(non-fatal) signals.
Suppress this issue by modifying nilfs_segctor_sync(), which waits for
the log writer thread to complete synchronous writes, to catch only
fatal signals via fatal_signal_pending() and return -EINTR rather than
-ERESTARTSYS. To complement this change and prevent the wait loop from
busy-looping when schedule() returns immediately due to a pending
non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
TASK_KILLABLE.
This serves as an effective interim stabilization measure without
structural changes until a comprehensive fix for metadata consistency
is implemented.
Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Cc: Wang Jianjian <wangjianjian3@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
(cherry picked from commit 7131aaa74bcc7c9da1f1d1c8724da75c775557a0)
---
fs/nilfs2/ioctl.c | 2 +-
fs/nilfs2/recovery.c | 2 ++
fs/nilfs2/segment.c | 10 +++++++---
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 4e964549bc4c..cbbe49bb4926 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -960,10 +960,10 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
* Return: 0 on success, or one of the following negative error codes on
* failure:
* * %-EFAULT - Failure during execution of requested operation.
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error.
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index ce30b51ac593..34462039ae7d 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -744,6 +744,8 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
* Return Value: On success, 0 is returned. On error, one of the following
* negative error code is returned.
*
+ * %-EINTR - Interrupted.
+ *
* %-EINVAL - Inconsistent filesystem state.
*
* %-EIO - I/O error
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index a412abdfbbf3..3a256f786db2 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2236,7 +2236,7 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
wake_up(&sci->sc_wait_daemon);
for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
+ set_current_state(TASK_KILLABLE);
/*
* Synchronize only while the log writer thread is alive.
@@ -2250,11 +2250,11 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
err = wait_req.err;
break;
}
- if (!signal_pending(current)) {
+ if (!fatal_signal_pending(current)) {
schedule();
continue;
}
- err = -ERESTARTSYS;
+ err = -EINTR;
break;
}
finish_wait(&sci->sc_wait_request, &wait_req.wq);
@@ -2289,6 +2289,8 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
* Return Value: On success, 0 is returned. On errors, one of the following
* negative error code is returned.
*
+ * %-EINTR - Interrupted.
+ *
* %-EROFS - Read only filesystem.
*
* %-EIO - I/O error
@@ -2324,6 +2326,8 @@ int nilfs_construct_segment(struct super_block *sb)
* Return Value: On success, 0 is returned. On errors, one of the following
* negative error code is returned.
*
+ * %-EINTR - Interrupted.
+ *
* %-EROFS - Read only filesystem.
*
* %-EIO - I/O error
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6.1.y] nilfs2: ignore non-fatal signals during synchronous log write wait
2026-11-07 10:43 FAILED: patch "[PATCH] nilfs2: ignore non-fatal signals during synchronous log write wait" failed to apply to 6.1-stable tree Sasha Levin
2026-11-10 13:22 ` [PATCH 6.1.y 1/2] nilfs2: correct return value kernel-doc descriptions for the rest Sasha Levin
2026-11-11 1:31 ` [PATCH 6.1.y] " Wang Jianjian
@ 2026-11-11 1:55 ` Wang Jianjian
2 siblings, 0 replies; 9+ messages in thread
From: Wang Jianjian @ 2026-11-11 1:55 UTC (permalink / raw)
To: stable
Cc: Ryusuke Konishi, syzbot+f6c7e1f1809f235eeb90, Wang Jianjian,
Viacheslav Dubeyko
From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Based on a syzbot report, Wang Jianjian pointed out that following a
successful directory operation in nilfs_rename(), a synchronous write
requested within nilfs_transaction_commit(), triggered by a sync flag
set by nilfs_commit_chunk(), could be interrupted by a user signal.
This interruption leaves in-memory metadata updates intact while
returning an error, causing inconsistency with the VFS dentry cache and
ultimately triggering a kernel warning.
According to "signal(7)", local disks are not classified as "slow
devices" (such as terminals, FIFOs, or pipes) and their I/O operations
on disk devices are not interrupted by signals. In kernel space,
waiting for such disk I/O should therefore not be aborted by ordinary
(non-fatal) signals.
Suppress this issue by modifying nilfs_segctor_sync(), which waits for
the log writer thread to complete synchronous writes, to catch only
fatal signals via fatal_signal_pending() and return -EINTR rather than
-ERESTARTSYS. To complement this change and prevent the wait loop from
busy-looping when schedule() returns immediately due to a pending
non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
TASK_KILLABLE.
This serves as an effective interim stabilization measure without
structural changes until a comprehensive fix for metadata consistency
is implemented.
Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
Cc: Wang Jianjian <wangjianjian3@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
(cherry picked from commit 7131aaa74bcc7c9da1f1d1c8724da75c775557a0)
---
fs/nilfs2/ioctl.c | 2 +-
fs/nilfs2/recovery.c | 4 ++--
fs/nilfs2/segment.c | 14 +++++++-------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 4e964549bc4c..cbbe49bb4926 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -960,10 +960,10 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
* Return: 0 on success, or one of the following negative error codes on
* failure:
* * %-EFAULT - Failure during execution of requested operation.
+ * * %-EINTR - Interrupted.
* * %-EIO - I/O error.
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No space left on device (only in a panic state).
- * * %-ERESTARTSYS - Interrupted.
* * %-EROFS - Read only filesystem.
*/
static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index ce30b51ac593..249be54f7732 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -744,14 +744,14 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
* Return Value: On success, 0 is returned. On error, one of the following
* negative error code is returned.
*
+ * %-EINTR - Interrupted.
+ *
* %-EINVAL - Inconsistent filesystem state.
*
* %-EIO - I/O error
*
* %-ENOSPC - No space left on device (only in a panic state).
*
- * %-ERESTARTSYS - Interrupted.
- *
* %-ENOMEM - Insufficient memory available.
*/
int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index a412abdfbbf3..2355ed02045c 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2236,7 +2236,7 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
wake_up(&sci->sc_wait_daemon);
for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
+ set_current_state(TASK_KILLABLE);
/*
* Synchronize only while the log writer thread is alive.
@@ -2250,11 +2250,11 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
err = wait_req.err;
break;
}
- if (!signal_pending(current)) {
+ if (!fatal_signal_pending(current)) {
schedule();
continue;
}
- err = -ERESTARTSYS;
+ err = -EINTR;
break;
}
finish_wait(&sci->sc_wait_request, &wait_req.wq);
@@ -2289,14 +2289,14 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
* Return Value: On success, 0 is returned. On errors, one of the following
* negative error code is returned.
*
+ * %-EINTR - Interrupted.
+ *
* %-EROFS - Read only filesystem.
*
* %-EIO - I/O error
*
* %-ENOSPC - No space left on device (only in a panic state).
*
- * %-ERESTARTSYS - Interrupted.
- *
* %-ENOMEM - Insufficient memory available.
*/
int nilfs_construct_segment(struct super_block *sb)
@@ -2324,14 +2324,14 @@ int nilfs_construct_segment(struct super_block *sb)
* Return Value: On success, 0 is returned. On errors, one of the following
* negative error code is returned.
*
+ * %-EINTR - Interrupted.
+ *
* %-EROFS - Read only filesystem.
*
* %-EIO - I/O error
*
* %-ENOSPC - No space left on device (only in a panic state).
*
- * %-ERESTARTSYS - Interrupted.
- *
* %-ENOMEM - Insufficient memory available.
*/
int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 6.1.y] nilfs2: ignore non-fatal signals during synchronous log write wait
2026-11-11 1:31 ` [PATCH 6.1.y] " Wang Jianjian
@ 2026-11-11 1:59 ` Ryusuke Konishi
2026-11-11 2:10 ` wangjianjian (C)
2026-11-11 1:59 ` wangjianjian (C)
1 sibling, 1 reply; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-11 1:59 UTC (permalink / raw)
To: Wang Jianjian; +Cc: stable, syzbot+f6c7e1f1809f235eeb90, Viacheslav Dubeyko
On Wed, Nov 11, 2026 at 10:33 AM Wang Jianjian wrote:
>
> From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
>
> Based on a syzbot report, Wang Jianjian pointed out that following a
> successful directory operation in nilfs_rename(), a synchronous write
> requested within nilfs_transaction_commit(), triggered by a sync flag
> set by nilfs_commit_chunk(), could be interrupted by a user signal.
> This interruption leaves in-memory metadata updates intact while
> returning an error, causing inconsistency with the VFS dentry cache and
> ultimately triggering a kernel warning.
>
> According to "signal(7)", local disks are not classified as "slow
> devices" (such as terminals, FIFOs, or pipes) and their I/O operations
> on disk devices are not interrupted by signals. In kernel space,
> waiting for such disk I/O should therefore not be aborted by ordinary
> (non-fatal) signals.
>
> Suppress this issue by modifying nilfs_segctor_sync(), which waits for
> the log writer thread to complete synchronous writes, to catch only
> fatal signals via fatal_signal_pending() and return -EINTR rather than
> -ERESTARTSYS. To complement this change and prevent the wait loop from
> busy-looping when schedule() returns immediately due to a pending
> non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
> TASK_KILLABLE.
>
> This serves as an effective interim stabilization measure without
> structural changes until a comprehensive fix for metadata consistency
> is implemented.
>
> Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
> Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
> Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
> Cc: Wang Jianjian <wangjianjian3@huawei.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
> Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
> (cherry picked from commit 7131aaa74bcc7c9da1f1d1c8724da75c775557a0)
> ---
Hi Wang Jianjian,
The patches that the fix patch depends on have also been submitted to
the stable tree, so the conflicts should be resolved.
Considering future backports, I think Sasha Levin's approach of
simultaneously sending acceptable dependency patches to resolve the
issue is preferable.
Could you please check the link below?
[6.12.y] https://lore.kernel.org/all/20261110131241.1664282-1-sashal@kernel.org/
[6.6.y] https://lore.kernel.org/all/20261110131728.1706995-1-sashal@kernel.org/
[6.1.y] https://lore.kernel.org/all/20261110132237.1722151-1-sashal@kernel.org/
[5.15.y] https://lore.kernel.org/all/20261110132713.1736389-1-sashal@kernel.org
Please let me know if your intention was different.
Thanks,
Ryusuke Konishi
> fs/nilfs2/ioctl.c | 2 +-
> fs/nilfs2/recovery.c | 2 ++
> fs/nilfs2/segment.c | 10 +++++++---
> 3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
> index 4e964549bc4c..cbbe49bb4926 100644
> --- a/fs/nilfs2/ioctl.c
> +++ b/fs/nilfs2/ioctl.c
> @@ -960,10 +960,10 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
> * Return: 0 on success, or one of the following negative error codes on
> * failure:
> * * %-EFAULT - Failure during execution of requested operation.
> + * * %-EINTR - Interrupted.
> * * %-EIO - I/O error.
> * * %-ENOMEM - Insufficient memory available.
> * * %-ENOSPC - No space left on device (only in a panic state).
> - * * %-ERESTARTSYS - Interrupted.
> * * %-EROFS - Read only filesystem.
> */
> static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
> diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
> index ce30b51ac593..34462039ae7d 100644
> --- a/fs/nilfs2/recovery.c
> +++ b/fs/nilfs2/recovery.c
> @@ -744,6 +744,8 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
> * Return Value: On success, 0 is returned. On error, one of the following
> * negative error code is returned.
> *
> + * %-EINTR - Interrupted.
> + *
> * %-EINVAL - Inconsistent filesystem state.
> *
> * %-EIO - I/O error
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index a412abdfbbf3..3a256f786db2 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -2236,7 +2236,7 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
> wake_up(&sci->sc_wait_daemon);
>
> for (;;) {
> - set_current_state(TASK_INTERRUPTIBLE);
> + set_current_state(TASK_KILLABLE);
>
> /*
> * Synchronize only while the log writer thread is alive.
> @@ -2250,11 +2250,11 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
> err = wait_req.err;
> break;
> }
> - if (!signal_pending(current)) {
> + if (!fatal_signal_pending(current)) {
> schedule();
> continue;
> }
> - err = -ERESTARTSYS;
> + err = -EINTR;
> break;
> }
> finish_wait(&sci->sc_wait_request, &wait_req.wq);
> @@ -2289,6 +2289,8 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
> * Return Value: On success, 0 is returned. On errors, one of the following
> * negative error code is returned.
> *
> + * %-EINTR - Interrupted.
> + *
> * %-EROFS - Read only filesystem.
> *
> * %-EIO - I/O error
> @@ -2324,6 +2326,8 @@ int nilfs_construct_segment(struct super_block *sb)
> * Return Value: On success, 0 is returned. On errors, one of the following
> * negative error code is returned.
> *
> + * %-EINTR - Interrupted.
> + *
> * %-EROFS - Read only filesystem.
> *
> * %-EIO - I/O error
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 6.1.y] nilfs2: ignore non-fatal signals during synchronous log write wait
2026-11-11 1:31 ` [PATCH 6.1.y] " Wang Jianjian
2026-11-11 1:59 ` Ryusuke Konishi
@ 2026-11-11 1:59 ` wangjianjian (C)
1 sibling, 0 replies; 9+ messages in thread
From: wangjianjian (C) @ 2026-11-11 1:59 UTC (permalink / raw)
To: stable; +Cc: Ryusuke Konishi, syzbot+f6c7e1f1809f235eeb90, Viacheslav Dubeyko
Hi,
Please ignore this patch(I resend a new version). Sorry for this.
在 2026/11/11 9:31, Wang Jianjian 写道:
> From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
>
> Based on a syzbot report, Wang Jianjian pointed out that following a
> successful directory operation in nilfs_rename(), a synchronous write
> requested within nilfs_transaction_commit(), triggered by a sync flag
> set by nilfs_commit_chunk(), could be interrupted by a user signal.
> This interruption leaves in-memory metadata updates intact while
> returning an error, causing inconsistency with the VFS dentry cache and
> ultimately triggering a kernel warning.
>
> According to "signal(7)", local disks are not classified as "slow
> devices" (such as terminals, FIFOs, or pipes) and their I/O operations
> on disk devices are not interrupted by signals. In kernel space,
> waiting for such disk I/O should therefore not be aborted by ordinary
> (non-fatal) signals.
>
> Suppress this issue by modifying nilfs_segctor_sync(), which waits for
> the log writer thread to complete synchronous writes, to catch only
> fatal signals via fatal_signal_pending() and return -EINTR rather than
> -ERESTARTSYS. To complement this change and prevent the wait loop from
> busy-looping when schedule() returns immediately due to a pending
> non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
> TASK_KILLABLE.
>
> This serves as an effective interim stabilization measure without
> structural changes until a comprehensive fix for metadata consistency
> is implemented.
>
> Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
> Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
> Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
> Cc: Wang Jianjian <wangjianjian3@huawei.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
> Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
> (cherry picked from commit 7131aaa74bcc7c9da1f1d1c8724da75c775557a0)
> ---
> fs/nilfs2/ioctl.c | 2 +-
> fs/nilfs2/recovery.c | 2 ++
> fs/nilfs2/segment.c | 10 +++++++---
> 3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
> index 4e964549bc4c..cbbe49bb4926 100644
> --- a/fs/nilfs2/ioctl.c
> +++ b/fs/nilfs2/ioctl.c
> @@ -960,10 +960,10 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
> * Return: 0 on success, or one of the following negative error codes on
> * failure:
> * * %-EFAULT - Failure during execution of requested operation.
> + * * %-EINTR - Interrupted.
> * * %-EIO - I/O error.
> * * %-ENOMEM - Insufficient memory available.
> * * %-ENOSPC - No space left on device (only in a panic state).
> - * * %-ERESTARTSYS - Interrupted.
> * * %-EROFS - Read only filesystem.
> */
> static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
> diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
> index ce30b51ac593..34462039ae7d 100644
> --- a/fs/nilfs2/recovery.c
> +++ b/fs/nilfs2/recovery.c
> @@ -744,6 +744,8 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
> * Return Value: On success, 0 is returned. On error, one of the following
> * negative error code is returned.
> *
> + * %-EINTR - Interrupted.
> + *
> * %-EINVAL - Inconsistent filesystem state.
> *
> * %-EIO - I/O error
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index a412abdfbbf3..3a256f786db2 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -2236,7 +2236,7 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
> wake_up(&sci->sc_wait_daemon);
>
> for (;;) {
> - set_current_state(TASK_INTERRUPTIBLE);
> + set_current_state(TASK_KILLABLE);
>
> /*
> * Synchronize only while the log writer thread is alive.
> @@ -2250,11 +2250,11 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
> err = wait_req.err;
> break;
> }
> - if (!signal_pending(current)) {
> + if (!fatal_signal_pending(current)) {
> schedule();
> continue;
> }
> - err = -ERESTARTSYS;
> + err = -EINTR;
> break;
> }
> finish_wait(&sci->sc_wait_request, &wait_req.wq);
> @@ -2289,6 +2289,8 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
> * Return Value: On success, 0 is returned. On errors, one of the following
> * negative error code is returned.
> *
> + * %-EINTR - Interrupted.
> + *
> * %-EROFS - Read only filesystem.
> *
> * %-EIO - I/O error
> @@ -2324,6 +2326,8 @@ int nilfs_construct_segment(struct super_block *sb)
> * Return Value: On success, 0 is returned. On errors, one of the following
> * negative error code is returned.
> *
> + * %-EINTR - Interrupted.
> + *
> * %-EROFS - Read only filesystem.
> *
> * %-EIO - I/O error
--
Regards
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 6.1.y] nilfs2: ignore non-fatal signals during synchronous log write wait
2026-11-11 1:59 ` Ryusuke Konishi
@ 2026-11-11 2:10 ` wangjianjian (C)
2026-11-11 2:59 ` Ryusuke Konishi
0 siblings, 1 reply; 9+ messages in thread
From: wangjianjian (C) @ 2026-11-11 2:10 UTC (permalink / raw)
To: Ryusuke Konishi; +Cc: stable, syzbot+f6c7e1f1809f235eeb90, Viacheslav Dubeyko
在 2026/11/11 9:59, Ryusuke Konishi 写道:
> On Wed, Nov 11, 2026 at 10:33 AM Wang Jianjian wrote:
>>
>> From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
>>
>> Based on a syzbot report, Wang Jianjian pointed out that following a
>> successful directory operation in nilfs_rename(), a synchronous write
>> requested within nilfs_transaction_commit(), triggered by a sync flag
>> set by nilfs_commit_chunk(), could be interrupted by a user signal.
>> This interruption leaves in-memory metadata updates intact while
>> returning an error, causing inconsistency with the VFS dentry cache and
>> ultimately triggering a kernel warning.
>>
>> According to "signal(7)", local disks are not classified as "slow
>> devices" (such as terminals, FIFOs, or pipes) and their I/O operations
>> on disk devices are not interrupted by signals. In kernel space,
>> waiting for such disk I/O should therefore not be aborted by ordinary
>> (non-fatal) signals.
>>
>> Suppress this issue by modifying nilfs_segctor_sync(), which waits for
>> the log writer thread to complete synchronous writes, to catch only
>> fatal signals via fatal_signal_pending() and return -EINTR rather than
>> -ERESTARTSYS. To complement this change and prevent the wait loop from
>> busy-looping when schedule() returns immediately due to a pending
>> non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
>> TASK_KILLABLE.
>>
>> This serves as an effective interim stabilization measure without
>> structural changes until a comprehensive fix for metadata consistency
>> is implemented.
>>
>> Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
>> Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
>> Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
>> Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
>> Cc: Wang Jianjian <wangjianjian3@huawei.com>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
>> Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
>> (cherry picked from commit 7131aaa74bcc7c9da1f1d1c8724da75c775557a0)
>> ---
>
> Hi Wang Jianjian,
>
> The patches that the fix patch depends on have also been submitted to
> the stable tree, so the conflicts should be resolved.
>
> Considering future backports, I think Sasha Levin's approach of
> simultaneously sending acceptable dependency patches to resolve the
> issue is preferable.
>
> Could you please check the link below?
>
> [6.12.y] https://lore.kernel.org/all/20261110131241.1664282-1-sashal@kernel.org/
> [6.6.y] https://lore.kernel.org/all/20261110131728.1706995-1-sashal@kernel.org/
> [6.1.y] https://lore.kernel.org/all/20261110132237.1722151-1-sashal@kernel.org/
> [5.15.y] https://lore.kernel.org/all/20261110132713.1736389-1-sashal@kernel.org
>
> Please let me know if your intention was different.
Hi,
ok, I misunderstood this. sorry about this confuse.>
> Thanks,
> Ryusuke Konishi
>
>
>
>> fs/nilfs2/ioctl.c | 2 +-
>> fs/nilfs2/recovery.c | 2 ++
>> fs/nilfs2/segment.c | 10 +++++++---
>> 3 files changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
>> index 4e964549bc4c..cbbe49bb4926 100644
>> --- a/fs/nilfs2/ioctl.c
>> +++ b/fs/nilfs2/ioctl.c
>> @@ -960,10 +960,10 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
>> * Return: 0 on success, or one of the following negative error codes on
>> * failure:
>> * * %-EFAULT - Failure during execution of requested operation.
>> + * * %-EINTR - Interrupted.
>> * * %-EIO - I/O error.
>> * * %-ENOMEM - Insufficient memory available.
>> * * %-ENOSPC - No space left on device (only in a panic state).
>> - * * %-ERESTARTSYS - Interrupted.
>> * * %-EROFS - Read only filesystem.
>> */
>> static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
>> diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
>> index ce30b51ac593..34462039ae7d 100644
>> --- a/fs/nilfs2/recovery.c
>> +++ b/fs/nilfs2/recovery.c
>> @@ -744,6 +744,8 @@ static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
>> * Return Value: On success, 0 is returned. On error, one of the following
>> * negative error code is returned.
>> *
>> + * %-EINTR - Interrupted.
>> + *
>> * %-EINVAL - Inconsistent filesystem state.
>> *
>> * %-EIO - I/O error
>> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
>> index a412abdfbbf3..3a256f786db2 100644
>> --- a/fs/nilfs2/segment.c
>> +++ b/fs/nilfs2/segment.c
>> @@ -2236,7 +2236,7 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
>> wake_up(&sci->sc_wait_daemon);
>>
>> for (;;) {
>> - set_current_state(TASK_INTERRUPTIBLE);
>> + set_current_state(TASK_KILLABLE);
>>
>> /*
>> * Synchronize only while the log writer thread is alive.
>> @@ -2250,11 +2250,11 @@ static int nilfs_segctor_sync(struct nilfs_sc_info *sci)
>> err = wait_req.err;
>> break;
>> }
>> - if (!signal_pending(current)) {
>> + if (!fatal_signal_pending(current)) {
>> schedule();
>> continue;
>> }
>> - err = -ERESTARTSYS;
>> + err = -EINTR;
>> break;
>> }
>> finish_wait(&sci->sc_wait_request, &wait_req.wq);
>> @@ -2289,6 +2289,8 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err, bool force)
>> * Return Value: On success, 0 is returned. On errors, one of the following
>> * negative error code is returned.
>> *
>> + * %-EINTR - Interrupted.
>> + *
>> * %-EROFS - Read only filesystem.
>> *
>> * %-EIO - I/O error
>> @@ -2324,6 +2326,8 @@ int nilfs_construct_segment(struct super_block *sb)
>> * Return Value: On success, 0 is returned. On errors, one of the following
>> * negative error code is returned.
>> *
>> + * %-EINTR - Interrupted.
>> + *
>> * %-EROFS - Read only filesystem.
>> *
>> * %-EIO - I/O error
>> --
>> 2.34.1
>>
--
Regards
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 6.1.y] nilfs2: ignore non-fatal signals during synchronous log write wait
2026-11-11 2:10 ` wangjianjian (C)
@ 2026-11-11 2:59 ` Ryusuke Konishi
0 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-11 2:59 UTC (permalink / raw)
To: wangjianjian (C); +Cc: stable, syzbot+f6c7e1f1809f235eeb90, Viacheslav Dubeyko
On Wed, Nov 11, 2026 at 11:10 AM wangjianjian (C) wrote:
>
>
> 在 2026/11/11 9:59, Ryusuke Konishi 写道:
> > On Wed, Nov 11, 2026 at 10:33 AM Wang Jianjian wrote:
> >>
> >> From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
> >>
> >> Based on a syzbot report, Wang Jianjian pointed out that following a
> >> successful directory operation in nilfs_rename(), a synchronous write
> >> requested within nilfs_transaction_commit(), triggered by a sync flag
> >> set by nilfs_commit_chunk(), could be interrupted by a user signal.
> >> This interruption leaves in-memory metadata updates intact while
> >> returning an error, causing inconsistency with the VFS dentry cache and
> >> ultimately triggering a kernel warning.
> >>
> >> According to "signal(7)", local disks are not classified as "slow
> >> devices" (such as terminals, FIFOs, or pipes) and their I/O operations
> >> on disk devices are not interrupted by signals. In kernel space,
> >> waiting for such disk I/O should therefore not be aborted by ordinary
> >> (non-fatal) signals.
> >>
> >> Suppress this issue by modifying nilfs_segctor_sync(), which waits for
> >> the log writer thread to complete synchronous writes, to catch only
> >> fatal signals via fatal_signal_pending() and return -EINTR rather than
> >> -ERESTARTSYS. To complement this change and prevent the wait loop from
> >> busy-looping when schedule() returns immediately due to a pending
> >> non-fatal signal, switch the wait state from TASK_INTERRUPTIBLE to
> >> TASK_KILLABLE.
> >>
> >> This serves as an effective interim stabilization measure without
> >> structural changes until a comprehensive fix for metadata consistency
> >> is implemented.
> >>
> >> Reported-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
> >> Closes: https://syzkaller.appspot.com/bug?extid=f6c7e1f1809f235eeb90
> >> Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
> >> Tested-by: syzbot+f6c7e1f1809f235eeb90@syzkaller.appspotmail.com
> >> Cc: Wang Jianjian <wangjianjian3@huawei.com>
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
> >> Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
> >> (cherry picked from commit 7131aaa74bcc7c9da1f1d1c8724da75c775557a0)
> >> ---
> >
> > Hi Wang Jianjian,
> >
> > The patches that the fix patch depends on have also been submitted to
> > the stable tree, so the conflicts should be resolved.
> >
> > Considering future backports, I think Sasha Levin's approach of
> > simultaneously sending acceptable dependency patches to resolve the
> > issue is preferable.
> >
> > Could you please check the link below?
> >
> > [6.12.y] https://lore.kernel.org/all/20261110131241.1664282-1-sashal@kernel.org/
> > [6.6.y] https://lore.kernel.org/all/20261110131728.1706995-1-sashal@kernel.org/
> > [6.1.y] https://lore.kernel.org/all/20261110132237.1722151-1-sashal@kernel.org/
> > [5.15.y] https://lore.kernel.org/all/20261110132713.1736389-1-sashal@kernel.org
> >
> > Please let me know if your intention was different.
>
> Hi,
> ok, I misunderstood this. sorry about this confuse.>
No worries.
Thanks for taking the time to put together patches for multiple branches anyway.
Thanks,
Ryusuke Konishi
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-11 2:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 10:43 FAILED: patch "[PATCH] nilfs2: ignore non-fatal signals during synchronous log write wait" failed to apply to 6.1-stable tree Sasha Levin
2026-11-10 13:22 ` [PATCH 6.1.y 1/2] nilfs2: correct return value kernel-doc descriptions for the rest Sasha Levin
2026-11-10 13:22 ` [PATCH 6.1.y 2/2] nilfs2: ignore non-fatal signals during synchronous log write wait Sasha Levin
2026-11-11 1:31 ` [PATCH 6.1.y] " Wang Jianjian
2026-11-11 1:59 ` Ryusuke Konishi
2026-11-11 2:10 ` wangjianjian (C)
2026-11-11 2:59 ` Ryusuke Konishi
2026-11-11 1:59 ` wangjianjian (C)
2026-11-11 1:55 ` Wang Jianjian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox