Linux network filesystem support library
 help / color / mirror / Atom feed
From: Erhard Furtner <erhard_f@mailbox.org>
To: Hao Ge <hao.ge@linux.dev>, Paulo Alcantara <pc@manguebit.org>
Cc: linux-cifs@vger.kernel.org, David Howells <dhowells@redhat.com>,
	netfs@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: client side "current->alloc_tag not set WARNING: ./include/linux/alloc_tag.h:161" at accessing CIFS share
Date: Sun, 20 Sep 2026 21:08:20 +0200	[thread overview]
Message-ID: <1c243393-4fb7-4be3-8d3c-9727b20ae373@mailbox.org> (raw)
In-Reply-To: <cfcba100-609a-4016-9b47-186346709634@linux.dev>

On 9/16/26 11:42, Hao Ge wrote:
> Right - and there's one more instance of the same pattern.
> Erhard's second warning (alloc_tag was not set on free) comes from
> netfs_folioq_alloc(), which does the same for the folio_queue:
> 	
> 	fq = netfs_folioq_pool.alloc(gfp, netfs_folioq_pool.pool_data);
> 
> When I first saw the report I wondered why no other mempool user trips over this,
> so I had a look around the tree:
> 
> Everyone else gets their elements through the mempool_alloc() macro, so the tag is
> set at their callsite and the callbacks see a valid current->alloc_tag.
> 
> I went back to the commit that introduced the raw call, 1d78d56c43ef ("netfs: Fix folio_queue ENOMEM in
> writeback by adding a mempool") and OK, I think I roughly understand the story now.
> 
> Here is my proposed fix patch. I don't have a test environment handy though. What do you think?
> 
> diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h
> index 420ee7b26580..373be970ec31 100644
> --- a/fs/netfs/internal.h
> +++ b/fs/netfs/internal.h
> @@ -45,6 +45,9 @@ extern mempool_t netfs_request_pool;
>   extern mempool_t netfs_subrequest_pool;
>   extern mempool_t netfs_folioq_pool;
>   
> +#define mempool_alloc_element(_pool, _gfp)				\
> +	alloc_hooks((_pool)->alloc(_gfp, (_pool)->pool_data))
> +
>   #ifdef CONFIG_PROC_FS
>   static inline void netfs_proc_add_rreq(struct netfs_io_request *rreq)
>   {
> diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c
> index 01461a74642d..18f5c64d404e 100644
> --- a/fs/netfs/objects.c
> +++ b/fs/netfs/objects.c
> @@ -34,7 +34,7 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping,
>   
>   		rreq = mempool_alloc(mempool, gfp);
>   	} else {
> -		rreq = mempool->alloc(gfp, mempool->pool_data);
> +		rreq = mempool_alloc_element(mempool, gfp);
>   		if (!rreq)
>   			return ERR_PTR(-ENOMEM);
>   	}
> @@ -206,7 +206,7 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq
>   	struct kmem_cache *cache = mempool->pool_data;
>   
>   	if (rreq->gfp == GFP_KERNEL)
> -		subreq = mempool->alloc(rreq->gfp, mempool->pool_data);
> +		subreq = mempool_alloc_element(mempool, rreq->gfp);
>   	else
>   		subreq = mempool_alloc(mempool, rreq->gfp);
>   	if (!subreq)
> diff --git a/fs/netfs/rolling_buffer.c b/fs/netfs/rolling_buffer.c
> index 8c0026836f9c..d1ae6e081664 100644
> --- a/fs/netfs/rolling_buffer.c
> +++ b/fs/netfs/rolling_buffer.c
> @@ -29,7 +29,7 @@ struct folio_queue *netfs_folioq_alloc(unsigned int rreq_id, gfp_t gfp,
>   	struct folio_queue *fq;
>   
>   	if (gfp == GFP_KERNEL)
> -		fq = netfs_folioq_pool.alloc(gfp, netfs_folioq_pool.pool_data);
> +		fq = mempool_alloc_element(&netfs_folioq_pool, gfp);
>   	else
>   		fq = mempool_alloc(&netfs_folioq_pool, gfp);
>   	if (fq) {

Thanks for your patch Hao! On my side I can confirm it applies on 
v7.3-rc3 and fixes "the current->alloc_tag not set WARNING:"

Regards,
Erhard

      reply	other threads:[~2026-09-20 19:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0b004319-9ef7-437c-a4dd-174d6a9a83db@mailbox.org>
2026-09-01 23:19 ` client side "current->alloc_tag not set WARNING: ./include/linux/alloc_tag.h:161" at accessing CIFS share Paulo Alcantara
2026-09-16  9:42   ` Hao Ge
2026-09-20 19:08     ` Erhard Furtner [this message]

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=1c243393-4fb7-4be3-8d3c-9727b20ae373@mailbox.org \
    --to=erhard_f@mailbox.org \
    --cc=dhowells@redhat.com \
    --cc=hao.ge@linux.dev \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfs@lists.linux.dev \
    --cc=pc@manguebit.org \
    /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