[lvc-project] [PATCH 5.10 2/2] hugetlbfs: fix hugetlbfs_statfs() locking

Vlad Efanov vefanov at ispras.ru
Mon Jul 29 17:36:55 MSK 2024


Добрый день, Артем.

После применения патчей появился crash:
BUG: sleeping function called from invalid context in 
return_unused_surplus_pages


Дополнительная информация в приложении.

Влад Ефанов.


On 11.07.2024 18:08, Artem Sadovnikov wrote:
> From: Mina Almasry <almasrymina at google.com>
>
> Commit 4b25f030ae69 ("hugetlbfs: fix hugetlbfs_statfs() locking") upstream.
>
> After commit db71ef79b59b ("hugetlb: make free_huge_page irq safe"), the
> subpool lock should be locked with spin_lock_irq() and all call sites was
> modified as such, except for the ones in hugetlbfs_statfs().
>
> Link: https://lkml.kernel.org/r/20220429202207.3045-1-almasrymina@google.com
> Fixes: db71ef79b59b ("hugetlb: make free_huge_page irq safe")
> Signed-off-by: Mina Almasry <almasrymina at google.com>
> Signed-off-by: Artem Sadovnikov <ancowi69 at gmail.com>
> ---
>   fs/hugetlbfs/inode.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index bf3cda498962..b6440007116e 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -1069,12 +1069,12 @@ static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf)
>   		if (sbinfo->spool) {
>   			long free_pages;
>   
> -			spin_lock(&sbinfo->spool->lock);
> +			spin_lock_irq(&sbinfo->spool->lock);
>   			buf->f_blocks = sbinfo->spool->max_hpages;
>   			free_pages = sbinfo->spool->max_hpages
>   				- sbinfo->spool->used_hpages;
>   			buf->f_bavail = buf->f_bfree = free_pages;
> -			spin_unlock(&sbinfo->spool->lock);
> +			spin_unlock_irq(&sbinfo->spool->lock);
>   			buf->f_files = sbinfo->max_inodes;
>   			buf->f_ffree = sbinfo->free_inodes;
>   		}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hugetlb_crash.tar.gz
Type: application/gzip
Size: 4233 bytes
Desc: not available
URL: <http://linuxtesting.org/pipermail/lvc-project/attachments/20240729/9837e922/attachment.bin>


More information about the lvc-project mailing list