generic: Verify the inheritance behavior of FS_XFLAG_DAX flag in various combinations
[xfstests-dev.git] / tests / generic / 492
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 492
6 #
7 # Test the online filesystem label set/get ioctls
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # remove previous $seqres.full before test
29 rm -f $seqres.full
30
31 # real QA test starts here
32
33 _supported_fs generic
34 _supported_os Linux
35 _require_scratch
36 _require_xfs_io_command "label"
37 _require_label_get_max
38
39 _scratch_mkfs > $seqres.full 2>&1
40 _scratch_mount
41
42 # Make sure we can set & clear the label
43 $XFS_IO_PROG -c "label -s label.$seq" $SCRATCH_MNT
44 $XFS_IO_PROG -c "label" $SCRATCH_MNT
45
46 $XFS_IO_PROG -c "label -c" $SCRATCH_MNT
47 $XFS_IO_PROG -c "label" $SCRATCH_MNT
48
49 # And that userspace can see it now, while mounted
50 # NB: some blkid has trailing whitespace, filter it out here
51 $XFS_IO_PROG -c "label -s label.$seq" $SCRATCH_MNT
52 $XFS_IO_PROG -c "label" $SCRATCH_MNT
53 blkid -s LABEL $SCRATCH_DEV | _filter_scratch | sed -e "s/ $//g"
54
55 # And that the it is still there when it's unmounted
56 _scratch_unmount
57 blkid -s LABEL $SCRATCH_DEV | _filter_scratch | sed -e "s/ $//g"
58
59 # And that it persists after a remount
60 _scratch_mount
61 $XFS_IO_PROG -c "label" $SCRATCH_MNT
62
63 # And that a too-long label is rejected, beyond the interface max:
64 fs_label=$(perl -e "print 'l' x 257;")
65 $XFS_IO_PROG -c "label -s $fs_label" $SCRATCH_MNT
66
67 # And it succeeds right at the filesystem max:
68 max_label_len=$(_label_get_max)
69 fs_label=$(perl -e "print 'o' x $max_label_len;")
70 $XFS_IO_PROG -c "label -s $fs_label" $SCRATCH_MNT | sed -e 's/o\+/MAXLABEL/'
71
72 # And that it fails past the filesystem max:
73 let toolong_label_len=max_label_len+1
74 fs_label=$(perl -e "print 'o' x $toolong_label_len;")
75 $XFS_IO_PROG -c "label -s $fs_label " $SCRATCH_MNT
76
77 # success, all done
78 status=0
79 exit