Re: [PATCH 2/2] xfs: mark xfs_buf_free as might_sleep()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 20, 2025 at 08:52:14AM +0100, Christoph Hellwig wrote:
> xfs_buf_free can call vunmap, which can sleep.  The vunmap path is an
> unlikely one, so add might_sleep to ensure calling xfs_buf_free from
> atomic context gets caught more easily.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

> ---
>  fs/xfs/xfs_buf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 8e7f1b324b3b..1a2b3f06fa71 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -105,6 +105,7 @@ xfs_buf_free(
>  {
>  	unsigned int		size = BBTOB(bp->b_length);
> 
> +	might_sleep();
>  	trace_xfs_buf_free(bp, _RET_IP_);
> 
>  	ASSERT(list_empty(&bp->b_lru));

If I followed it correct, vunmap can be caught via
xfs_buf_free_pages(). If that's the case, wouldn't make
more sense to put might_sleep() inside xfs_buf_free_pages()
giving it is not called only from xfs_buf_free()?

Otherwise,
Reviewed-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>

> --
> 2.45.2
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux