public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] xfs: use vmalloc instead of vm_map_area for buffer backing memory
@ 2025-03-18  8:40 Dan Carpenter
  2025-03-18  8:43 ` Christoph Hellwig
  2025-03-19  6:31 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-03-18  8:40 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs

Hello Christoph Hellwig,

Commit e2874632a621 ("xfs: use vmalloc instead of vm_map_area for
buffer backing memory") from Mar 10, 2025 (linux-next), leads to the
following Smatch static checker warning:

	fs/xfs/xfs_buf.c:210 xfs_buf_free()
	warn: sleeping in atomic context

fs/xfs/xfs_buf.c
    196 static void
    197 xfs_buf_free(
    198         struct xfs_buf                *bp)
    199 {
    200         unsigned int                size = BBTOB(bp->b_length);
    201 
    202         trace_xfs_buf_free(bp, _RET_IP_);
    203 
    204         ASSERT(list_empty(&bp->b_lru));
    205 
    206         if (!xfs_buftarg_is_mem(bp->b_target) && size >= PAGE_SIZE)
    207                 mm_account_reclaimed_pages(howmany(size, PAGE_SHIFT));
    208 
    209         if (is_vmalloc_addr(bp->b_addr))
--> 210                 vfree(bp->b_addr);

vfree() can sleep.  Although it's fine to call it in interrupt context.

    211         else if (bp->b_flags & _XBF_KMEM)
    212                 kfree(bp->b_addr);
    213         else
    214                 folio_put(virt_to_folio(bp->b_addr));
    215 
    216         call_rcu(&bp->b_rcu, xfs_buf_free_callback);
    217 }

These warnings tend to have a lot of false positives because the call
tree is long.  There are two functions which call xfs_clear_li_failed()
while holding a spinlock.  These are the call trees.

xfs_trans_ail_delete() <- disables preempt
xfs_qm_dqflush_done() <- disables preempt
-> xfs_clear_li_failed()
   -> xfs_buf_rele()
      -> xfs_buf_rele_uncached()
         -> xfs_buf_free()

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-19  7:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18  8:40 [bug report] xfs: use vmalloc instead of vm_map_area for buffer backing memory Dan Carpenter
2025-03-18  8:43 ` Christoph Hellwig
2025-03-19  6:31 ` Christoph Hellwig
2025-03-19  7:16   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox