]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
51b5bb3f6584869cd57640834bcf88c1afb64cf3
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
14 # Copyright 2018 Nutanix Inc. All rights reserved.
17 .
$STF_SUITE/tests
/functional
/casenorm
/casenorm.kshlib
20 # For the filesystem with casesensitivity=mixed, normalization=none,
21 # when multiple files with the same name (differing only in case) are created,
22 # the number of files is limited to what can fit in a fatzap leaf-block.
23 # And beyond that, it fails with ENOSPC.
25 # Ensure that the create/rename operations fail gracefully and not trigger an
29 # Repeat the below steps for objects: files, directories, symlinks and hardlinks
30 # 1. Create objects with same name but varying in case.
31 # E.g. 'abcdefghijklmnop', 'Abcdefghijklmnop', 'ABcdefghijklmnop' etc.
32 # The create should fail with ENOSPC.
33 # 2. Create an object with name 'tmp_obj' and try to rename it to name that we
34 # failed to add in step 1 above.
35 # This should fail as well.
37 verify_runnable
"global"
45 log_assert
"With mixed mode: ensure create fails with ENOSPC beyond a certain limit"
47 create_testfs
"-o casesensitivity=mixed -o normalization=none"
49 # Different object types
50 obj_type
=('file' 'dir' 'symlink' 'hardlink')
52 # Commands to create different object types
56 ops
['symlink']='ln -s'
59 # This function tests the following for a give object type :
60 # - Create multiple objects with the same name (varying only in case).
61 # Ensure that it eventually fails once the leaf-block limit is exceeded.
62 # - Create another object with a different name. And attempt rename it to the
63 # name (for which the create had failed in the previous step).
64 # This should fail as well.
66 # $1 - object type (file/dir/symlink/hardlink)
74 target_obj
='target-file'
76 op
="${ops[$obj_type]}"
78 log_note
"The op : $op"
79 log_note
"testdir=$testdir obj_type=$obj_type"
81 test_path
="$testdir/$obj_type"
83 log_note
"Created test dir $test_path"
85 if [[ $obj_type = "symlink" ||
$obj_type = "hardlink" ]]; then
86 touch $test_path/$target_obj
87 log_note
"Created target: $test_path/$target_obj"
88 op
="$op $test_path/$target_obj"
92 names
='{a,A}{b,B}{c,C}{d,D}{e,E}{f,F}{g,G}{h,H}{i,I}{j,J}{k,K}{l,L}'
93 for name
in $names; do
94 cmd
="$op $test_path/$name"
97 log_note
"cmd: $cmd ret: $ret out=$out"
98 if (($ret != 0)); then
99 if [[ $out = *@
(No space left on device
)* ]]; then
100 save_name
="$test_path/$name"
103 log_err
"$cmd failed with unexpected error : $out"
108 log_note
'Test rename \"sample_name\" rename'
109 TMP_OBJ
="$test_path/tmp_obj"
113 if (($ret != 0)); then
114 log_err
"cmd:$cmd failed out:$out"
117 # Now, try to rename the tmp_obj to the name which we failed to add earlier.
118 # This should fail as well.
119 out
=$
(mv $TMP_OBJ $save_name 2>&1)
121 if (($ret != 0)); then
122 if [[ $out = *@
(No space left on device
)* ]]; then
123 log_note
"$cmd failed as expected : $out"
125 log_err
"$cmd failed with : $out"
130 for obj_type
in ${obj_type[*]};
132 log_note
"Testing create of $obj_type"
133 test_ops
$obj_type $TESTDIR
136 log_pass
"Mixed mode FS: Ops on large number of colliding names fail gracefully"