All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common/fuzzy: try to clear immutable flag first in _scratch_fuzz_modify
@ 2020-06-11 16:14 Gao Xiang
  2020-06-12  1:40 ` [PATCH v2] common/fuzzy: try to clear blocking flags " Gao Xiang
  0 siblings, 1 reply; 2+ messages in thread
From: Gao Xiang @ 2020-06-11 16:14 UTC (permalink / raw)
  To: fstests; +Cc: Gao Xiang

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 the 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>
---
 common/fuzzy | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/fuzzy b/common/fuzzy
index 988203b1..3e4f750b 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -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 immutable (and even dax) flag if exists
+		$XFS_IO_PROG -rc 'chattr -x -i' "$f" > /dev/null 2>&1
 		setfattr -n "user.date" -v "${date}" "$f"
 		cat "/tmp/afile" >> "$f"
 		mv "$f" "$f.longer"
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v2] common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
  2020-06-11 16:14 [PATCH] common/fuzzy: try to clear immutable flag first in _scratch_fuzz_modify Gao Xiang
@ 2020-06-12  1:40 ` Gao Xiang
  0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2020-06-12  1:40 UTC (permalink / raw)
  To: fstests; +Cc: Gao Xiang

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>
---
changes since v1:
 - also clear append-only flag (I think that's better than just
   skip since maybe some potential errors exist on these files.)

 common/fuzzy | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/fuzzy b/common/fuzzy
index 988203b1..bd08af1c 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -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"
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-12  1:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 16:14 [PATCH] common/fuzzy: try to clear immutable flag first in _scratch_fuzz_modify Gao Xiang
2020-06-12  1:40 ` [PATCH v2] common/fuzzy: try to clear blocking flags " Gao Xiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.