sbin/hammer: Check existence of PFS#0 when creating PFS
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 13 Dec 2015 15:35:28 +0000 (00:35 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 14 Dec 2015 12:02:47 +0000 (21:02 +0900)
hammer_cmd_pseudofs_create() checks from PFS#0 to PFS#0xffff
to find available PFS#, but PFS#0 must always exist.

sbin/hammer/cmd_pfs.c

index 5bc884b..0090161 100644 (file)
@@ -310,7 +310,12 @@ hammer_cmd_pseudofs_create(char **av, int ac, int is_slave)
        if (pfs_id == HAMMER_MAX_PFS) {
                fprintf(stderr, "Cannot create %s, all PFSs in use\n", path);
                exit(1);
+       } else if (pfs_id == HAMMER_ROOT_PFSID) {
+               fprintf(stderr, "Fatal error: PFS#%d must exist\n",
+                       HAMMER_ROOT_PFSID);
+               exit(1);
        }
+
        if (error != ENOENT) {
                fprintf(stderr, "Cannot create %s, got %s during scan\n",
                        path, strerror(error));