mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liubaolin <liubaolin12138@163.com>
To: Hongling Zeng <zenghongling@kylinos.cn>,
	linkinjeon@kernel.org, hyc.lee@gmail.com
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org,
	zhongling0719@126.com, stable@vger.kernel.org
Subject: Re: [PATCH] ntfs: handle signal interruption in fallocate
Date: Thu, 27 Aug 2026 12:17:17 +0800	[thread overview]
Message-ID: <9022d6dc-3746-4f37-91a1-dfc17fe04fef@163.com> (raw)
In-Reply-To: <20260826055953.1372417-1-zenghongling@kylinos.cn>



在 2026/8/26 13:59, Hongling Zeng 写道:
> The ntfs_attr_fallocate() function checks for pending signals during
> allocation loops and exits early via 'out' label. However, when a signal
> interrupts the operation with err == 0, the function returns 0 (success)
> instead of -EINTR.
> 
> The signal_pending() checks at the allocation loops jump to 'out' without
> setting err = -EINTR, so the function returns success even when interrupted
> by a signal.
> 
> Set err = -EINTR when jumping to the signal exit path, and only override
> when no other error is pending. This ensures:
> 
> - Allocation interrupted by signal returns -EINTR
> - Allocation that completed successfully before signal arrived returns 0
> - Other errors are preserved and not overwritten by -EINTR
> 
> Fixes: 495e90fa3348 ("ntfs: update attrib operations")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
>   fs/ntfs/attrib.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
> index 60264833bb63..c898250f63a7 100644
> --- a/fs/ntfs/attrib.c
> +++ b/fs/ntfs/attrib.c
> @@ -5709,7 +5709,7 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo
>   				}
>   
>   				if (signal_pending(current))
> -					goto out;
> +					goto signal_out;
>   
>   				vcn += alloc_cnt;
>   				try_alloc_cnt -= alloc_cnt;
> @@ -5730,7 +5730,7 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo
>   		up_write(&ni->runlist.lock);
>   		mutex_unlock(&ni->mrec_lock);
>   		if (err || signal_pending(current))
> -			goto out;
> +			goto signal_out;
>   
>   		vcn += alloc_cnt;
>   		try_alloc_cnt -= alloc_cnt;
> @@ -5756,4 +5756,8 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo
>   	mutex_unlock(&ni->mrec_lock);
>   out:
>   	return err >= 0 ? 0 : err;
> +signal_out:
> +	if (!err)
> +		err = -EINTR;
> +	goto out;
>   }

Looks good to me. 
  

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


  reply	other threads:[~2026-08-27  4:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26  5:59 Hongling Zeng
2026-08-27  4:17 ` liubaolin [this message]
2026-08-31 10:44 ` Namjae Jeon

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=9022d6dc-3746-4f37-91a1-dfc17fe04fef@163.com \
    --to=liubaolin12138@163.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=zenghongling@kylinos.cn \
    --cc=zhongling0719@126.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

all inboxes | Powered by JetHome®