generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 337
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FSQA Test No. 337
6 #
7 # Test that the filesystem's implementation of the listxattrs system call lists
8 # all the xattrs an inode has.
9 #
10 . ./common/preamble
11 _begin_fstest auto quick attr metadata
12
13 # Import common functions.
14 . ./common/filter
15 . ./common/attr
16
17 # real QA test starts here
18 _supported_fs generic
19 _require_scratch
20 _require_attrs
21
22 _scratch_mkfs >>$seqres.full 2>&1
23 _scratch_mount
24
25 # Create our test file with a few xattrs. The first 3 xattrs have a name that
26 # when given as input to a crc32c function result in the same checksum. This
27 # made btrfs list only one of the xattrs through listxattrs system call (because
28 # it packs xattrs with the same name checksum into the same btree item).
29 touch $SCRATCH_MNT/testfile
30 $SETFATTR_PROG -n user.foobar -v 123 $SCRATCH_MNT/testfile
31 $SETFATTR_PROG -n user.WvG1c1Td -v qwerty $SCRATCH_MNT/testfile
32 $SETFATTR_PROG -n user.J3__T_Km3dVsW_ -v hello $SCRATCH_MNT/testfile
33 $SETFATTR_PROG -n user.something -v pizza $SCRATCH_MNT/testfile
34 $SETFATTR_PROG -n user.ping -v pong $SCRATCH_MNT/testfile
35
36 # Now call getfattr with --dump, which calls the listxattrs system call.
37 # It should list all the xattrs we have set before.
38 _getfattr --absolute-names --dump $SCRATCH_MNT/testfile | _filter_scratch
39
40 status=0
41 exit