From patchwork Wed Mar 23 04:18:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 8647071 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4E117C0553 for ; Wed, 23 Mar 2016 04:18:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CDBD2037C for ; Wed, 23 Mar 2016 04:18:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7151020268 for ; Wed, 23 Mar 2016 04:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750761AbcCWESs (ORCPT ); Wed, 23 Mar 2016 00:18:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51835 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbcCWESr (ORCPT ); Wed, 23 Mar 2016 00:18:47 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 36692C0467F2 for ; Wed, 23 Mar 2016 04:18:47 +0000 (UTC) Received: from localhost (ovpn-12-18.pek2.redhat.com [10.72.12.18]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2N4Iigq014560; Wed, 23 Mar 2016 00:18:45 -0400 From: Eryu Guan To: fstests@vger.kernel.org Cc: Eryu Guan Subject: [PATCH v3] generic: test I/O on dm error device Date: Wed, 23 Mar 2016 12:18:34 +0800 Message-Id: <1458706714-4282-1-git-send-email-eguan@redhat.com> In-Reply-To: <1457710822-30532-2-git-send-email-eguan@redhat.com> References: <1457710822-30532-2-git-send-email-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is a test that performs simple I/O on dm error device, which returns EIO on all I/O request. This is motivated by an ext4 bug that crashes kernel on error path when trying to update atime. Following kernel patch should fix the issue ext4: fix NULL pointer dereference in ext4_mark_inode_dirty() Signed-off-by: Eryu Guan --- v3: - mkfs on SCRATCH_DEV by calling _scratch_mkfs, instead of _mkfs_dev on DMERROR_DEV, which fails on XFS without "-f" option v2: - use SCRATCH_DEV directly instead of loop device and call blockdev --flushbufs $SCRATCH_DEV before drop caches (suggested by Dave) tests/generic/338 | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/338.out | 2 ++ tests/generic/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/generic/338 create mode 100644 tests/generic/338.out diff --git a/tests/generic/338 b/tests/generic/338 new file mode 100755 index 0000000..818cc15 --- /dev/null +++ b/tests/generic/338 @@ -0,0 +1,80 @@ +#! /bin/bash +# FS QA Test 338 +# +# Test I/O on dm error device. +# +# Motivated by an ext4 bug that crashes kernel on error path when trying to +# update atime. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 Red Hat Inc., All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* + _dmerror_cleanup +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/dmerror + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_dm_target error +# If SCRATCH_DEV is not a valid block device, FSTYP cannot be mkfs'ed either +_require_block_device $SCRATCH_DEV + +echo "Silence is golden" + +_scratch_mkfs >>$seqres.full 2>&1 +_dmerror_init + +# Use strictatime mount option here to force atime updates, which could help +# trigger the NULL pointer dereference on ext4 more easily +_dmerror_mount "-o strictatime" +_dmerror_load_error_table + +# flush dmerror block device buffers and drop all caches, force reading from +# error device +blockdev --flushbufs $DMERROR_DEV +echo 3 > /proc/sys/vm/drop_caches + +# do some test I/O +ls -l $SCRATCH_MNT >>$seqres.full 2>&1 +$XFS_IO_PROG -fc "pwrite 0 1M" $SCRATCH_MNT/testfile >>$seqres.full 2>&1 + +# no panic no hang, success, all done +status=0 +exit diff --git a/tests/generic/338.out b/tests/generic/338.out new file mode 100644 index 0000000..3482cf4 --- /dev/null +++ b/tests/generic/338.out @@ -0,0 +1,2 @@ +QA output created by 338 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index 727648c..8818827 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -340,3 +340,4 @@ 335 auto quick metadata 336 auto quick metadata 337 auto quick metadata +338 auto quick rw