sbin/hammer: Don't downgrade when failed to destroy pfs
- hammer pfs-destroy command downgrades (and change some other params)
ondisk pfs data before it attempts to destroy the pfs. This leads to
unexpected result if it fails to destroy because that pfs is left
with downgraded info. This commit restores the original ondisk pfs
data on failure in order to keep status (this does generate a new
ondisk pfs record too).
==========
example1 - using existing /sbin/hammer
# mount | grep TEST
TEST on /HAMMER (hammer, local)
# pwd
/HAMMER
# mkdir -p ./mnt
# hammer pfs-master ./test1 | grep "operating as"
operating as a MASTER
# mount_null ./test1 ./mnt
# mount | grep mnt
/HAMMER/@@-1:00001 on /HAMMER/mnt (null, local)
# hammer pfs-destroy ./test1
You have requested that PFS#1 () be destroyed
<snip>
Destroying PFS #1 () in 5 4 3 2 1.. starting destruction pass
pfs-destroy of PFS#1 failed: Directory not empty
# hammer pfs-status ./test1 | grep "operating as"
operating as a SLAVE
==========
example2 - using this commit
# mount | grep TEST
TEST on /HAMMER (hammer, local)
# pwd
/HAMMER
# mkdir -p ./mnt
# hammer pfs-master ./test1 | grep "operating as"
operating as a MASTER
# mount_null ./test1 ./mnt
# mount | grep mnt
/HAMMER/@@-1:00001 on /HAMMER/mnt (null, local)
# hammer pfs-destroy ./test1
You have requested that PFS#1 () be destroyed
<snip>
Destroying PFS #1 () in 5 4 3 2 1.. starting destruction pass
pfs-destroy of PFS#1 failed: Directory not empty
# hammer pfs-status ./test1 | grep "operating as"
operating as a MASTER