From patchwork Wed Mar 20 00:44:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10860615 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E65D1669 for ; Wed, 20 Mar 2019 00:44:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 514D029992 for ; Wed, 20 Mar 2019 00:44:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 456A62998C; Wed, 20 Mar 2019 00:44:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 013A6288AC for ; Wed, 20 Mar 2019 00:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727389AbfCTAo6 (ORCPT ); Tue, 19 Mar 2019 20:44:58 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:39800 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbfCTAo6 (ORCPT ); Tue, 19 Mar 2019 20:44:58 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2K0dFTc175206; Wed, 20 Mar 2019 00:44:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=oM2Ud+hRfV15fpiLyPsFegWW1yejKM12/LYm0CffAwk=; b=EiuATILPlAA1nb2EY/7+ndEq+OO5dusxB438iVrZeH6RrVGezVsEkePDik9IXytyvGza 2I+Ky8G1NLGTwbg2rAMoxAmNAWJBynqaXyex8dr4WA3leY/Ja9rH+KkR+gUBpHx5sfzQ Ke6GE1hZJT/7xap8RTa7iMP3brLzbZWgFdmzRXLEZBT2nNaNnmm/e/EOEfNNrVq/8FqM F/qctL1tvvBaokEB9iytmoEV4eZ1edrex/PgqOAyIVmCOfW/zo1Av2YLycgalQTEekZ9 KXY5xJUFT2Bw/ErDqKmPtL/tmtVBn4BMQkM7kNJKar3q7Gb0MlDFrOOHVqz3JFTpCWpv FQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2r8ssrfsd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Mar 2019 00:44:56 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x2K0itUb019585 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Mar 2019 00:44:55 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2K0itRK006514; Wed, 20 Mar 2019 00:44:55 GMT Received: from localhost (/10.159.245.168) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Mar 2019 17:44:55 -0700 Subject: [PATCH 03/12] generic/042: fix stale disk contents check From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 19 Mar 2019 17:44:55 -0700 Message-ID: <155304269533.31707.10962791945845709289.stgit@magnolia> In-Reply-To: <155304267647.31707.14180452399822113095.stgit@magnolia> References: <155304267647.31707.14180452399822113095.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9200 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903200003 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong This test doesn't call fsync or sync to force writeback of the first 60k of the file, which means that we could end up with a file full of zeroes or an empty file. Since this is a regression test that looks for stale disk contents slipping through, change the test to look for the stale bytes. Signed-off-by: Darrick J. Wong --- tests/generic/042 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/generic/042 b/tests/generic/042 index 1aa18f9b..6c62eb63 100755 --- a/tests/generic/042 +++ b/tests/generic/042 @@ -44,7 +44,7 @@ _crashtest() # Create an fs on a small, initialized image. The pattern is written to # the image to detect stale data exposure. - $XFS_IO_PROG -f -c "truncate 0" -c "pwrite 0 25M" $img \ + $XFS_IO_PROG -f -c "truncate 0" -c "pwrite -S 0xCD 0 25M" $img \ >> $seqres.full 2>&1 _mkfs_dev $img >> $seqres.full 2>&1 @@ -61,8 +61,12 @@ _crashtest() $UMOUNT_PROG $mnt _mount $img $mnt - # we generally expect a zero-sized file (this should be silent) - hexdump $file + # We should /never/ see 0xCD in the file, because we wrote that pattern + # to the filesystem image to expose stale data. + if hexdump -v -e '/1 "%02X "' $file | grep -q "CD"; then + echo "Saw stale data!!!" + hexdump $file + fi $UMOUNT_PROG $mnt }