Skip to contentSkip to conversation

generic/247: filter out expected XFS warnings for mixed mmap/direct I/O

PATCH In review Brian Foster 2 participants 3 messages Jun 28, 2017 – Jun 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/247: filter out expected XFS warnings for mixed mmap/direct I/O

generic/247 reproduces some of the same, expected warnings from XFS as generic/095. These warnings occur due to mixed buffered/mapped I/O racing with direct I/O to the same file.

generic/095 contains a custom dmesg filter to prevent test failure in the event of such warnings. Lift the helper from generic/095 to common/xfs and reuse it in generic/247 to implement the same behavior.

---
 common/xfs        | 18 ++++++++++++++++++
 tests/generic/095 | 20 +++-----------------
 tests/generic/247 | 11 +++++++++--
 3 files changed, 30 insertions(+), 19 deletions(-)
common/xfs +18 -0
index 0f0825b..0266f50 100644
@@ -584,3 +584,21 @@ _require_xfs_mkfs_ciname()
 	_scratch_mkfs_xfs_supported -n version=ci >/dev/null 2>&1 \
 		|| _notrun "need case-insensitive naming support in mkfs.xfs"
 }
+
+# xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
+# direct IO on the same file. This is a helper for _check_dmesg() to filter out
+# such warnings.
+filter_xfs_dmesg()
+{
+	local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
+	local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
+	local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
+	local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
+	local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
+	sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
+	    -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
+	    -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
+	    -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
+	    -e "s#$warn5#Intentional warnings in iomap_dio_rw#"
+}
+
tests/generic/095 +3 -17
index d837564..9580aaf 100755
@@ -117,28 +117,14 @@ _scratch_mount
 echo "Silence is golden"
 $FIO_PROG $fio_config >>$seqres.full 2>&1
 
+# umount before checking dmesg in case umount triggers any WARNING or Oops
+_scratch_unmount
+
 # xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
 # direct IO on the same file. On the other hand, this fio job has been proven
 # to be potent, we don't want to simply _disable_dmesg_check which could miss
 # other potential bugs. So filter out the intentional WARNINGs, make sure test
 # doesn't fail because of this warning and fails on other WARNINGs.
-filter_xfs_dmesg()
-{
-	local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
-	local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
-	local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
-	local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
-	local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
-	sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
-	    -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
-	    -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
-	    -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
-	    -e "s#$warn5#Intentional warnings in iomap_dio_rw#"
-}
-
-# umount before checking dmesg in case umount triggers any WARNING or Oops
-_scratch_unmount
-
 if [ "$FSTYP" == "xfs" ]; then
 	_check_dmesg filter_xfs_dmesg
 else
tests/generic/247 +9 -2
index 832ade1..f46ab30 100755
@@ -80,6 +80,13 @@ wait
 
 echo "Silence is golden."
 
-# success, all done
-status=0
+# unmount and check dmesg, filtering out expected XFS warnings about mixed
+# mmap/dio
+_scratch_unmount
+if [ "$FSTYP" == "xfs" ]; then
+	_check_dmesg filter_xfs_dmesg
+else
+	_check_dmesg
+fi
+status=$?
 exit
Signature · 1 line
2.9.4
#1 lore raw
Quoted 10 lines · Brian Foster

generic/247 reproduces some of the same, expected warnings from XFS as generic/095. These warnings occur due to mixed buffered/mapped I/O racing with direct I/O to the same file.

generic/095 contains a custom dmesg filter to prevent test failure in the event of such warnings. Lift the helper from generic/095 to common/xfs and reuse it in generic/247 to implement the same behavior.

Thanks a lot for doing this! It was in my todo list but I never got to it..

Some minor issues below, that I can fix them all at commit time.

Quoted 11 lines
---
 common/xfs        | 18 ++++++++++++++++++
 tests/generic/095 | 20 +++-----------------
 tests/generic/247 | 11 +++++++++--
 3 files changed, 30 insertions(+), 19 deletions(-)
common/xfs +0 -0
index 0f0825b..0266f50 100644

common/xfs _require_xfs_mkfs_ciname() · line 591

Quoted 8 lines
common/xfs +5 -0
@@ -584,3 +584,21 @@ _require_xfs_mkfs_ciname()
 	_scratch_mkfs_xfs_supported -n version=ci >/dev/null 2>&1 \
 		|| _notrun "need case-insensitive naming support in mkfs.xfs"
 }
+
+# xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
+# direct IO on the same file. This is a helper for _check_dmesg() to filter out
+# such warnings.
+filter_xfs_dmesg()

I've renamed it, added a leading underscore _filter_xfs_dmesg, it's common helper now.

Quoted 54 lines
common/xfs +13 -0
+{
+	local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
+	local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
+	local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
+	local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
+	local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
+	sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
+	    -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
+	    -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
+	    -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
+	    -e "s#$warn5#Intentional warnings in iomap_dio_rw#"
+}
+
tests/generic/095 +3 -17
index d837564..9580aaf 100755
@@ -117,28 +117,14 @@ _scratch_mount
 echo "Silence is golden"
 $FIO_PROG $fio_config >>$seqres.full 2>&1
 
+# umount before checking dmesg in case umount triggers any WARNING or Oops
+_scratch_unmount
+
 # xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
 # direct IO on the same file. On the other hand, this fio job has been proven
 # to be potent, we don't want to simply _disable_dmesg_check which could miss
 # other potential bugs. So filter out the intentional WARNINGs, make sure test
 # doesn't fail because of this warning and fails on other WARNINGs.
-filter_xfs_dmesg()
-{
-	local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
-	local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
-	local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
-	local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
-	local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
-	sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
-	    -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
-	    -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
-	    -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
-	    -e "s#$warn5#Intentional warnings in iomap_dio_rw#"
-}
-
-# umount before checking dmesg in case umount triggers any WARNING or Oops
-_scratch_unmount
-
 if [ "$FSTYP" == "xfs" ]; then
 	_check_dmesg filter_xfs_dmesg
 else
tests/generic/247 +0 -0
index 832ade1..f46ab30 100755

tests/generic/247 wait · line 85

Quoted 8 lines
tests/generic/247 +3 -2
@@ -80,6 +80,13 @@ wait
 
 echo "Silence is golden."
 
-# success, all done
-status=0
+# unmount and check dmesg, filtering out expected XFS warnings about mixed
+# mmap/dio
+_scratch_unmount

generic/247 doesn't take use of SCRATCH_DEV, _scratch_unmount and the associated comment can be removed.

Thanks,
Eryu

Quoted 14 lines
tests/generic/247 +6 -0
+if [ "$FSTYP" == "xfs" ]; then
+	_check_dmesg filter_xfs_dmesg
+else
+	_check_dmesg
+fi
+status=$?
 exit
Signature · 6 lines
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 10 lines · Eryu Guan
Quoted 9 lines · Brian Foster

generic/247 reproduces some of the same, expected warnings from XFS as generic/095. These warnings occur due to mixed buffered/mapped I/O racing with direct I/O to the same file.

generic/095 contains a custom dmesg filter to prevent test failure in the event of such warnings. Lift the helper from generic/095 to common/xfs and reuse it in generic/247 to implement the same behavior.

Quoted 7 lines
Quoted 1 line

Thanks a lot for doing this! It was in my todo list but I never got to it..

Some minor issues below, that I can fix them all at commit time.

Ok.. the fixes look fine to me.. thanks!

Brian

Quoted 110 lines
Quoted 11 lines
---
 common/xfs        | 18 ++++++++++++++++++
 tests/generic/095 | 20 +++-----------------
 tests/generic/247 | 11 +++++++++--
 3 files changed, 30 insertions(+), 19 deletions(-)
common/xfs +0 -0
index 0f0825b..0266f50 100644

common/xfs _require_xfs_mkfs_ciname() · line 591

Quoted 8 lines
common/xfs +5 -0
@@ -584,3 +584,21 @@ _require_xfs_mkfs_ciname()
 	_scratch_mkfs_xfs_supported -n version=ci >/dev/null 2>&1 \
 		|| _notrun "need case-insensitive naming support in mkfs.xfs"
 }
+
+# xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
+# direct IO on the same file. This is a helper for _check_dmesg() to filter out
+# such warnings.
+filter_xfs_dmesg()

I've renamed it, added a leading underscore _filter_xfs_dmesg, it's common helper now.

Quoted 54 lines
common/xfs +13 -0
+{
+	local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
+	local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
+	local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
+	local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
+	local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
+	sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
+	    -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
+	    -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
+	    -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
+	    -e "s#$warn5#Intentional warnings in iomap_dio_rw#"
+}
+
tests/generic/095 +3 -17
index d837564..9580aaf 100755
@@ -117,28 +117,14 @@ _scratch_mount
 echo "Silence is golden"
 $FIO_PROG $fio_config >>$seqres.full 2>&1
 
+# umount before checking dmesg in case umount triggers any WARNING or Oops
+_scratch_unmount
+
 # xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
 # direct IO on the same file. On the other hand, this fio job has been proven
 # to be potent, we don't want to simply _disable_dmesg_check which could miss
 # other potential bugs. So filter out the intentional WARNINGs, make sure test
 # doesn't fail because of this warning and fails on other WARNINGs.
-filter_xfs_dmesg()
-{
-	local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
-	local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
-	local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
-	local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
-	local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
-	sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
-	    -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
-	    -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
-	    -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
-	    -e "s#$warn5#Intentional warnings in iomap_dio_rw#"
-}
-
-# umount before checking dmesg in case umount triggers any WARNING or Oops
-_scratch_unmount
-
 if [ "$FSTYP" == "xfs" ]; then
 	_check_dmesg filter_xfs_dmesg
 else
tests/generic/247 +0 -0
index 832ade1..f46ab30 100755

tests/generic/247 wait · line 85

Quoted 8 lines
tests/generic/247 +3 -2
@@ -80,6 +80,13 @@ wait
 
 echo "Silence is golden."
 
-# success, all done
-status=0
+# unmount and check dmesg, filtering out expected XFS warnings about mixed
+# mmap/dio
+_scratch_unmount

generic/247 doesn't take use of SCRATCH_DEV, _scratch_unmount and the associated comment can be removed.

Thanks,
Eryu

Quoted 14 lines
tests/generic/247 +6 -0
+if [ "$FSTYP" == "xfs" ]; then
+	_check_dmesg filter_xfs_dmesg
+else
+	_check_dmesg
+fi
+status=$?
 exit
Signature · 6 lines
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html