Skip to contentSkip to conversation

Btrfs: abort the transaction when we don't find our extent ref

PATCH In review Josef Bacik 3 participants 3 messages Mar 14, 2014 – May 3, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: abort the transaction when we don't find our extent ref

I'm not sure why we weren't aborting here in the first place, it is obviously a bad time from the fact that we print the leaf and yell loudly about it. Fix this up, otherwise we panic because our path could be pointing into oblivion. Thanks,

---
 fs/btrfs/extent-tree.c | 2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/extent-tree.c +2 -0
index 696f0b6..0015b02 100644
@@ -5744,6 +5744,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
 			"unable to find ref byte nr %llu parent %llu root %llu  owner %llu offset %llu",
 			bytenr, parent, root_objectid, owner_objectid,
 			owner_offset);
+		btrfs_abort_transaction(trans, extent_root, ret);
+		goto out;
 	} else {
 		btrfs_abort_transaction(trans, extent_root, ret);
 		goto out;
Signature · 1 line
1.8.3.1
#1 lore raw

fs/btrfs/extent-tree.c static int __btrfs_free_extent(struct btrfs_trans_handle *trans,

Quoted 15 lines · Josef Bacik

I'm not sure why we weren't aborting here in the first place, it is obviously a bad time from the fact that we print the leaf and yell loudly about it. Fix this up, otherwise we panic because our path could be pointing into oblivion. Thanks,

---
 fs/btrfs/extent-tree.c | 2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/extent-tree.c +0 -0
index 696f0b6..0015b02 100644
@@ -5744,6 +5744,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,

Adding context:

5748 } else if (WARN_ON(ret == -ENOENT)) {
5749 btrfs_print_leaf(extent_root, path->nodes[0]);
5750 btrfs_err(info,

fs/btrfs/extent-tree.c static int __btrfs_free_extent(struct btrfs_trans_handle *trans, · line 5747

Quoted 4 lines
fs/btrfs/extent-tree.c +1 -0
 			"unable to find ref byte nr %llu parent %llu root %llu  owner %llu offset %llu",
 			bytenr, parent, root_objectid, owner_objectid,
 			owner_offset);
+		btrfs_abort_transaction(trans, extent_root, ret);

Abort prints stacktrace on it's own and with the WARN_ON above it would be noisy and without any extra benefit, so I suggest to remove it.

Quoted 2 lines
fs/btrfs/extent-tree.c +1 -0
+		goto out;
 	} else {
#2 lore raw

Hi Josef,
how about aborting the transaction also in place that you print:
"umm, got %d back from search, was looking for %llu" You abort in case ret<0, otherwise the code just proceeds with extent_slot = path->slots[0];
which can't be right in that case.

Thanks,
Alex.

Quoted 37 lines · David Sterba

fs/btrfs/extent-tree.c static int __btrfs_free_extent(struct btrfs_trans_handle *trans,

Quoted 15 lines · Josef Bacik

I'm not sure why we weren't aborting here in the first place, it is obviously a bad time from the fact that we print the leaf and yell loudly about it. Fix this up, otherwise we panic because our path could be pointing into oblivion. Thanks,

---
 fs/btrfs/extent-tree.c | 2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/extent-tree.c +0 -0
index 696f0b6..0015b02 100644
@@ -5744,6 +5744,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,

Adding context:

5748 } else if (WARN_ON(ret == -ENOENT)) {
5749 btrfs_print_leaf(extent_root, path->nodes[0]);
5750 btrfs_err(info,

fs/btrfs/extent-tree.c static int __btrfs_free_extent(struct btrfs_trans_handle *trans, · line 5747

Quoted 4 lines
fs/btrfs/extent-tree.c +1 -0
                      "unable to find ref byte nr %llu parent %llu root %llu  owner %llu offset %llu",
                      bytenr, parent, root_objectid, owner_objectid,
                      owner_offset);
+             btrfs_abort_transaction(trans, extent_root, ret);

Abort prints stacktrace on it's own and with the WARN_ON above it would be noisy and without any extra benefit, so I suggest to remove it.

fs/btrfs/extent-tree.c static int __btrfs_free_extent(struct btrfs_trans_handle *trans, · line 5749

Quoted 2 lines
fs/btrfs/extent-tree.c +1 -0
+             goto out;
      } else {

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