linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Lots of trouble hanging when rm files with many extents
@ 2013-10-19 23:12 John Goerzen
  0 siblings, 0 replies; 7+ messages in thread
From: John Goerzen @ 2013-10-19 23:12 UTC (permalink / raw)
  To: linux-btrfs

Hello folks,

I reported a bug here:

https://bugzilla.kernel.org/show_bug.cgi?id=63071

but I am not sure if that was the right thing to do.  This is producing OOM
issues and leading to system crashes (including eventual panics) with such
alarming frequency that I wonder if perhaps there is something different
about my setup than others.

In a nutshell, I originally made the mistake of storing a VirtualBox 40G
.vdi file on a btrfs partition (kernel 3.10).  I  managed to copy it to a
file marked chattr +C (I read the wiki *NOW*), but I couldn't delete the
original file -- rm hangs the system.

(I actually have the original file and another made with cp --reflink of it,
while trying to diagnose the issue.  I need to rm both of them)

rm starts out with lots of hard disk activity, then that stops.  I
eventually get the attached kernel BUG, then a little bit later it panics
due to out of memory.

But later I had the virtually identical problem on another system, this one
on just a 5GB file with about 25,000 extents (it was the restoresymtable
from restore(8) from the e2fs dump/restore pair).   That took down my
server, trying to delete it.

I would have expected btrfs to be more resilient by this point.  Any ideas?

Thanks,

John


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

* Re: Lots of trouble hanging when rm files with many extents
@ 2013-10-20 14:51 Tomasz Chmielewski
  2013-10-21  3:40 ` John Goerzen
  0 siblings, 1 reply; 7+ messages in thread
From: Tomasz Chmielewski @ 2013-10-20 14:51 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org, jgoerzen

> but I am not sure if that was the right thing to do.  This is
> producing OOM issues and leading to system crashes (including
> eventual panics) with such alarming frequency that I wonder if
> perhaps there is something different about my setup than others.

FYI, I'm seeing similar / random hangs on systems with btrfs,
compress-force=zlib, qgroups enabled. The systems have 32 GB RAM.
Sometimes, I can review old logs (after force reboot) and see OOM,
allocation failures and such.

The scenario there are snapshots, rsync with --inplace flag, which can
fragment files a lot.

I'll do some more tests with lots of extents to see if it's
reproducible here as well.


-- 
Tomasz Chmielewski
http://wpkg.org

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

* Re: Lots of trouble hanging when rm files with many extents
  2013-10-20 14:51 Tomasz Chmielewski
@ 2013-10-21  3:40 ` John Goerzen
  0 siblings, 0 replies; 7+ messages in thread
From: John Goerzen @ 2013-10-21  3:40 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: linux-btrfs@vger.kernel.org

On 10/20/2013 09:51 AM, Tomasz Chmielewski wrote:
>> but I am not sure if that was the right thing to do.  This is
>> producing OOM issues and leading to system crashes (including
>> eventual panics) with such alarming frequency that I wonder if
>> perhaps there is something different about my setup than others.
> FYI, I'm seeing similar / random hangs on systems with btrfs,
> compress-force=zlib, qgroups enabled. The systems have 32 GB RAM.
> Sometimes, I can review old logs (after force reboot) and see OOM,
> allocation failures and such.
>
> The scenario there are snapshots, rsync with --inplace flag, which can
> fragment files a lot.
>
> I'll do some more tests with lots of extents to see if it's
> reproducible here as well.
>
>
Interestingly, I've generally had qgroups enabled here as well, possibly 
on all of these systems.  Could that be the culprit?

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

* Re: Lots of trouble hanging when rm files with many extents
@ 2013-10-21  4:36 Tomasz Chmielewski
  2013-10-21  9:58 ` Duncan
  2013-10-21 13:47 ` John Goerzen
  0 siblings, 2 replies; 7+ messages in thread
From: Tomasz Chmielewski @ 2013-10-21  4:36 UTC (permalink / raw)
  To: jgoerzen, linux-btrfs

> > I'll do some more tests with lots of extents to see if it's
> > reproducible here as well.
> 
> Interestingly, I've generally had qgroups enabled here as well,
> possibly on all of these systems.  Could that be the culprit?

Possibly.

Is there a reliable way to create files with many extents? I've tried
playing with fallocate, but couldn't create files with too many extents
with it.


-- 
Tomasz Chmielewski
http://wpkg.org

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

* Re: Lots of trouble hanging when rm files with many extents
  2013-10-21  4:36 Lots of trouble hanging when rm files with many extents Tomasz Chmielewski
@ 2013-10-21  9:58 ` Duncan
  2013-10-21 13:47 ` John Goerzen
  1 sibling, 0 replies; 7+ messages in thread
From: Duncan @ 2013-10-21  9:58 UTC (permalink / raw)
  To: linux-btrfs

Tomasz Chmielewski posted on Mon, 21 Oct 2013 13:36:44 +0900 as excerpted:

>> > I'll do some more tests with lots of extents to see if it's
>> > reproducible here as well.
>> 
>> Interestingly, I've generally had qgroups enabled here as well,
>> possibly on all of these systems.  Could that be the culprit?
> 
> Possibly.
> 
> Is there a reliable way to create files with many extents? I've tried
> playing with fallocate, but couldn't create files with too many extents
> with it.

While the absense of both qgroups and the problem here doesn't prove 
anything, it's a datapoint.  However, I /am/ a bit suspicious of them, as 
it just seems people keep reporting weird problems and the common thread 
often seems to be qgroups.  I'm not a coder let alone a kernel/btrfs 
coder so take this with a suitably sized grain of salt, but my intuition 
says qgroups add more stress to the system and likely some as yet 
unresolved race-points, and they raise the possibility of triggering 
otherwise unrelated problems that already exist, along with any issues 
they themselves might have.

That would fit with the many-thousands-of-extents issues here as well, 
since especially on spinning rust that's going to create all sorts of 
stress on the drive and filesystem and all sorts of potential to trigger 
race conditions.  If both of them increase stress and open up the 
critical sections during which races are possible, putting the two 
together is an effective torture-test likely indeed to bring out 
otherwise extremely small window race conditions that might otherwise 
very seldom trigger.

Meanwhile, on the extents issue I believe creating a large enough file 
and then writing into random locations within it, saving, writing some 
more, should do it, given btrfs' copy-on-write defaults.

Working with an almost full filesystem is likely to create worse 
fragmentation too, since at some point btrfs just gives up trying to 
create single-extent files and writes anywhere it can find space.

Finally, btrfs compression is said to look like fragmentation to 
filefrag.  I'm not sure whether it /acts/ like fragmentation or not, but 
any suitably large file that gets btrfs compression will look fragmented 
I believe because the compression blocks (128KB IIRC) are reported to 
filefrag as individual extents due to the way btrfs handles and tracks 
them.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


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

* Re: Lots of trouble hanging when rm files with many extents
  2013-10-21  4:36 Lots of trouble hanging when rm files with many extents Tomasz Chmielewski
  2013-10-21  9:58 ` Duncan
@ 2013-10-21 13:47 ` John Goerzen
  1 sibling, 0 replies; 7+ messages in thread
From: John Goerzen @ 2013-10-21 13:47 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: linux-btrfs

On 10/20/2013 11:36 PM, Tomasz Chmielewski wrote:
>>> I'll do some more tests with lots of extents to see if it's
>>> reproducible here as well.
>> Interestingly, I've generally had qgroups enabled here as well,
>> possibly on all of these systems.  Could that be the culprit?
> Possibly.
>
> Is there a reliable way to create files with many extents? I've tried
> playing with fallocate, but couldn't create files with too many extents
> with it.
I could do it quite reliably by storing a VirtualBox VM hard drive image 
there, then running a Windows Update inside the VM.  Instant 
fragmentation ;-)

Another approach could probably be to write a C program that writes 20GB 
to a file, then seeks to random places within it, writing chunks of data 
within them.

I could probably whip up such a thing if the debuggers need it.

John

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

* Re: Lots of trouble hanging when rm files with many extents
@ 2013-10-22  9:40 Tomasz Chmielewski
  0 siblings, 0 replies; 7+ messages in thread
From: Tomasz Chmielewski @ 2013-10-22  9:40 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org, jgoerzen

> Another approach could probably be to write a C program that writes
> 20GB to a file, then seeks to random places within it, writing chunks
> of data within them.
> 
> I could probably whip up such a thing if the debuggers need it.

That would be very useful, I guess!

-- 
Tomasz Chmielewski
http://wpkg.org

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

end of thread, other threads:[~2013-10-22  9:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21  4:36 Lots of trouble hanging when rm files with many extents Tomasz Chmielewski
2013-10-21  9:58 ` Duncan
2013-10-21 13:47 ` John Goerzen
  -- strict thread matches above, loose matches on Subject: below --
2013-10-22  9:40 Tomasz Chmielewski
2013-10-20 14:51 Tomasz Chmielewski
2013-10-21  3:40 ` John Goerzen
2013-10-19 23:12 John Goerzen

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).