[Btrfs-devel] Re: mkfs/mount troubles with the latest btrfs-unstable.

Evgeniy Polyakov johnpol at 2ka.mipt.ru
Tue Mar 25 12:13:40 PDT 2008


On Tue, Mar 25, 2008 at 02:26:02PM -0400, Chris Mason (chris.mason at oracle.com) wrote:
> I'm afraid I can't reproduce this here, any chance the FS was mounted?  At any 
> rate, I'll need the stack trace from the core file.

No, device is not mounted.

Here is first, when mkfs fails:

#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7e85520 in raise () from /lib/i686/cmov/libc.so.6
#2  0xb7e86ee8 in abort () from /lib/i686/cmov/libc.so.6
#3  0x08050d41 in open_ctree_fd (fp=5, path=0xbf848e73 "/dev/sdb1", sb_bytenr=16384) at disk-io.c:502
#4  0x08066825 in make_root_dir (fd=5, device_name=0xbf848e73 "/dev/sdb1") at mkfs.c:71
#5  0x080670ce in main (ac=0, av=0xbf8475a4) at mkfs.c:220

Here is a patch to fix this issue, which brings us to second problem.

diff -r e8debb2f55cc volumes.c
--- a/volumes.c	Mon Mar 24 15:05:44 2008 -0400
+++ b/volumes.c	Tue Mar 25 22:04:22 2008 +0300
@@ -761,7 +761,7 @@ static int read_one_dev(struct btrfs_roo
 {
 	struct btrfs_device *device;
 	u64 devid;
-	int ret;
+	int ret = 0;
 
 	devid = btrfs_device_id(leaf, dev_item);
 	device = btrfs_find_device(root, devid);

r /dev/sdb1
Starting program: /root/btrfs-progs-unstable/mkfs.btrfs /dev/sdb1
found device 1 on /dev/sdb1
lowest devid now 1
found Btrfs on /dev/sdb1 with 1 devices
opening /dev/sdb1 devid 1 fd 7
btrfs_alloc_extent: ret: 0.
btrfs_alloc_extent: ret: 0.
alloc chunk size 134217728 from dev 1
btrfs_alloc_extent: ret: 0.
btrfs_alloc_extent: ret: -28.

It is -ENOSPC after find_free_extent().
# fdisk -l /dev/sdb
This disk has both DOS and BSD magic.
Give the 'b' command to go to BSD mode.

Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          1        36472   292961308+  83  Linux

Here is a trace.

Program received signal SIGABRT, Aborted.
0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7e85520 in raise () from /lib/i686/cmov/libc.so.6
#2  0xb7e86ee8 in abort () from /lib/i686/cmov/libc.so.6
#3  0x08056dfa in btrfs_alloc_extent (trans=0x806af90, root=0x806a118,
num_bytes=16384, root_objectid=1, ref_generation=0, owner=0,
owner_offset=2, empty_size=0, hint_byte=0, 
    search_end=18446744073709551615, ins=0xbfe7e71f, data=4) at
    extent-tree.c:1615
#4  0x08057519 in __btrfs_alloc_free_block (trans=0x806af90,
	root=0x806a118, blocksize=16384, root_objectid=1, ref_generation=0,
	first_objectid=2, level=0, hint=0, empty_size=0)
	at extent-tree.c:1733
#5  0x080495a0 in __btrfs_cow_block (trans=0x806af90,
	root=0x806a118, buf=0x80710b8, parent=0x0, parent_slot=0,
	cow_ret=0xbfe7e8b4, search_start=0, empty_size=0) at ctree.c:173
#6  0x08049b86 in btrfs_cow_block (trans=0x806af90,
	root=0x806a118, buf=0x80710b8, parent=0x0, parent_slot=0,
	cow_ret=0xbfe7e8b4) at ctree.c:250
#7  0x0804b747 in btrfs_search_slot (trans=0x806af90,
	root=0x806a118, key=0x806a4f7, p=0x806b098, ins_len=0, cow=1) at
	ctree.c:1083
#8  0x0805abc4 in btrfs_update_root (trans=0x806af90,
	root=0x806a118, key=0x806a4f7, item=0x806a450) at root-tree.c:75
#9  0x0804fc67 in update_cowonly_root (trans=0x806af90,
	root=0x806a448) at disk-io.c:189
#10 0x0804fd21 in commit_tree_roots (trans=0x806af90,
	fs_info=0x806a558) at disk-io.c:208
#11 0x08050140 in btrfs_commit_transaction (trans=0x806af90,
	root=0x806a008) at disk-io.c:285
#12 0x08066a36 in make_root_dir (fd=5, device_name=0xbfe7fe73
	"/dev/sdb1") at mkfs.c:97
#13 0x0806711a in main (ac=0, av=0xbfe7ebd4) at mkfs.c:220
	

> -chris

-- 
	Evgeniy Polyakov



More information about the Btrfs-devel mailing list