Re: kernel BUG at fs/btrfs/inode.c:1163

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 19, 2011 at 02:59:45PM +0200, Martin Mailand wrote:
> Am 19.10.2011 11:49, schrieb David Sterba:
> >It would be interesting what's the value of 'extent_type' at the time of
> >crash, if it's eg -1 that could point to a real bug, some unhandled
> >corner case in truncate, for example.
> >
> 
> How can I do that?

something like that would print the type information during runtime

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1160,6 +1160,11 @@ next_slot:
                                btrfs_file_extent_inline_len(leaf, fi);
                        extent_end = ALIGN(extent_end, root->sectorsize);
                } else {
+                       printk(KERN_CRIT "btrfs: unhandled extent type %d, key=[%llu,%u,%llu]",
+                                       (unsigned long long)found_key.objecitd,
+                                       (unsigned)found_key.tyep,
+                                       (unsigned long long)found_key.offset,
+                                       extent_type);
                        BUG_ON(1);
                }
 out_check:
---

the key seems to be a relevant iformation to print as well, but the rest
stored in the leaf item could be just garbage.

The btrfs-debug-tree utility prints the whole tree items, but as I saw just now
in the case of extent, it skips an unknown type (the same where kernel
BUGs), which means that other extent data are glued to previous output
and thus cannot be spotted easily. To fix that, apply these changes to
progs' print-tree.c:

--- a/print-tree.c
+++ b/print-tree.c
@@ -138,7 +138,7 @@ static void print_file_extent_item(struct extent_buffer *eb,
                  btrfs_file_extent_inline_len(eb, fi),
                  btrfs_file_extent_compression(eb, fi));
                return;
-       }
+       } else
        if (extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
                printf("\t\tprealloc data disk byte %llu nr %llu\n",
                  (unsigned long long)btrfs_file_extent_disk_bytenr(eb, fi),
@@ -147,6 +147,8 @@ static void print_file_extent_item(struct extent_buffer *eb,
                  (unsigned long long)btrfs_file_extent_offset(eb, fi),
                  (unsigned long long)btrfs_file_extent_num_bytes(eb, fi));
                return;
+       } else {
+               printf("*** ERROR unknown extent type %d\n", extent_type);
        }
        printf("\t\textent data disk byte %llu nr %llu\n",
                (unsigned long long)btrfs_file_extent_disk_bytenr(eb, fi),
---

and run the utility on your fs.


david
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux