kernel BUG at fs/btrfs/extent-tree.c:6164!

2011-06-06 Thread Tsutomu Itoh
Hi,

I encountered following panic using 'btrfs-unstable + for-linus'
kernel.

I ran btrfs fi bal /test5 command, and mount option of /test5
is as follows:

 /dev/sdc3 on /test5 type btrfs (rw,space_cache,compress=lzo,inode_cache)

Thanks,
Tsutomu

=

btrfs: relocating block group 23383244800 flags 20
btrfs: found 2959 extents
[ cut here ]
WARNING: at fs/btrfs/transaction.c:213 start_transaction+0x2a7/0x2b0 [btrfs]()
Hardware name: PRIMERGY
Modules linked in: autofs4 sunrpc 8021q garp stp llc cpufreq_ondemand acpi_cpufr
eq freq_table mperf ipv6 btrfs zlib_deflate crc32c libcrc32c ext3 jbd dm_mirror
dm_region_hash dm_log dm_mod kvm uinput ppdev parport_pc parport sg pcspkr i2c_i
801 i2c_core iTCO_wdt iTCO_vendor_support tg3 shpchp pci_hotplug i3000_edac edac
_core ext4 mbcache jbd2 crc16 sd_mod crc_t10dif sr_mod cdrom megaraid_sas pata_a
cpi ata_generic ata_piix libata scsi_mod floppy [last unloaded: microcode]
Pid: 23781, comm: btrfs Tainted: GW   2.6.39btrfs-test+ #4
Call Trace:
 [8106004f] warn_slowpath_common+0x7f/0xc0
 [810600aa] warn_slowpath_null+0x1a/0x20
 [a0337047] start_transaction+0x2a7/0x2b0 [btrfs]
 [a035498d] ? btrfs_wait_ordered_range+0x10d/0x160 [btrfs]
 [a0337323] btrfs_start_transaction+0x13/0x20 [btrfs]
 [a033bbca] btrfs_evict_inode+0x11a/0x260 [btrfs]
 [811687f8] evict+0x78/0x170
 [81168c92] iput+0xe2/0x1a0
 [a031f171] btrfs_remove_block_group+0x141/0x3c0 [btrfs]
 [a035e6ea] btrfs_relocate_chunk+0x54a/0x670 [btrfs]
 [a0357668] ? read_extent_buffer+0xd8/0x1d0 [btrfs]
 [a031be51] ? btrfs_previous_item+0xb1/0x150 [btrfs]
 [a035f43a] btrfs_balance+0x21a/0x2b0 [btrfs]
 [8115dc41] ? path_openat+0x101/0x3d0
 [a03685bc] btrfs_ioctl+0x51c/0xc40 [btrfs]
 [8111e358] ? handle_mm_fault+0x148/0x270
 [814809e8] ? do_page_fault+0x1d8/0x4b0
 [81160d6a] do_vfs_ioctl+0x9a/0x540
 [811612b1] sys_ioctl+0xa1/0xb0
 [81484ec2] system_call_fastpath+0x16/0x1b
---[ end trace e5c5cb2e98a3cd1a ]---
btrfs: relocating block group 20971520 flags 18
btrfs: relocating block group 34925969408 flags 18
btrfs: found 1 extents
[ cut here ]
kernel BUG at fs/btrfs/extent-tree.c:6164!
invalid opcode:  [#1] SMP
last sysfs file: /sys/kernel/mm/ksm/run
CPU 0
Modules linked in: autofs4 sunrpc 8021q garp stp llc cpufreq_ondemand 
acpi_cpufreq freq_table mperf ipv6 btrfs zlib_deflate crc32c libcrc32c ext3 jbd 
dm_mirror dm_region_hash dm_log dm_mod kvm uinput ppdev parport_pc parport sg 
pcspkr i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support tg3 shpchp pci_hotplug 
i3000_edac edac_core ext4 mbcache jbd2 crc16 sd_mod crc_t10dif sr_mod cdrom 
megaraid_sas pata_acpi ata_generic ata_piix libata scsi_mod floppy [last 
unloaded: microcode]

Pid: 4109, comm: btrfs Tainted: GW   2.6.39btrfs-test+ #4 FUJITSU-SV
  PRIMERGY/D2399
RIP: 0010:[a0325b95]  [a0325b95] walk_up_proc+0x375/0x420 
[btrfs]
RSP: 0018:8801801eb9c8  EFLAGS: 00010286
RAX: 0005 RBX: 880167a70140 RCX: fff8
RDX: 8801801ea000 RSI: 8800 RDI: 880194909fa8
RBP: 8801801eba18 R08:  R09: 0005
R10: 0001 R11: 880194909fa8 R12: 
R13: 88013973d000 R14: 88015ad4d9a0 R15: 880042203920
FS:  7fa86bcb9740() GS:88019fc0() knlGS:
CS:  0010 DS:  ES:  CR0: 8005003b
CR2: 0033cf60b0c0 CR3: 000181cf7000 CR4: 06f0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Process btrfs (pid: 4109, threadinfo 8801801ea000, task 88011a4914a0)
Stack:
 8801801eba18 880194909fa8 8801 a03280e8
 8801801eba58 88015ad4d9a0  
 8801801ea000 880167a70140 8801801eba78 a0325d71
Call Trace:
 [a03280e8] ? btrfs_run_delayed_refs+0xc8/0x210 [btrfs]
 [a0325d71] walk_up_tree+0x131/0x1b0 [btrfs]
 [a03260b0] btrfs_drop_snapshot+0x2c0/0x5c0 [btrfs]
 [a03328b0] ? btrfs_read_fs_root_no_name+0x1b0/0x280 [btrfs]
 [a037b45f] merge_reloc_roots+0xdf/0x150 [btrfs]
 [a037f311] relocate_block_group+0x481/0x660 [btrfs]
 [a0334d15] ? btrfs_clean_old_snapshots+0x35/0x150 [btrfs]
 [a037f6a3] btrfs_relocate_block_group+0x1b3/0x2e0 [btrfs]
 [a0368d80] ? btrfs_tree_unlock+0x50/0x50 [btrfs]
 [a035e22b] btrfs_relocate_chunk+0x8b/0x670 [btrfs]
 [a031303d] ? btrfs_set_path_blocking+0x3d/0x50 [btrfs]
 [a0357668] ? read_extent_buffer+0xd8/0x1d0 [btrfs]
 [a031be51] ? btrfs_previous_item+0xb1/0x150 [btrfs]
 [a0357668] ? read_extent_buffer+0xd8/0x1d0 [btrfs]
 

kernel BUG at fs/btrfs/inode.c:4676!

2011-06-06 Thread Marek Otahal
Hello, 
the issue happens every time when i have to hard power-off my notebook (suspend 
problems). 
With kernel 2.6.39 the partition is unmountable, solution is to boot 2.6.38 
kernel which 
1/ is able to mount the partition, 
2/ by doing that fixes the problem so later .39 (after clean shutdown) can 
mount it also. 

Attached dmesg follows. 

Thank you, 
Mark

mount options:
/dev/mapper/homeDevice /home btrfs 
defaults,relatime,nodev,nosuid,compress-force=lzo 0 2 # /dev/sda9 home

dmesg:
[   56.994241] loop: module loaded
[   57.172283] Btrfs loaded
[   57.191655] device label store devid 1 transid 26106 /dev/dm-3
[   57.218783] device label home devid 1 transid 450932 /dev/dm-2
[   57.459448] scsi 4:0:0:0: Direct-Access Generic- Multi-Card   1.00 
PQ: 0 ANSI: 0 CCS
[   57.460293] sd 4:0:0:0: Attached scsi generic sg1 type 0
[   57.467030] sd 4:0:0:0: [sdb] Attached SCSI removable disk
[   61.585618] EXT4-fs (sda4): warning: checktime reached, running e2fsck is 
recommended
[   61.671534] EXT4-fs (sda4): re-mounted. Opts: (null)
[   62.211037] device label home devid 1 transid 450932 /dev/mapper/homeDevice
[   62.212058] btrfs: force lzo compression
[   65.335194] [ cut here ]
[   65.335308] kernel BUG at fs/btrfs/inode.c:4676!
[   65.335406] invalid opcode:  [#1] PREEMPT SMP 
[   65.335532] last sysfs file: /sys/devices/virtual/bdi/btrfs-1/uevent
[   65.337833] Modules linked in: btrfs zlib_deflate crc32c libcrc32c loop uas 
ums_realtek uvcvideo usb_storage msr videodev media btusb bluetooth sbs sbshc 
arc4 ecb b43 mac80211 joydev cfg80211 ssb mmc_core pcmcia sg fuse tg3 uhci_hcd 
ideapad_laptop evdev sparse_keymap psmouse pcspkr snd_hda_codec_realtek 
iTCO_wdt iTCO_vendor_support rfkill serio_raw ehci_hcd snd_hda_intel 
pcmcia_core i2c_i801 libphy usbcore ac wmi battery thermal snd_hda_codec 
snd_hwdep snd_pcm snd_timer snd soundcore snd_page_alloc acpi_cpufreq 
freq_table processor mperf sha256_generic sha512_generic ext4 mbcache jbd2 
crc16 cryptd aes_i586 aes_generic xts gf128mul dm_crypt dm_mod sd_mod ata_piix 
libata scsi_mod i915 drm_kms_helper drm i2c_algo_bit button i2c_core video 
intel_agp intel_gtt agpgart
[   65.337833] 
[   65.337833] Pid: 883, comm: mount Not tainted 2.6.39-ARCH #1 LENOVO  
 41875QG /Kuril   
[   65.337833] EIP: 0060:[f9604072] EFLAGS: 00010282 CPU: 1
[   65.337833] EIP is at btrfs_add_link+0x172/0x200 [btrfs]
[   65.337833] EAX: ffef EBX: ef448908 ECX: 0119 EDX: 0111
[   65.337833] ESI: 004255d9 EDI: 0020 EBP: eec77ba4 ESP: eec77b48
[   65.337833]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[   65.337833] Process mount (pid: 883, ti=eec76000 task=f4c8c450 
task.ti=eec76000)
[   65.337833] Stack:
[   65.396712]  0020 004255d9  eec77b87 0001 e55e  
f960d6f8
[   65.396712]  eec77b88 eec77b8c eec77b90 eec77b94 ef472000 f5076800 ef448ba8 
6f43c090
[   65.396712]  46ab 0100    0046ab6f  
eec77c0c
[   65.396712] Call Trace:
[   65.396712]  [f960d6f8] ? btrfs_inode_ref_index+0xd8/0xe0 [btrfs]
[   65.396712]  [f962cfcf] add_inode_ref+0x28f/0x320 [btrfs]
[   65.396712]  [f962de69] replay_one_buffer+0x239/0x320 [btrfs]
[   65.396712]  [f961cc97] ? alloc_extent_buffer+0x77/0x3a0 [btrfs]
[   65.396712]  [f962b7a9] walk_down_log_tree+0x1d9/0x370 [btrfs]
[   65.396712]  [f962b9d9] walk_log_tree+0x99/0x1c0 [btrfs]
[   65.396712]  [f962f2fa] btrfs_recover_log_trees+0x1da/0x2a0 [btrfs]
[   65.396712]  [f962dc30] ? replay_one_dir_item+0xb0/0xb0 [btrfs]
[   65.396712]  [f95f6749] open_ctree+0x1129/0x1490 [btrfs]
[   65.396712]  [c11ac7a9] ? strlcpy+0x39/0x50
[   65.396712]  [f95d756b] btrfs_mount+0x4ab/0x5b0 [btrfs]
[   65.396712]  [c1109d31] mount_fs+0x31/0x170
[   65.396712]  [c11207ac] vfs_kern_mount+0x4c/0x90
[   65.396712]  [c1120b49] do_kern_mount+0x39/0xd0
[   65.396712]  [c1121e31] do_mount+0x161/0x700
[   65.396712]  [c11226f6] sys_mount+0x66/0xa0
[   65.396712]  [c1330edf] sysenter_do_call+0x12/0x28
[   65.396712] Code: 44 24 08 00 00 00 00 89 4c 24 0c 8b 4d 08 89 34 24 e8 73 
cc fe ff 85 c0 0f 84 f0 fe ff ff 8b 5d f4 8b 75 f8 8b 7d fc 89 ec 5d c3 0f 0b 
8b 81 d8 fe ff ff 8d 55 e3 b9 11 00 00 00 89 d7 05 03 01 
[   65.396712] EIP: [f9604072] btrfs_add_link+0x172/0x200 [btrfs] SS:ESP 
0068:eec77b48
[   65.397464] ---[ end trace 5f278c10a67bc917 ]---
[   65.519660] Adding 2561304k swap on /dev/mapper/swapDevice.  Priority:-1 
extents:1 across:2561304k 
[   67.243199] microcode: CPU0 sig=0x106c2, pf=0x4, revision=0x20a
[   67.292031] microcode: CPU1 sig=0x106c2, pf=0x4, revision=0x20a
[   67.298402] microcode: Microcode Update Driver: v2.00 
tig...@aivazian.fsnet.co.uk, Peter Oruba
[   67.305857] microcode: CPU0 updated to revision 0x218, date = 2009-04-10
[   67.315268] microcode: CPU1 updated to revision 0x218, date = 2009-04-10
[   70.985116] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   71.152025] 

Re: New btrfsck status

2011-06-06 Thread Christian Hesse
Chris Mason on 10 Feb 13:17:
 Excerpts from Ben Gamari's message of 2011-02-09 21:52:20 -0500:
  Over the last several months there have been many claims regarding
  the release of the rewritten btrfsck. Unfortunately, despite
  numerous claims that it will be released Real Soon Now(c), I have
  yet to see even a repository with preliminary code. Did I miss an
  announcement? There is something to be said for release early,
  release often. Is there a timeline for getting btrfsck into some
  sort of usable form?

 Yes, but its still real soon now.  I've been at about 90% done since
 Christmas.  It would have been out last week but I've been chasing a
 debugging a very difficult corruption under load.

 I finally found a race in btrfs causing the corruption and now I'm
 back on fsck full time again.

This mail was about four month ago...
Any news on this topic?

I really would like to test btrfs on my desktop systems, but I still
hesitate because of the missing fsck.
-- 
Schoene Gruesse
Chris
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Announcing btrfs-gui

2011-06-06 Thread Chris Mason
Excerpts from Hugo Mills's message of 2011-06-01 19:20:58 -0400:
Over the last few weeks, I've been playing with a foolish idea,
 mostly triggered by a cluster of people being confused by btrfs's free
 space reporting (df vs btrfs fi df vs btrfs fi show). I also wanted an
 excuse, and some code, to mess around in the depths of the FS data
 structures.
 

This is really interesting.  I'm updating my local install of python and
friends so it can run properly.  But I like the idea and will check it
out.

-chris
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: account for space reservations properly

2011-06-06 Thread Josef Bacik
We have been using space_info-bytes_reserved in the metadata case to cover our
reservations for ENOSPC.  The problem with this is thats horribly wrong.  We use
bytes_reserved to keep track of how many bytes the allocator has outstanding
that haven't actually been made into extents yet.  So what has been happening is
that we've been using bytes_reserved for our ENOSPC reservations and our
allocations.

Currently that isn't a big deal, everything is being accounted for
appropriately.  The only thing this affects is how we allocate chunks, so we've
grown all these horrible things to make sure we don't end up with a stupid
amount of metadata chunks.  The problem is we think that the entire space is
used up because we use bytes_used and bytes_reserved to get an idea of how much
is actually in use by real data, but thats not the case.

So switch over to using bytes_may_use, which the data space info stuff has
already been using for the same exact reason.  This will allow us to go back to
pre-emptively allocating chunks in the enospc code.  Thanks,

Signed-off-by: Josef Bacik jo...@redhat.com
---
 fs/btrfs/ctree.h   |2 +-
 fs/btrfs/extent-tree.c |   22 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 91806fe..93a409f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -745,7 +745,7 @@ struct btrfs_space_info {
 
/*
 * we bump reservation progress every time we decrement
-* bytes_reserved.  This way people waiting for reservations
+* bytes_may_use.  This way people waiting for reservations
 * know something good has happened and they can check
 * for progress.  The number here isn't to be trusted, it
 * just shows reclaim activity
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b42efc2..099095e 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3308,7 +3308,7 @@ static int shrink_delalloc(struct btrfs_trans_handle 
*trans,
space_info = block_rsv-space_info;
 
smp_mb();
-   reserved = space_info-bytes_reserved;
+   reserved = space_info-bytes_may_use;
progress = space_info-reservation_progress;
 
if (reserved == 0)
@@ -3328,9 +3328,9 @@ static int shrink_delalloc(struct btrfs_trans_handle 
*trans,
writeback_inodes_sb_nr_if_idle(root-fs_info-sb, nr_pages);
 
spin_lock(space_info-lock);
-   if (reserved  space_info-bytes_reserved)
-   reclaimed += reserved - space_info-bytes_reserved;
-   reserved = space_info-bytes_reserved;
+   if (reserved  space_info-bytes_may_use)
+   reclaimed += reserved - space_info-bytes_may_use;
+   reserved = space_info-bytes_may_use;
spin_unlock(space_info-lock);
 
loops++;
@@ -3408,7 +3408,7 @@ again:
unused = space_info-total_bytes - unused;
if (unused = num_bytes) {
if (!reserved)
-   space_info-bytes_reserved += orig_bytes;
+   space_info-bytes_may_use += orig_bytes;
ret = 0;
} else {
/*
@@ -3434,7 +3434,7 @@ again:
 * stealing it from us.
 */
if (ret  !reserved) {
-   space_info-bytes_reserved += orig_bytes;
+   space_info-bytes_may_use += orig_bytes;
reserved = true;
}
 
@@ -3495,7 +3495,7 @@ again:
 out:
if (reserved) {
spin_lock(space_info-lock);
-   space_info-bytes_reserved -= orig_bytes;
+   space_info-bytes_may_use -= orig_bytes;
spin_unlock(space_info-lock);
}
 
@@ -3579,7 +3579,7 @@ static void block_rsv_release_bytes(struct 
btrfs_block_rsv *block_rsv,
}
if (num_bytes) {
spin_lock(space_info-lock);
-   space_info-bytes_reserved -= num_bytes;
+   space_info-bytes_may_use -= num_bytes;
space_info-reservation_progress++;
spin_unlock(space_info-lock);
}
@@ -3791,12 +3791,12 @@ static void update_global_block_rsv(struct 
btrfs_fs_info *fs_info)
if (sinfo-total_bytes  num_bytes) {
num_bytes = sinfo-total_bytes - num_bytes;
block_rsv-reserved += num_bytes;
-   sinfo-bytes_reserved += num_bytes;
+   sinfo-bytes_may_use += num_bytes;
}
 
if (block_rsv-reserved = block_rsv-size) {
num_bytes = block_rsv-reserved - block_rsv-size;
-   sinfo-bytes_reserved -= num_bytes;
+   sinfo-bytes_may_use -= num_bytes;
sinfo-reservation_progress++;
block_rsv-reserved = block_rsv-size;

Applications using fsync cause hangs for several seconds every few minutes

2011-06-06 Thread Nirbheek Chauhan
Hello list,

I've been using btrfs on my personal machines for about two years now,
and on this machine for about a year with absolutely no problems.
Infact, it has held up better than ext4 with regards to reliability.

However, recently, perhaps with 2.6.39, or after I quickly started
filling up my disk again, it has become impossible for me to work for
long periods on my machine.

Every few minutes, (I guess) when applications do fsync (firefox,
xchat, vim, etc), all applications that use fsync() hang for several
seconds, and applications that use general IO suffer extreme
slowdowns. iotop shows various combinations of the processes listed
below doing writes, and the total write as 2-3MB/s.

[btrfs-dealloc-]
[btrfs-submit-0]
[btrfs-transacti]
[btrfs-endio-wri]
[flush-btrfs-1]

In some extreme cases, I've had hangs for 5 whole minutes. I'm really
beginning to appreciate how little I/O GNOME Shell does since it
remains completely responsive throughout this. I have a feeling that
the cause for this is extreme fragmentation.

My hard disk is a 500GB SATA hdd, my btrfs partition details are:

# btrfs filesystem show
Label: 'gentoo'  uuid: 6f539d7f-f70f-4216-a4a9-6f7a2117a04a
Total devices 1 FS bytes used 246.37GB
devid1 size 345.13GB used 345.13GB path /dev/sda7

Btrfs v0.19-35-g1b444cd-dirty

What can I do to debug this issue? What other information should I
supply? Could someone guide me on how to figure out why my machine is
unusable now?

Thanks in advance,

-- 
~Nirbheek Chauhan

Gentoo GNOME+Mozilla Team
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Delayed inode operations not doing the right thing with enospc

2011-06-06 Thread Miao Xie
On fri, 03 Jun 2011 14:46:10 -0400, Josef Bacik wrote:
 I got a lot of these when running stress.sh on my test box
 
 [ 9792.654889] [ cut here ]
 [ 9792.654898] WARNING: at fs/btrfs/extent-tree.c:5681
 btrfs_alloc_free_block+0xca/0x27c [btrfs]()
 [ 9792.654899] Hardware name: To Be Filled By O.E.M.
 [ 9792.654900] Modules linked in: btrfs zlib_deflate libcrc32c
 ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables
 arc4 rt61pci rt2x00pci rt2x00lib snd_hda_codec_hdmi mac80211
 snd_hda_codec_realtek cfg80211 snd_hda_intel edac_core snd_seq rfkill
 pcspkr serio_raw snd_hda_codec eeprom_93cx6 edac_mce_amd sp5100_tco
 i2c_piix4 k10temp snd_hwdep snd_seq_device snd_pcm floppy r8169 xhci_hcd
 mii snd_timer snd soundcore snd_page_alloc ipv6 firewire_ohci pata_acpi
 ata_generic firewire_core pata_via crc_itu_t radeon ttm drm_kms_helper
 drm i2c_algo_bit i2c_core [last unloaded: scsi_wait_scan]
 [ 9792.654919] Pid: 2762, comm: rm Tainted: GW   2.6.39+ #1
 [ 9792.654920] Call Trace:
 [ 9792.654922]  [81053c4a] warn_slowpath_common+0x83/0x9b
 [ 9792.654925]  [81053c7c] warn_slowpath_null+0x1a/0x1c
 [ 9792.654933]  [a038e747] btrfs_alloc_free_block+0xca/0x27c
 [btrfs]
 [ 9792.654945]  [a03b8562] ? map_extent_buffer+0x6e/0xa8 [btrfs]
 [ 9792.654953]  [a038189b] __btrfs_cow_block+0xfc/0x30c [btrfs]
 [ 9792.654963]  [a0396aa6] ? btrfs_buffer_uptodate+0x47/0x58
 [btrfs]
 [ 9792.654970]  [a0382e48] ? read_block_for_search+0x94/0x368
 [btrfs]
 [ 9792.654978]  [a0381ba9] btrfs_cow_block+0xfe/0x146 [btrfs]
 [ 9792.654986]  [a03848b0] btrfs_search_slot+0x14d/0x4b6 [btrfs]
 [ 9792.654997]  [a03b8562] ? map_extent_buffer+0x6e/0xa8 [btrfs]
 [ 9792.655022]  [a03938e8] btrfs_lookup_inode+0x2f/0x8f [btrfs]
 [ 9792.655025]  [8147afac] ? _cond_resched+0xe/0x22
 [ 9792.655027]  [8147b892] ? mutex_lock+0x29/0x50
 [ 9792.655039]  [a03d41b1]
 btrfs_update_delayed_inode+0x72/0x137 [btrfs]
 [ 9792.655051]  [a03d4ea2] btrfs_run_delayed_items+0x90/0xdb
 [btrfs]
 [ 9792.655062]  [a039a69b]
 btrfs_commit_transaction+0x228/0x654 [btrfs]
 [ 9792.655064]  [8106e8da] ? remove_wait_queue+0x3a/0x3a
 [ 9792.655075]  [a03a2fa5] btrfs_evict_inode+0x14d/0x202 [btrfs]
 [ 9792.655077]  [81132bd6] evict+0x71/0x111
 [ 9792.655079]  [81132de0] iput+0x12a/0x132
 [ 9792.655081]  [8112aa3a] do_unlinkat+0x106/0x155
 [ 9792.655083]  [81127b83] ? path_put+0x1f/0x23
 [ 9792.655085]  [8109c53c] ? audit_syscall_entry+0x145/0x171
 [ 9792.655087]  [81128410] ? putname+0x34/0x36
 [ 9792.655090]  [8112b441] sys_unlinkat+0x29/0x2b
 [ 9792.655092]  [81482c42] system_call_fastpath+0x16/0x1b
 [ 9792.655093] ---[ end trace 02b696eb02b3f768 ]---
 
 
 This is because use_block_rsv() is having to do a
 reserve_metadata_bytes(), which shouldn't happen as we should have
 reserved enough space for those operations to complete.  This is
 happening because use_block_rsv() will call get_block_rsv(), which if
 root-ref_cows is set (which is the case on all fs roots) we will use
 trans-block_rsv, which will only have what the current transaction
 starter had reserved.
 
 What needs to be done instead is we need to have a block reserve that
 any reservation that is done at create time for these inodes is migrated
 to this special reserve, and then when you run the delayed inode items
 stuff you set trans-block_rsv to the special block reserve so the
 accounting is all done properly.
 
 This is just off the top of my head, there may be a better way to do it,
 I've not actually looked that the delayed inode code at all.
 
 I would do this myself but I have a ever increasing list of shit to do
 so will somebody pick this up and fix it please?  Thanks,

Sorry, it's my miss.
I forgot to set trans-block_rsv to global_block_rsv, since we have migrated
the space from trans_block_rsv to global_block_rsv.

I'll fix it soon.

Thanks for your help.
Miao

 
 Josef
 --
 To unsubscribe from this list: send the line unsubscribe linux-btrfs in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at fs/btrfs/extent-tree.c:6164!

2011-06-06 Thread liubo
On 06/06/2011 04:33 PM, Tsutomu Itoh wrote:
 Hi,
 
 I encountered following panic using 'btrfs-unstable + for-linus'
 kernel.
 
 I ran btrfs fi bal /test5 command, and mount option of /test5
 is as follows:
 
  /dev/sdc3 on /test5 type btrfs (rw,space_cache,compress=lzo,inode_cache)
 

So, just a btrfs fi bal would lead to the bug?

I've figured out the warnings, but not reproduced the bug yet...
I used 'btrfs-unstable + for-linus whose top commit is

commit aa0467d8d2a00e75b2bb6a56a4ee6d70c5d1928f
Author: David Sterba dste...@suse.cz
Date:   Fri Jun 3 16:29:08 2011 +0200

btrfs: fix uninitialized variable warning

and tried on 1) a single disk, 2) 2 disks and 3) 4 disks respectively,
but none of them leaded to the below bug.

I guess maybe I miss something to reproduce it?

thanks,
liubo

 Thanks,
 Tsutomu
 
 =
 
 btrfs: relocating block group 23383244800 flags 20
 btrfs: found 2959 extents
 [ cut here ]
 WARNING: at fs/btrfs/transaction.c:213 start_transaction+0x2a7/0x2b0 [btrfs]()
 Hardware name: PRIMERGY
 Modules linked in: autofs4 sunrpc 8021q garp stp llc cpufreq_ondemand 
 acpi_cpufr
 eq freq_table mperf ipv6 btrfs zlib_deflate crc32c libcrc32c ext3 jbd 
 dm_mirror
 dm_region_hash dm_log dm_mod kvm uinput ppdev parport_pc parport sg pcspkr 
 i2c_i
 801 i2c_core iTCO_wdt iTCO_vendor_support tg3 shpchp pci_hotplug i3000_edac 
 edac
 _core ext4 mbcache jbd2 crc16 sd_mod crc_t10dif sr_mod cdrom megaraid_sas 
 pata_a
 cpi ata_generic ata_piix libata scsi_mod floppy [last unloaded: microcode]
 Pid: 23781, comm: btrfs Tainted: GW   2.6.39btrfs-test+ #4
 Call Trace:
  [8106004f] warn_slowpath_common+0x7f/0xc0
  [810600aa] warn_slowpath_null+0x1a/0x20
  [a0337047] start_transaction+0x2a7/0x2b0 [btrfs]
  [a035498d] ? btrfs_wait_ordered_range+0x10d/0x160 [btrfs]
  [a0337323] btrfs_start_transaction+0x13/0x20 [btrfs]
  [a033bbca] btrfs_evict_inode+0x11a/0x260 [btrfs]
  [811687f8] evict+0x78/0x170
  [81168c92] iput+0xe2/0x1a0
  [a031f171] btrfs_remove_block_group+0x141/0x3c0 [btrfs]
  [a035e6ea] btrfs_relocate_chunk+0x54a/0x670 [btrfs]
  [a0357668] ? read_extent_buffer+0xd8/0x1d0 [btrfs]
  [a031be51] ? btrfs_previous_item+0xb1/0x150 [btrfs]
  [a035f43a] btrfs_balance+0x21a/0x2b0 [btrfs]
  [8115dc41] ? path_openat+0x101/0x3d0
  [a03685bc] btrfs_ioctl+0x51c/0xc40 [btrfs]
  [8111e358] ? handle_mm_fault+0x148/0x270
  [814809e8] ? do_page_fault+0x1d8/0x4b0
  [81160d6a] do_vfs_ioctl+0x9a/0x540
  [811612b1] sys_ioctl+0xa1/0xb0
  [81484ec2] system_call_fastpath+0x16/0x1b
 ---[ end trace e5c5cb2e98a3cd1a ]---
 btrfs: relocating block group 20971520 flags 18
 btrfs: relocating block group 34925969408 flags 18
 btrfs: found 1 extents
 [ cut here ]
 kernel BUG at fs/btrfs/extent-tree.c:6164!
 invalid opcode:  [#1] SMP
 last sysfs file: /sys/kernel/mm/ksm/run
 CPU 0
 Modules linked in: autofs4 sunrpc 8021q garp stp llc cpufreq_ondemand 
 acpi_cpufreq freq_table mperf ipv6 btrfs zlib_deflate crc32c libcrc32c ext3 
 jbd dm_mirror dm_region_hash dm_log dm_mod kvm uinput ppdev parport_pc 
 parport sg pcspkr i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support tg3 shpchp 
 pci_hotplug i3000_edac edac_core ext4 mbcache jbd2 crc16 sd_mod crc_t10dif 
 sr_mod cdrom megaraid_sas pata_acpi ata_generic ata_piix libata scsi_mod 
 floppy [last unloaded: microcode]
 
 Pid: 4109, comm: btrfs Tainted: GW   2.6.39btrfs-test+ #4 FUJITSU-SV  
 PRIMERGY/D2399
 RIP: 0010:[a0325b95]  [a0325b95] walk_up_proc+0x375/0x420 
 [btrfs]
 RSP: 0018:8801801eb9c8  EFLAGS: 00010286
 RAX: 0005 RBX: 880167a70140 RCX: fff8
 RDX: 8801801ea000 RSI: 8800 RDI: 880194909fa8
 RBP: 8801801eba18 R08:  R09: 0005
 R10: 0001 R11: 880194909fa8 R12: 
 R13: 88013973d000 R14: 88015ad4d9a0 R15: 880042203920
 FS:  7fa86bcb9740() GS:88019fc0() knlGS:
 CS:  0010 DS:  ES:  CR0: 8005003b
 CR2: 0033cf60b0c0 CR3: 000181cf7000 CR4: 06f0
 DR0:  DR1:  DR2: 
 DR3:  DR6: 0ff0 DR7: 0400
 Process btrfs (pid: 4109, threadinfo 8801801ea000, task 88011a4914a0)
 Stack:
  8801801eba18 880194909fa8 8801 a03280e8
  8801801eba58 88015ad4d9a0  
  8801801ea000 880167a70140 8801801eba78 a0325d71
 Call Trace:
  [a03280e8] ? btrfs_run_delayed_refs+0xc8/0x210 [btrfs]
  [a0325d71] walk_up_tree+0x131/0x1b0 [btrfs]
  [a03260b0] btrfs_drop_snapshot+0x2c0/0x5c0 [btrfs]
  [a03328b0] 

Re: btrfs hang on brd

2011-06-06 Thread Adrian Hunter

On 03/06/11 12:41, Adrian Hunter wrote:

No improvement on 3.0-rc1+ (commit
5c6cce92bc8aee751aafe82c5d9caf7553226a3d).


And on 59c5f46fbe01a00eedf54a23789634438bb80603 Linux 3.0-rc2
btrfs quickly fails to mount due to no space e.g.


Script
--

#!/bin/sh

sudo modprobe brd rd_size=262144

sudo umount /mnt/test/ 2 /dev/null

echo 'mkfs.btrfs /dev/ram0'

sudo mkfs.btrfs /dev/ram0

sudo mkdir -p /mnt/test

echo 'mount -t btrfs /dev/ram0 /mnt/test'

sudo mount -t btrfs /dev/ram0 /mnt/test

sudo mkdir -p /mnt/test/test

sudo chown $USER /mnt/test/test
sudo chgrp $USER /mnt/test/test

sudo umount /mnt/test

full=0
i=0
while true; do
sudo mount -t btrfs /dev/ram0 /mnt/test

if df | grep ram0 | grep 100%  /dev/null; then
full=`expr $full \+ 1`
if test $full -gt 6;then
rm -rf /mnt/test/test/*
full=0
fi
else
full=0
fi

fsstress -c -r -d /mnt/test/test -p 3 -n 1000 -l 10

sudo umount /mnt/test

i=`expr $i \+ 1`
echo $i
done



Script Output
-

mkfs.btrfs /dev/ram0

WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label (null) on /dev/ram0
nodesize 4096 leafsize 4096 sectorsize 4096 size 256.00MB
Btrfs Btrfs v0.19
mount -t btrfs /dev/ram0 /mnt/test
1
2
3
4
mount: No space left on device
^C



Kernel messages
---

[   95.084429] brd: module loaded
[   95.368708] Btrfs loaded
[   95.369455] device fsid 9644bae59f78285c-8db3a698a8a82293 devid 1 
transid 7 /dev/ram0

[   95.370582] SELinux: initialized (dev ram0, type btrfs), uses xattr
[   95.487905] device fsid 9644bae59f78285c-8db3a698a8a82293 devid 1 
transid 10 /dev/ram0

[   95.49] SELinux: initialized (dev ram0, type btrfs), uses xattr
[  107.336869] device fsid 9644bae59f78285c-8db3a698a8a82293 devid 1 
transid 2664 /dev/ram0

[  107.338873] SELinux: initialized (dev ram0, type btrfs), uses xattr
[  115.861909] device fsid 9644bae59f78285c-8db3a698a8a82293 devid 1 
transid 6816 /dev/ram0

[  115.864089] SELinux: initialized (dev ram0, type btrfs), uses xattr
[  122.586606] device fsid 9644bae59f78285c-8db3a698a8a82293 devid 1 
transid 10872 /dev/ram0

[  122.587779] SELinux: initialized (dev ram0, type btrfs), uses xattr
[  128.824401] BTRFS: inode 19622 still on the orphan list
[  128.844945] [ cut here ]
[  128.844969] WARNING: at fs/btrfs/extent-tree.c:6878 
btrfs_free_block_groups+0x1e6/0x228 [btrfs]()

[  128.844973] Hardware name: XPS 8300
[  128.844974] Modules linked in: btrfs zlib_deflate libcrc32c brd tun 
fuse cpufreq_ondemand acpi_cpufreq freq_table mperf ip6t_REJECT 
nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables ipv6 uinput 
snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec 
snd_hwdep snd_seq snd_seq_device snd_pcm broadcom snd_timer snd tg3 
pcspkr joydev iTCO_wdt iTCO_vendor_support soundcore snd_page_alloc 
i2c_i801 serio_raw dcdbas microcode usb_storage i915 drm_kms_helper drm 
i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan]
[  128.845024] Pid: 2503, comm: umount Not tainted 
3.0.0-rc2-2011-06-06-02+ #13

[  128.845026] Call Trace:
[  128.845035]  [8104db2e] warn_slowpath_common+0x85/0x9d
[  128.845050]  [a02a6b70] ? 
btrfs_free_block_groups+0x204/0x228 [btrfs]

[  128.845056]  [8104db60] warn_slowpath_null+0x1a/0x1c
[  128.845069]  [a02a6b52] btrfs_free_block_groups+0x1e6/0x228 
[btrfs]

[  128.845087]  [a02afa0b] close_ctree+0x22c/0x346 [btrfs]
[  128.845092]  [8103d068] ? should_resched+0xe/0x2e
[  128.845097]  [8147abfe] ? _cond_resched+0xe/0x22
[  128.845100]  [8147b7d5] ? down_write+0x29/0x49
[  128.845110]  [a0295a1e] btrfs_put_super+0x1d/0x2c [btrfs]
[  128.845116]  [8111ecb4] generic_shutdown_super+0x74/0xe9
[  128.845120]  [8111eda9] kill_anon_super+0x16/0x50
[  128.845125]  [8111efd6] deactivate_locked_super+0x26/0x4b
[  128.845129]  [8111f7c5] deactivate_super+0x3a/0x3f
[  128.845133]  [81134a09] mntput_no_expire+0xd0/0xd5
[  128.845136]  [81135688] sys_umount+0x2dc/0x30a
[  128.845141]  [81125c64] ? path_put+0x22/0x27
[  128.845145]  [814828c2] system_call_fastpath+0x16/0x1b
[  128.845149] ---[ end trace e535ebf83dd43354 ]---
[  128.845152] space_info has 8814592 free, is full
[  128.845156] space_info total=41943040, used=24576000, pinned=0, 
reserved=98304, may_use=0, readonly=8454144
[  128.897312] device fsid 9644bae59f78285c-8db3a698a8a82293 devid 1 
transid 14722 /dev/ram0

[  128.910740] BTRFS: inode 19622 still on the orphan list
[  128.910747] btrfs: could not do orphan cleanup -28
[  128.948912] btrfs: open_ctree failed
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org