]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Update zfs_destroy_004.ksh script
authorcao <cao.xuewen@zte.com.cn>
Tue, 23 Aug 2016 02:12:41 +0000 (10:12 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 30 Aug 2016 22:35:54 +0000 (15:35 -0700)
Issues:
Under Linux, when executing zfs_destroy_004.ksh destroy $fs is an
error.  The key issue here is that illumos kernel treats this case
differently than the Linux kernel. On illumos you can unmount and
destroy a filesystem which is busy and all consumers of it get EIO.
On Linux the expected behavior is to prevent the unmount and destroy.

Cause analysis:
When create $fs file system and mount file system to $mntp.
cd $mntp, linux isn't allow to destroy $fs in this mount contents.
No matter what destroy with parameters.

Solution:
So  log_mustnot $ZFS destroy $fs is ok.
cd $olddir and destroy $fs.

Signed-off-by: caoxuewen cao.xuewen@zte.com.cn
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5012

tests/runfiles/linux.run
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh

index a4a2686a1d7f53b1bfb9251e5057a874fb75c5fe..5685ea21ba780d217d44c70534a4ed326b74bd22 100644 (file)
@@ -96,7 +96,6 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos',
 
 # DISABLED:
 # zfs_destroy_001_pos - busy mountpoint behavior
-# zfs_destroy_004_pos - busy mountpoint behavior
 # zfs_destroy_005_neg - busy mountpoint behavior
 # zfs_destroy_008_pos - busy mountpoint behavior
 # zfs_destroy_009_pos - busy mountpoint behavior
@@ -105,9 +104,9 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos',
 # zfs_destroy_012_pos - busy mountpoint behavior
 # zfs_destroy_013_neg - busy mountpoint behavior
 [tests/functional/cli_root/zfs_destroy]
-tests = ['zfs_destroy_002_pos', 'zfs_destroy_003_pos', 'zfs_destroy_006_neg',
-    'zfs_destroy_007_neg', 'zfs_destroy_014_pos', 'zfs_destroy_015_pos',
-    'zfs_destroy_016_pos']
+tests = ['zfs_destroy_002_pos', 'zfs_destroy_003_pos', 'zfs_destroy_004_pos',
+    'zfs_destroy_006_neg', 'zfs_destroy_007_neg', 'zfs_destroy_014_pos',
+    'zfs_destroy_015_pos', 'zfs_destroy_016_pos']
 
 # DISABLED:
 # zfs_get_004_pos - nested pools
index 6919bdf4274fe178be77a0bf062b36d0da72dcce..317e37869073ccd92a82cce0dda449be71d393e9 100755 (executable)
@@ -110,9 +110,15 @@ for arg in "$fs1 $mntp1" "$clone $mntp2"; do
        cd $mntp
        log_mustnot $ZFS destroy $fs
 
-       log_must $ZFS destroy -f $fs
-       datasetexists $fs && \
-               log_fail "'zfs destroy -f' fails to destroy busy filesystem."
+       if is_linux; then
+               log_mustnot $ZFS destroy -f $fs
+               datasetnonexists $fs && \
+                   log_fail "'zfs destroy -f' destroyed busy filesystem."
+       else
+               log_must $ZFS destroy -f $fs
+               datasetexists $fs && \
+                   log_fail "'zfs destroy -f' fail to destroy busy filesystem."
+       fi
 
        cd $olddir
 done