linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* memory leaks from xfs_rw_bdev()
@ 2019-07-08 20:08 Qian Cai
  2019-07-08 21:35 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Qian Cai @ 2019-07-08 20:08 UTC (permalink / raw)
  To: hch; +Cc: darrick.wong, david, linux-xfs, linux-kernel

Booting today's linux-next starts to have several memory leaks. Looks like the
new xfs_rw_bdev() was introduced in the commit "xfs: use bios directly to read
and write the log recovery buffers".

https://patchwork.kernel.org/patch/10977673/

unreferenced object 0xffff888f595487c0 (size 184):
  comm "mount", pid 1473, jiffies 4294946340 (age 14914.220s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 08 40 28 67 8f 88 ff ff  .........@(g....
    00 18 00 00 40 c6 00 00 00 00 00 00 00 00 00 00  ....@...........
  backtrace:
    [<0000000031fb6250>] kmem_cache_alloc+0x272/0x400
    [<000000008ce62f00>] mempool_alloc_slab+0x2d/0x40
    [<000000004eaa8110>] mempool_alloc+0x10a/0x29e
    [<00000000906127bf>] bio_alloc_bioset+0x150/0x330
    [<000000005d5cc981>] xfs_rw_bdev+0x72/0x300 [xfs]
    [<00000000bbf739cd>] xlog_do_io+0xd8/0x1a0 [xfs]
    [<000000003815ee16>] xlog_bread+0x28/0x70 [xfs]
    [<00000000883dc328>] xlog_find_verify_cycle+0x180/0x2c0 [xfs]
    [<00000000457d45f8>] xlog_find_head+0x27c/0x5a0 [xfs]
    [<000000009956dd1f>] xlog_find_tail+0xdb/0x530 [xfs]
    [<00000000c0cdfde4>] xlog_recover+0x8f/0x2a0 [xfs]
    [<00000000f87803cd>] xfs_log_mount+0x247/0x3b0 [xfs]
    [<00000000e3a05975>] xfs_mountfs+0x7bd/0xe30 [xfs]
    [<00000000128f1a43>] xfs_fs_fill_super+0x6f0/0xaa0 [xfs]
    [<000000000ead1e3b>] mount_bdev+0x1d9/0x220
    [<00000000d48a9588>] xfs_fs_mount+0x15/0x20 [xfs]

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

* Re: memory leaks from xfs_rw_bdev()
  2019-07-08 20:08 memory leaks from xfs_rw_bdev() Qian Cai
@ 2019-07-08 21:35 ` Christoph Hellwig
  2019-07-09 18:31   ` Qian Cai
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2019-07-08 21:35 UTC (permalink / raw)
  To: Qian Cai; +Cc: hch, darrick.wong, david, linux-xfs, linux-kernel

We actually have a discussion on that in another thread, but if you
can easily reproduce the issue, can you test the patch below?

diff --git a/fs/xfs/xfs_bio_io.c b/fs/xfs/xfs_bio_io.c
index 757c1d9293eb..e2148f2d5d6b 100644
--- a/fs/xfs/xfs_bio_io.c
+++ b/fs/xfs/xfs_bio_io.c
@@ -43,7 +43,7 @@ xfs_rw_bdev(
 			bio_copy_dev(bio, prev);
 			bio->bi_iter.bi_sector = bio_end_sector(prev);
 			bio->bi_opf = prev->bi_opf;
-			bio_chain(bio, prev);
+			bio_chain(prev, bio);
 
 			submit_bio(prev);
 		}

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

* Re: memory leaks from xfs_rw_bdev()
  2019-07-08 21:35 ` Christoph Hellwig
@ 2019-07-09 18:31   ` Qian Cai
  0 siblings, 0 replies; 3+ messages in thread
From: Qian Cai @ 2019-07-09 18:31 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: darrick.wong, david, linux-xfs, linux-kernel

On Mon, 2019-07-08 at 23:35 +0200, Christoph Hellwig wrote:
> We actually have a discussion on that in another thread, but if you
> can easily reproduce the issue, can you test the patch below?
> 
> diff --git a/fs/xfs/xfs_bio_io.c b/fs/xfs/xfs_bio_io.c
> index 757c1d9293eb..e2148f2d5d6b 100644
> --- a/fs/xfs/xfs_bio_io.c
> +++ b/fs/xfs/xfs_bio_io.c
> @@ -43,7 +43,7 @@ xfs_rw_bdev(
>  			bio_copy_dev(bio, prev);
>  			bio->bi_iter.bi_sector = bio_end_sector(prev);
>  			bio->bi_opf = prev->bi_opf;
> -			bio_chain(bio, prev);
> +			bio_chain(prev, bio);
>  
>  			submit_bio(prev);
>  		}

Yes, it works fine.

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

end of thread, other threads:[~2019-07-09 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 20:08 memory leaks from xfs_rw_bdev() Qian Cai
2019-07-08 21:35 ` Christoph Hellwig
2019-07-09 18:31   ` Qian Cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).