From 3d0b5b7a8fe8887a90a84d18b3cdd0b451190596 Mon Sep 17 00:00:00 2001 From: Mathijs Kwik Date: Sun, 30 Dec 2012 12:14:20 +0100 Subject: [PATCH] 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. --- pkgs/tools/filesystems/btrfsprogs/default.nix | 2 ++ .../btrfsprogs/subvol-listing.patch | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/tools/filesystems/btrfsprogs/subvol-listing.patch diff --git a/pkgs/tools/filesystems/btrfsprogs/default.nix b/pkgs/tools/filesystems/btrfsprogs/default.nix index 4c1963f46332..c8a39a1672a0 100644 --- a/pkgs/tools/filesystems/btrfsprogs/default.nix +++ b/pkgs/tools/filesystems/btrfsprogs/default.nix @@ -11,6 +11,8 @@ stdenv.mkDerivation { sha256 = "72d4cd4fb23d876a17146d6231ad40a2151fa47c648485c54cf7478239b43764"; }; + patches = [ ./subvol-listing.patch ]; + buildInputs = [ zlib libuuid acl attr e2fsprogs ]; makeFlags = "prefix=$(out)"; diff --git a/pkgs/tools/filesystems/btrfsprogs/subvol-listing.patch b/pkgs/tools/filesystems/btrfsprogs/subvol-listing.patch new file mode 100644 index 000000000000..1c113ddefbe3 --- /dev/null +++ b/pkgs/tools/filesystems/btrfsprogs/subvol-listing.patch @@ -0,0 +1,34 @@ +--- 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; + }