2019-07-26 13:18:31

by Paul Menzel

[permalink] [raw]
Subject: BTRFS: Kmemleak errrors with do_sys_ftruncate

Dear Linux folks,


On a Power 8 server

Linux power 5.3.0-rc1+ #1 SMP Fri Jul 26 11:34:28 CEST 2019 ppc64le ppc64le ppc64le GNU/Linux

Kmemleak reports the warnings below.

```
$ sudo more /sys/kernel/debug/kmemleak
unreferenced object 0xc00000f290866130 (size 80):
comm "networkd-dispat", pid 7630, jiffies 4294903138 (age 6540.748s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
40 61 86 90 f2 00 00 c0 00 00 00 00 00 00 00 00 @a..............
backtrace:
[<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
[<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
[<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
[<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
[<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
[<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
[<000000008f89382e>] notify_change+0x218/0x5b0
[<00000000fc1ffb03>] do_truncate+0x9c/0x140
[<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
[<00000000f67bba86>] system_call+0x5c/0x70
unreferenced object 0xc000007f9cc555f0 (size 80):
comm "unattended-upgr", pid 8069, jiffies 4294903488 (age 6539.396s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
00 56 c5 9c 7f 00 00 c0 00 00 00 00 00 00 00 00 .V..............
backtrace:
[<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
[<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
[<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
[<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
[<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
[<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
[<000000008f89382e>] notify_change+0x218/0x5b0
[<00000000fc1ffb03>] do_truncate+0x9c/0x140
[<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
[<00000000f67bba86>] system_call+0x5c/0x70
unreferenced object 0xc000007fa1431fe0 (size 80):
comm "lxd", pid 8347, jiffies 4294904066 (age 6537.104s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
f0 1f 43 a1 7f 00 00 c0 00 00 00 00 00 00 00 00 ..C.............
backtrace:
[<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
[<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
[<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
[<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
[<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
[<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
[<000000008f89382e>] notify_change+0x218/0x5b0
[<00000000fc1ffb03>] do_truncate+0x9c/0x140
[<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
[<00000000f67bba86>] system_call+0x5c/0x70
unreferenced object 0xc000007f98359470 (size 80):
comm "lxd", pid 8347, jiffies 4294904738 (age 6534.416s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
80 94 35 98 7f 00 00 c0 00 00 00 00 00 00 00 00 ..5.............
backtrace:
[<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
[<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
[<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
[<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
[<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
[<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
[<000000008f89382e>] notify_change+0x218/0x5b0
[<00000000fc1ffb03>] do_truncate+0x9c/0x140
[<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
[<00000000f67bba86>] system_call+0x5c/0x70
unreferenced object 0xc000007f9e7078f0 (size 80):
comm "landscape-sysin", pid 10187, jiffies 4295061226 (age 5908.520s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
00 79 70 9e 7f 00 00 c0 00 00 00 00 00 00 00 00 .yp.............
backtrace:
[<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
[<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
[<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
[<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
[<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
[<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
[<000000008f89382e>] notify_change+0x218/0x5b0
[<00000000fc1ffb03>] do_truncate+0x9c/0x140
[<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
[<00000000f67bba86>] system_call+0x5c/0x70
unreferenced object 0xc00000f29b4f48d0 (size 80):
comm "landscape-sysin", pid 14433, jiffies 4295569439 (age 3876.396s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
e0 48 4f 9b f2 00 00 c0 00 00 00 00 00 00 00 00 .HO.............
backtrace:
[<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
[<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
[<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
[<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
[<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
[<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
[<000000008f89382e>] notify_change+0x218/0x5b0
[<00000000fc1ffb03>] do_truncate+0x9c/0x140
[<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
[<00000000f67bba86>] system_call+0x5c/0x70
```

I believe these have been present for some releases already, but Kmemleak
was broken until now on that system, so that I could only report them now.


Kind regards,

Paul


Attachments:
smime.p7s (5.05 kB)
S/MIME Cryptographic Signature

2019-07-26 13:27:18

by Nikolay Borisov

[permalink] [raw]
Subject: Re: BTRFS: Kmemleak errrors with do_sys_ftruncate



On 26.07.19 г. 16:16 ч., Paul Menzel wrote:
> Dear Linux folks,
>
>
> On a Power 8 server
>
> Linux power 5.3.0-rc1+ #1 SMP Fri Jul 26 11:34:28 CEST 2019 ppc64le ppc64le ppc64le GNU/Linux
>
> Kmemleak reports the warnings below.
>
> ```
> $ sudo more /sys/kernel/debug/kmemleak
> unreferenced object 0xc00000f290866130 (size 80):
> comm "networkd-dispat", pid 7630, jiffies 4294903138 (age 6540.748s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
> 40 61 86 90 f2 00 00 c0 00 00 00 00 00 00 00 00 @a..............
> backtrace:
> [<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
> [<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
> [<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
> [<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
> [<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
> [<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
> [<000000008f89382e>] notify_change+0x218/0x5b0
> [<00000000fc1ffb03>] do_truncate+0x9c/0x140
> [<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
> [<00000000f67bba86>] system_call+0x5c/0x70
> unreferenced object 0xc000007f9cc555f0 (size 80):
> comm "unattended-upgr", pid 8069, jiffies 4294903488 (age 6539.396s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
> 00 56 c5 9c 7f 00 00 c0 00 00 00 00 00 00 00 00 .V..............
> backtrace:
> [<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
> [<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
> [<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
> [<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
> [<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
> [<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
> [<000000008f89382e>] notify_change+0x218/0x5b0
> [<00000000fc1ffb03>] do_truncate+0x9c/0x140
> [<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
> [<00000000f67bba86>] system_call+0x5c/0x70
> unreferenced object 0xc000007fa1431fe0 (size 80):
> comm "lxd", pid 8347, jiffies 4294904066 (age 6537.104s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
> f0 1f 43 a1 7f 00 00 c0 00 00 00 00 00 00 00 00 ..C.............
> backtrace:
> [<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
> [<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
> [<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
> [<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
> [<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
> [<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
> [<000000008f89382e>] notify_change+0x218/0x5b0
> [<00000000fc1ffb03>] do_truncate+0x9c/0x140
> [<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
> [<00000000f67bba86>] system_call+0x5c/0x70
> unreferenced object 0xc000007f98359470 (size 80):
> comm "lxd", pid 8347, jiffies 4294904738 (age 6534.416s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
> 80 94 35 98 7f 00 00 c0 00 00 00 00 00 00 00 00 ..5.............
> backtrace:
> [<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
> [<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
> [<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
> [<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
> [<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
> [<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
> [<000000008f89382e>] notify_change+0x218/0x5b0
> [<00000000fc1ffb03>] do_truncate+0x9c/0x140
> [<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
> [<00000000f67bba86>] system_call+0x5c/0x70
> unreferenced object 0xc000007f9e7078f0 (size 80):
> comm "landscape-sysin", pid 10187, jiffies 4295061226 (age 5908.520s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
> 00 79 70 9e 7f 00 00 c0 00 00 00 00 00 00 00 00 .yp.............
> backtrace:
> [<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
> [<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
> [<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
> [<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
> [<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
> [<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
> [<000000008f89382e>] notify_change+0x218/0x5b0
> [<00000000fc1ffb03>] do_truncate+0x9c/0x140
> [<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
> [<00000000f67bba86>] system_call+0x5c/0x70
> unreferenced object 0xc00000f29b4f48d0 (size 80):
> comm "landscape-sysin", pid 14433, jiffies 4295569439 (age 3876.396s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................
> e0 48 4f 9b f2 00 00 c0 00 00 00 00 00 00 00 00 .HO.............
> backtrace:
> [<00000000ecec0137>] alloc_extent_state+0x4c/0x1b0 [btrfs]
> [<000000003f22a890>] __set_extent_bit+0x330/0x790 [btrfs]
> [<0000000020fcf70f>] lock_extent_bits+0x98/0x320 [btrfs]
> [<000000001d1d0f77>] btrfs_lock_and_flush_ordered_range+0xf0/0x1b0 [btrfs]
> [<00000000195c001c>] btrfs_cont_expand+0x14c/0x600 [btrfs]
> [<00000000f280c100>] btrfs_setattr+0x130/0x770 [btrfs]
> [<000000008f89382e>] notify_change+0x218/0x5b0
> [<00000000fc1ffb03>] do_truncate+0x9c/0x140
> [<000000008b736052>] do_sys_ftruncate+0x1e4/0x210
> [<00000000f67bba86>] system_call+0x5c/0x70
> ```
>
> I believe these have been present for some releases already, but Kmemleak
> was broken until now on that system, so that I could only report them now.

the lock and flush ordered range leaks were fixed just today by patch :

btrfs: fix extent_state leak in btrfs_lock_and_flush_ordered_range

So either get it and retest or wait until the RC2 pull req gets merged.


>
>
> Kind regards,
>
> Paul
>

2019-07-26 13:30:00

by David Sterba

[permalink] [raw]
Subject: Re: BTRFS: Kmemleak errrors with do_sys_ftruncate

On Fri, Jul 26, 2019 at 03:16:57PM +0200, Paul Menzel wrote:
> Dear Linux folks,
>
>
> On a Power 8 server
>
> Linux power 5.3.0-rc1+ #1 SMP Fri Jul 26 11:34:28 CEST 2019 ppc64le ppc64le ppc64le GNU/Linux
>
> Kmemleak reports the warnings below.

There are memory leaks of struct extent_state introduced in 5.3 pull and
there's a fix going to 5.3-rc2 (https://patchwork.kernel.org/patch/11060447/).

> I believe these have been present for some releases already, but Kmemleak
> was broken until now on that system, so that I could only report them now.

We have a leak detector built-in btrfs so I think we'd notice and that
you observe the known leak. You could try to apply the patch or wait for
rc2 and restst.