git: sbin/hammer: Don't downgrade when failed to destroy pfs

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Wed Apr 1 14:32:37 PDT 2015


commit 750beaefb3ab1644d082583be24cab28388ced0f
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Wed Apr 1 21:41:31 2015 +0900

    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

Summary of changes:
 sbin/hammer/cmd_pseudofs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/750beaefb3ab1644d082583be24cab28388ced0f


-- 
DragonFly BSD source repository


More information about the Commits mailing list