sys/vfs/hammer: Add sanity check to volume-del
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 16 Dec 2015 14:07:43 +0000 (23:07 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 23 Dec 2015 07:33:57 +0000 (16:33 +0900)
sys/vfs/hammer/hammer_volume.c

index 3131cf4..51fcd5e 100644 (file)
@@ -168,6 +168,11 @@ hammer_ioc_volume_del(hammer_transaction_t trans, hammer_inode_t ip,
                return (EINVAL);
        }
 
+       if (hmp->nvolumes <= 1) {
+               hmkprintf(hmp, "No HAMMER volume to delete\n");
+               return (EINVAL);
+       }
+
        if (hammer_lock_ex_try(&hmp->volume_lock) != 0) {
                hmkprintf(hmp, "Another volume operation is in progress!\n");
                return (EAGAIN);