[PATCH] ntfs: use fatal_signal_pending() for fallocate interruption checks

Hongling Zeng posted 1 patch 2 weeks, 4 days ago
fs/ntfs/attrib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] ntfs: use fatal_signal_pending() for fallocate interruption checks
Posted by Hongling Zeng 2 weeks, 4 days ago
The fallocate implementation uses signal checks to let a long allocation
loop abort early.  However, signal_pending() also returns true for
TIF_NOTIFY_SIGNAL, which io_uring uses to deliver task_work completions
to the submitting task.

generic/616 is an io_uring fsx soak test that issues fsx-style
read/write requests through io_uring and calls fallocate() directly in
between.  A pending io_uring task_work notification can therefore make
signal_pending() true inside ntfs_attr_fallocate() even though no real
signal was delivered.

That caused the previous signal-interruption patch to return -EINTR for
an io_uring notification, which fsx treats as a fatal failure.  Switch
both checks to fatal_signal_pending() so only fatal signals interrupt
the allocation loop.  A real fatal signal still returns -EINTR, and any
other error still takes precedence.

Fixes: 4dc8f4ee2d46 ("ntfs: handle signal interruption in fallocate")
Cc: stable@vger.kernel.org
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
---
 fs/ntfs/attrib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 848a0d338b89..5f761a3b29f4 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -5708,7 +5708,7 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo
 						goto out;
 				}
 
-				if (signal_pending(current))
+				if (fatal_signal_pending(current))
 					goto signal_out;
 
 				vcn += alloc_cnt;
@@ -5729,7 +5729,7 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo
 					    try_alloc_cnt, &balloc, false, false);
 		up_write(&ni->runlist.lock);
 		mutex_unlock(&ni->mrec_lock);
-		if (err || signal_pending(current))
+		if (err || fatal_signal_pending(current))
 			goto signal_out;
 
 		vcn += alloc_cnt;
-- 
2.25.1
Re: [PATCH] ntfs: use fatal_signal_pending() for fallocate interruption checks
Posted by Namjae Jeon 2 weeks, 3 days ago
On Mon, Sep 7, 2026 at 12:57 PM Hongling Zeng <zenghongling@kylinos.cn> wrote:
>
> The fallocate implementation uses signal checks to let a long allocation
> loop abort early.  However, signal_pending() also returns true for
> TIF_NOTIFY_SIGNAL, which io_uring uses to deliver task_work completions
> to the submitting task.
>
> generic/616 is an io_uring fsx soak test that issues fsx-style
> read/write requests through io_uring and calls fallocate() directly in
> between.  A pending io_uring task_work notification can therefore make
> signal_pending() true inside ntfs_attr_fallocate() even though no real
> signal was delivered.
>
> That caused the previous signal-interruption patch to return -EINTR for
> an io_uring notification, which fsx treats as a fatal failure.  Switch
> both checks to fatal_signal_pending() so only fatal signals interrupt
> the allocation loop.  A real fatal signal still returns -EINTR, and any
> other error still takes precedence.
>
> Fixes: 4dc8f4ee2d46 ("ntfs: handle signal interruption in fallocate")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Applied it to #ntfs-next.
Thanks!
Re: [PATCH] ntfs: use fatal_signal_pending() for fallocate interruption checks
Posted by Hyunchul Lee 2 weeks, 4 days ago
2026년 9월 7일 (월) 오후 12:57, Hongling Zeng <zenghongling@kylinos.cn>님이 작성:
>
> The fallocate implementation uses signal checks to let a long allocation
> loop abort early.  However, signal_pending() also returns true for
> TIF_NOTIFY_SIGNAL, which io_uring uses to deliver task_work completions
> to the submitting task.
>
> generic/616 is an io_uring fsx soak test that issues fsx-style
> read/write requests through io_uring and calls fallocate() directly in
> between.  A pending io_uring task_work notification can therefore make
> signal_pending() true inside ntfs_attr_fallocate() even though no real
> signal was delivered.
>
> That caused the previous signal-interruption patch to return -EINTR for
> an io_uring notification, which fsx treats as a fatal failure.  Switch
> both checks to fatal_signal_pending() so only fatal signals interrupt
> the allocation loop.  A real fatal signal still returns -EINTR, and any
> other error still takes precedence.
>
> Fixes: 4dc8f4ee2d46 ("ntfs: handle signal interruption in fallocate")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>

Looks good to me.

Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>


--
Thanks,
Hyunchul
Re: [PATCH] ntfs: use fatal_signal_pending() for fallocate interruption checks
Posted by liubaolin 2 weeks, 4 days ago

在 2026/9/7 11:57, Hongling Zeng 写道:
> The fallocate implementation uses signal checks to let a long allocation
> loop abort early.  However, signal_pending() also returns true for
> TIF_NOTIFY_SIGNAL, which io_uring uses to deliver task_work completions
> to the submitting task.
> 
> generic/616 is an io_uring fsx soak test that issues fsx-style
> read/write requests through io_uring and calls fallocate() directly in
> between.  A pending io_uring task_work notification can therefore make
> signal_pending() true inside ntfs_attr_fallocate() even though no real
> signal was delivered.
> 
> That caused the previous signal-interruption patch to return -EINTR for
> an io_uring notification, which fsx treats as a fatal failure.  Switch
> both checks to fatal_signal_pending() so only fatal signals interrupt
> the allocation loop.  A real fatal signal still returns -EINTR, and any
> other error still takes precedence.
> 
> Fixes: 4dc8f4ee2d46 ("ntfs: handle signal interruption in fallocate")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
>   fs/ntfs/attrib.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
> index 848a0d338b89..5f761a3b29f4 100644
> --- a/fs/ntfs/attrib.c
> +++ b/fs/ntfs/attrib.c
> @@ -5708,7 +5708,7 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo
>   						goto out;
>   				}
>   
> -				if (signal_pending(current))
> +				if (fatal_signal_pending(current))
>   					goto signal_out;
>   
>   				vcn += alloc_cnt;
> @@ -5729,7 +5729,7 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo
>   					    try_alloc_cnt, &balloc, false, false);
>   		up_write(&ni->runlist.lock);
>   		mutex_unlock(&ni->mrec_lock);
> -		if (err || signal_pending(current))
> +		if (err || fatal_signal_pending(current))
>   			goto signal_out;
>   
>   		vcn += alloc_cnt;


Looks good to me.

Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>