From patchwork Tue Jan 29 16:17:12 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: 10786567 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 DE4DB1390 for ; Tue, 29 Jan 2019 16:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB6142D2DB for ; Tue, 29 Jan 2019 16:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE4A22D320; Tue, 29 Jan 2019 16:17:18 +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=ham 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 6EFC82D2DB for ; Tue, 29 Jan 2019 16:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725828AbfA2QRR (ORCPT ); Tue, 29 Jan 2019 11:17:17 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:46306 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbfA2QRR (ORCPT ); Tue, 29 Jan 2019 11:17:17 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0TGDoZj187388; Tue, 29 Jan 2019 16:17:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=q4wtq6bnZ0/dOJE+nx/tGhbK4eTsqNaMWjTGjWU6QAA=; b=LNMoScuUE0foG4gurOWQSQ4FRsSEv4j4fvStOj29onJk96eREj61uJDsyeib7DEkKrgh mo7dvMEyjn64rzN1U/ItaevtAQqRKlAHPAuCGfFNQ96Sba/OcvNLE5LFkEKMdy3EcucU YPXKL2B+EzSLSukKocU7WeC0/ZQ6VzvttdvqLlrYwXvxtC+qCg5oXTq40K4kDGm5PklG qPSy/HqybulXy9Qgq/LimMqOrLg4eBgYhAPW1MffYYpN0aJZOKhW9E3RZ5bd9xjF/+z9 EBlHr+KUUJ0bk8gUtbkV/x8InXt/gyHg5n/2gNsv0lAVZx757CJEmUUoNWiKg6EAfAoL +g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2q8d2e5m7d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:15 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0TGHEIw023679 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:14 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0TGHEhg026401; Tue, 29 Jan 2019 16:17:14 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Jan 2019 08:17:13 -0800 Subject: [PATCH 1/4] xfs/093: make sure the scratch directory still exists after repair From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 29 Jan 2019 08:17:12 -0800 Message-ID: <154877863279.9277.4463697450629081138.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9150 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=994 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901290122 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Make sure that we still have the scratch directory after repairing our corrupted filesystem, because repair could have nuked it. Signed-off-by: Darrick J. Wong --- tests/xfs/093 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/093 b/tests/xfs/093 index 2b16020c..2dfad39d 100755 --- a/tests/xfs/093 +++ b/tests/xfs/093 @@ -97,6 +97,7 @@ $CHATTR_PROG -R -f -i "${SCRATCH_MNT}/" echo "+ modify files (2)" broken=0 +mkdir -p "${TESTDIR}" for x in `seq 65 70`; do touch "${TESTFILE}.${x}" || broken=1 done From patchwork Tue Jan 29 16:17:19 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: 10786571 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 C0EEC1390 for ; Tue, 29 Jan 2019 16:17:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF7D42D2DB for ; Tue, 29 Jan 2019 16:17:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A10AF2D320; Tue, 29 Jan 2019 16:17:29 +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=ham 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 43E9E2D2DB for ; Tue, 29 Jan 2019 16:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727839AbfA2QR3 (ORCPT ); Tue, 29 Jan 2019 11:17:29 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:52612 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbfA2QR2 (ORCPT ); Tue, 29 Jan 2019 11:17:28 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0TGDtHg046998; Tue, 29 Jan 2019 16:17:26 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=F40tSpqFiyY5/UA2xZDQgfW3/ZGpyOUrEttYNphSCWY=; b=i43r1vCLjDfKNETbcHYwZmMUuRvDbF2fwks8q69twiTgrmogC+0Ir9ijTCnBcy2+p0N4 RQYYTrXPHl5HjiQqaGx7EC5+b5nzpzpPg8A97/78pY8cbnTXucUUGAH3L7UW3eja34ku hPOSbR3CpADCO0p/l0MoMhB8UY6wVissLjsD93ACwidCQjhRq603wDtmjMwnjKXVEXbV UFdHO02G4KNiATpR77v/Q5iStYwcjFBn8tvK4JELK9/PtFCRWQQ5S4GX+f6ran5DDyQD jgpPABWAQnef7tbbgJvJCWwZU4Ng8ZGJxPpSD5RsZpAyk16/6pSwontA5DSSC0OAsOyD qw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2q8eyuddw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:26 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0TGHK21024040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:20 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0TGHKpH009734; Tue, 29 Jan 2019 16:17:20 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Jan 2019 08:17:20 -0800 Subject: [PATCH 2/4] xfs/138: format the scratch device before using it From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 29 Jan 2019 08:17:19 -0800 Message-ID: <154877863906.9277.11927709578869134810.stgit@magnolia> In-Reply-To: <154877863279.9277.4463697450629081138.stgit@magnolia> References: <154877863279.9277.4463697450629081138.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9150 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=907 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901290122 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Format the scratch device before using it, or else xfs_db will fail, particularly if the previous test left a corrupt fs behind. Signed-off-by: Darrick J. Wong --- tests/xfs/138 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/138 b/tests/xfs/138 index 36490e6a..41988530 100755 --- a/tests/xfs/138 +++ b/tests/xfs/138 @@ -38,6 +38,7 @@ echo This is file B ENDL echo "Test with -c" +_scratch_mkfs > $seqres.full 2>&1 _scratch_xfs_db -c "sb 0" -c "p magicnum" -c "source $tmp.a" -c "p magicnum" | sed -e 's/0x58465342/XFS_MAGIC/g' echo "Test with interactive" From patchwork Tue Jan 29 16:17:25 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: 10786575 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 0C3D71390 for ; Tue, 29 Jan 2019 16:17:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EED712D08D for ; Tue, 29 Jan 2019 16:17:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2E2C2D320; Tue, 29 Jan 2019 16:17:30 +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=ham 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 7CE7F2D2DB for ; Tue, 29 Jan 2019 16:17:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726913AbfA2QRa (ORCPT ); Tue, 29 Jan 2019 11:17:30 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:43620 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727032AbfA2QRa (ORCPT ); Tue, 29 Jan 2019 11:17:30 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0TGEVY7010256; Tue, 29 Jan 2019 16:17:27 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=dMC6y4reyBxcrzWE1x9mixh6QKz0rL+KfJ7/qqHXoZk=; b=2rX1kyFnS03N6CvChG74a7nDJGxad+bAQt6g4ONERWALjhBUfw/2ZOxw2ES2EBt33WV+ /kDOdH0mCV8Bjh1LUnufa4CstLjasvUI3yqt5NDXgQA1ExzeEQVc+gnIRGJagPm4NW4i KlORF1zbCy+XteHar3gyoqkFLWe0kfFWWeDqEvTq7RrHQKjNSf0JfsT9bXMimUvwlGXk itSMLrixHV3+/2zTxKBXRTgnkUBGLv6A2CTGHdsc+Jz87sXwHP9ZqsyB2gg9D/NXpBFK idn3rH6NPRJbJe6aCqsNEno9JINjqQAgi8clLr5fIOka79jwDIOiNmht0V8IuMbgIFV8 Ag== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2q8g6r5bag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:27 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x0TGHRUl021874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:27 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0TGHQLo009829; Tue, 29 Jan 2019 16:17:26 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Jan 2019 08:17:26 -0800 Subject: [PATCH 3/4] common: fix kmemleak to work with sections From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 29 Jan 2019 08:17:25 -0800 Message-ID: <154877864538.9277.6249607598508212314.stgit@magnolia> In-Reply-To: <154877863279.9277.4463697450629081138.stgit@magnolia> References: <154877863279.9277.4463697450629081138.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9150 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=682 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901290122 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Refactor the kmemleak code to work correctly with sections. This requires changing the report location to use RESULT_DIR instead of RESULT_BASE, and clarifying which functions get used when. Signed-off-by: Darrick J. Wong --- check | 4 ++-- common/rc | 32 ++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/check b/check index c0eee0aa..b9eb86cb 100755 --- a/check +++ b/check @@ -509,7 +509,7 @@ _expunge_test() return 0 } -_init_kmemleak +_detect_kmemleak _prepare_test_list if $OPTIONS_HAVE_SECTIONS; then @@ -793,8 +793,8 @@ for section in $HOST_OPTIONS_SECTIONS; do # and log messages that shouldn't be there. _check_filesystems _check_dmesg || err=true - _check_kmemleak || err=true fi + _check_kmemleak || err=true # test ends after all checks are done. $timestamp && _timestamp diff --git a/common/rc b/common/rc index 19e947df..75771f31 100644 --- a/common/rc +++ b/common/rc @@ -3514,7 +3514,7 @@ _check_dmesg() # capture the kmemleak report _capture_kmemleak() { - local kern_knob="${DEBUGFS_MNT}/kmemleak" + local kern_knob="$DEBUGFS_MNT/kmemleak" local leak_file="$1" # Tell the kernel to scan for memory leaks. Apparently the write @@ -3535,17 +3535,20 @@ ENDL echo "clear" > "$kern_knob" } -# set up kmemleak -_init_kmemleak() +# Figure out if the running kernel supports kmemleak; if it does, clear out +# anything that leaked before we even started testing. The leak checker only +# needs to be primed like this once per ./check invocation. +_detect_kmemleak() { - local kern_knob="${DEBUGFS_MNT}/kmemleak" + local kern_knob="$DEBUGFS_MNT/kmemleak" + KMEMLEAK_CHECK_FILE="/tmp/check_kmemleak" # Since kernel v4.19-rc3, the kmemleak knob exists even if kmemleak is # disabled, but returns EBUSY on write. So instead of relying on # existance of writable knob file, we use a test file to indicate that # _check_kmemleak() is enabled only if we actually managed to write to # the knob file. - rm -f ${RESULT_BASE}/check_kmemleak + rm -f "$KMEMLEAK_CHECK_FILE" if [ ! -w "$kern_knob" ]; then return 0 @@ -3555,17 +3558,26 @@ _init_kmemleak() # then dump all the leaks recorded so far. if echo "scan=off" > "$kern_knob" 2>/dev/null; then _capture_kmemleak /dev/null - touch ${RESULT_BASE}/check_kmemleak + touch "$KMEMLEAK_CHECK_FILE" fi } -# check kmemleak log +# Kick the kmemleak checker to scan for leaks. Background leak scan mode is +# not enabled, so we must call the kernel to ask for a scan and deal with the +# results appropriately. This we do after every test completes, whether or not +# it was successful. _check_kmemleak() { - local kern_knob="${DEBUGFS_MNT}/kmemleak" - local leak_file="${seqres}.kmemleak" + local kern_knob="$DEBUGFS_MNT/kmemleak" + local leak_file="$seqres.kmemleak" - if [ ! -f ${RESULT_BASE}/check_kmemleak ]; then + if [ ! -f "$KMEMLEAK_CHECK_FILE" ]; then + return 0 + fi + + # Not enabled, so discard any report of leaks found. + if [ "$USE_KMEMLEAK" != "yes" ]; then + _capture_kmemleak /dev/null return 0 fi From patchwork Tue Jan 29 16:17:31 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: 10786579 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 5A6A21390 for ; Tue, 29 Jan 2019 16:17:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 427A52D336 for ; Tue, 29 Jan 2019 16:17:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33EF92D4A2; Tue, 29 Jan 2019 16:17:38 +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=ham 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 C23872D336 for ; Tue, 29 Jan 2019 16:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbfA2QRh (ORCPT ); Tue, 29 Jan 2019 11:17:37 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:46778 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfA2QRh (ORCPT ); Tue, 29 Jan 2019 11:17:37 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0TGDoFJ187396; Tue, 29 Jan 2019 16:17:34 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=EEjjJ0p/g0TG6v4YhSlOWpV2IRvNlLd2dWwb/V6Z39o=; b=2bXt6gVpqKk7O3LedngD6GzFPAEyXNOmJaDJ1VO8vpdOZzOKRfJUTystvNY+HBem2UZ0 IXvI2T6sM5gmI6UUckjx3rWJ25bN9ZtpGRBRZHzcxmQb32rX/9mfCuN46vKLYgM0Xl6G F1J7qJUczvFsBO7K8jhPaORGuAD0t7j6c17EIPoGcyKzXkOwxPEhbAofxomRD/vrZreL +WfD3oWCVDZh+PwebFYowoXSCwbufUwISqjg6qa1Mgp7VYksdTOtJQ6iZDeah2lQBvH8 JR6WExV2UUi9NfuaK9dhqiVuFO21Cg2ifcLF5wMjQeKOpuKbfEWHwHsw6VK2MQTlJIz0 ww== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2q8d2e5m9w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:34 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x0TGHXUJ022270 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jan 2019 16:17:33 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0TGHXDK017372; Tue, 29 Jan 2019 16:17:33 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Jan 2019 08:17:33 -0800 Subject: [PATCH 4/4] generic: check for reasonable inode creation time From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 29 Jan 2019 08:17:31 -0800 Message-ID: <154877865178.9277.5385935769005684086.stgit@magnolia> In-Reply-To: <154877863279.9277.4463697450629081138.stgit@magnolia> References: <154877863279.9277.4463697450629081138.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9150 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901290122 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong If statx returns inode creation time (aka btime), check it to make sure that the filesystem is setting a creation time that's reasonably close to when it creates a file. Signed-off-by: Darrick J. Wong --- tests/generic/709 | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/709.out | 2 ++ tests/generic/group | 1 + 3 files changed, 64 insertions(+) create mode 100755 tests/generic/709 create mode 100644 tests/generic/709.out diff --git a/tests/generic/709 b/tests/generic/709 new file mode 100755 index 00000000..724a16a8 --- /dev/null +++ b/tests/generic/709 @@ -0,0 +1,61 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2019 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 709 +# +# Check that statx btime (aka creation time) is plausibly close to when +# we created a file. A bug caught during code review of xfs patches revealed +# that there weren't any sanity checks of the btime values. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" +tmp=/tmp/$$ +status=1 # failure is the default! +testfile=$TEST_DIR/$seq.txt +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* $testfile +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/attr +. ./common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_xfs_io_command "statx" "-r" + +rm -f $seqres.full +rm -f $testfile + +# Create a file and the time we created it +now=$(date +%s) +touch $testfile + +# Does statx return results with the BTIME flag set in the result mask? +STATX_BTIME=0x800 +$XFS_IO_PROG -c "statx -F -r -m $STATX_BTIME" $testfile > $tmp.statx +cat $tmp.statx >> $seqres.full + +result_mask=$(grep 'stat.mask =' $tmp.statx | cut -d ' ' -f 3) +test -n "$result_mask" || _notrun "did not see stat.mask in output" + +test "$(( result_mask & STATX_BTIME ))" -ne 0 || \ + _notrun "statx did not return btime" + +# Make sure the reported btime is within 5 seconds of the time we recorded +# just prior to creating the file. +btime=$(grep 'stat.btime.tv_sec =' $tmp.statx | cut -d ' ' -f 3) +test -n "$btime" || echo "error: did not see btime in output??" + +_within_tolerance "btime" "$btime" "$now" 0 5 -v + +status=0 +exit diff --git a/tests/generic/709.out b/tests/generic/709.out new file mode 100644 index 00000000..d8495ace --- /dev/null +++ b/tests/generic/709.out @@ -0,0 +1,2 @@ +QA output created by 709 +btime is in range diff --git a/tests/generic/group b/tests/generic/group index 6f5f28d8..9ce608c0 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -527,3 +527,4 @@ 522 soak long_rw 523 auto quick attr 524 auto quick +709 auto quick