1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-30 01:20:40 +00:00
nixpkgs/pkgs/tools/filesystems/btrfsprogs/subvol-listing.patch
Mathijs Kwik 3d0b5b7a8f btrfs-progs: small patch to fix listing subvolumes on kernel 3.6+
The btrfs cleaner, introduced in 3.6 leaves some unresolvable entries,
which the userspace utils don't know how to handle.
2013-01-01 13:50:14 +01:00

35 lines
683 B
Diff

--- a/btrfs-list.c 2012-12-30 12:20:01.394137593 +0100
+++ b/btrfs-list.c 2012-12-30 12:22:47.242452906 +0100
@@ -1004,6 +1004,23 @@
return 0;
}
+static void __drop_deleting_roots(struct root_lookup *root_lookup)
+{
+ struct rb_node *n;
+
+again:
+ n = rb_first(&root_lookup->root);
+ while (n) {
+ struct root_info *entry = rb_entry(n, struct root_info, rb_node);
+ if (!entry->ref_tree) {
+ rb_erase(n, &root_lookup->root);
+ free(entry);
+ goto again;
+ }
+ n = rb_next(n);
+ }
+}
+
static int __list_subvol_search(int fd, struct root_lookup *root_lookup)
{
int ret;
@@ -1123,6 +1140,8 @@
break;
}
+ __drop_deleting_roots(root_lookup);
+
return 0;
}