common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify

When stressing xfs/083, I found it sometimes fails as the following:

+++ touch 50000 files
setfattr: /home/fsgqa/scratchmnt/INOBT/20627: Operation not permitted
./common/fuzzy: line 18: /home/fsgqa/scratchmnt/INOBT/20627: Operation not permitted
mv: cannot move '/home/fsgqa/scratchmnt/INOBT/20627' to '/home/fsgqa/scratchmnt/INOBT/20627.longer': Operation not permitted
...
xfs_repair did not fix everything

It's simply that INOBT/20627 was an immutable file generated from
fuzzing. Therefore, this patch tries to clear append, immutable flag
first before modification. Note that it clears dax flag as well
since it prevents immutable flag from clearing.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Gao Xiang
2020-06-12 09:40:18 +08:00
committed by Eryu Guan
parent 59877e5071
commit 57eba17be8
+2
View File
@@ -14,6 +14,8 @@ _scratch_fuzz_modify() {
$XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
date="$(date)"
find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
# try to remove append, immutable (and even dax) flag if exists
$XFS_IO_PROG -rc 'chattr -x -i -a' "$f" > /dev/null 2>&1
setfattr -n "user.date" -v "${date}" "$f"
cat "/tmp/afile" >> "$f"
mv "$f" "$f.longer"