git: sbin/hammer: Avoid pfs via pfs on creation, not on status|destroy|upgrade|downgrade|update

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


commit 04a0b05ced614569686b573a192625f3c16205f7
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Tue Mar 31 04:03:26 2015 +0900

    sbin/hammer: Avoid pfs via pfs on creation, not on status|destroy|upgrade|downgrade|update
    
    - According to the getpfs() implementation, hammer command wants to
      avoid users create pfs via pfs (avoid-foot-shooting). However, it
      needs to be done when creating the pfs.
    
    - Currently getpfs() is called by all pfs related commands except for
      creation (pfs-master, pfs-slave). This makes it possible for users
      to create pfs via pfs, but unable to status|destroy|upgrade|downgrade
      |update the once created pfs via pfs. In order to avoid this it should
      avoid pfs via pfs on pfs creation instead of in getpfs(). This also
      ensures other pfs related commands that handle pfs are protected from
      pfs via pfs.
    
    - This commit also allows users to destroy once created pfs via pfs
      (by existing /sbin/hammer) as following examples show.
    
      ==========
      example1 - using existing /sbin/hammer
    
      # mount | grep TEST
      TEST on /HAMMER (hammer, local)
      # pwd
      /HAMMER
      # hammer pfs-master test1 > /dev/null
      # mkdir ./mnt1
      # mount_null ./test1 ./mnt1
      # cd ./mnt1
      # hammer pfs-master test2
      Creating PFS #2 succeeded!
      You are attempting to access a PFS softlink from a PFS.  It may not represent the PFS
      on the main filesystem mount that you expect!  You may only access PFS softlinks
      via the main filesystem mount!
    
      created pfs via pfs, but can't destroy (or any other command) it
    
      # hammer pfs-destroy ./test2
      You are attempting to access a PFS softlink from a PFS.  It may not represent the PFS
      on the main filesystem mount that you expect!  You may only access PFS softlinks
      via the main filesystem mount!
    
      ==========
      example2 - using this commit to properly destroy above test2
    
      # hammer pfs-destroy ./test2
      You have requested that PFS#2 () be destroyed
      This will irrevocably destroy all data on this PFS!!!!!
      Do you really want to do this? y
      This PFS is currently setup as a MASTER!
      Are you absolutely sure you want to destroy it? y
      Destroying PFS #2 () in  5 4 3 2 1.. starting destruction pass
      pfs-destroy of PFS#2 succeeded!
    
      pfs via pfs should be avoided on creation, but not after that.
    
      # hammer pfs-master test2
      You are attempting to access a PFS softlink from a PFS.  It may not represent the PFS
      on the main filesystem mount that you expect!  You may only access PFS softlinks
      via the main filesystem mount!

Summary of changes:
 sbin/hammer/cmd_pseudofs.c | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/04a0b05ced614569686b573a192625f3c16205f7


-- 
DragonFly BSD source repository



More information about the Commits mailing list