diff mbox

[1/2] btrfs-progs: fix mkfs.btrfs -r option

Message ID 510831DC.4070709@redhat.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Eric Sandeen Jan. 29, 2013, 8:32 p.m. UTC
Commit 605e806166847872bb91831b397d58f95027975a broke the
mkfs.btrfs -r option, because it calls make_btrfs
without ever setting dev_block_count, in the -r case,
so we tell it to make a filesystem of size 0.

Then we wander into ENOSPC land and segfault.

As a quick one-line-fix, just set the dev_block_count
to the size of the destination image file.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---


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

Patch

diff --git a/mkfs.c b/mkfs.c
index fbf8319..940702d 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1337,6 +1337,8 @@  int main(int ac, char **av)
 			fprintf(stderr, "unable to zero the output file\n");
 			exit(1);
 		}
+		/* our "device" is the new image file */
+		dev_block_count = block_count;
 	}
 	if (mixed) {
 		if (metadata_profile != data_profile) {