Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2803588rdb; Fri, 22 Sep 2023 08:47:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPZ9AR+i4WlNs/ZTw8L68o94+I0Dx7dvsa96TjrPIUnDXo7axXMrpMBLlhFR++5BDKDWjz X-Received: by 2002:a17:90a:3ccf:b0:277:298:deae with SMTP id k15-20020a17090a3ccf00b002770298deaemr98221pjd.11.1695397636523; Fri, 22 Sep 2023 08:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695397636; cv=none; d=google.com; s=arc-20160816; b=KnnhkGKNipcfeyymQo7Rpoof8qXP1YzXto8ecc+V2MZHLWO8lFAPU8sAbj00K2Mt8l FmThgM/VA41fY/Vn0A2zuwGvy9J5v9TCV5vQ43WQ2omBSb8mN2hmHc3lxz0CSA/3/kRo uegZ+Di6W27KLU9qvOGuFTxbNdC8UwVCU6bbYidfyMAOmXbEKfNhvsDtyEF8THQLkdgI e8cZ/lP7ZtYntNQDuG2kF+5MvRXqQX5tSzVjYdHUHNP3rBJbm4PeUVr4sYGdEDbCA9wP vi1c8eDFHET8mQhxCgzC9mT9UDBirILJAbOClqmN8DsVCplCjTa/R5fC2tg27q5KAFzo CFhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mPDulTQG32dEgsHx5Z26bnYKsvCd2L6FGqcW6KHfius=; fh=id8OH7gLebh9iZrCN3FcRb1x2gtZxvYJrC+jMRgut1Y=; b=luBUq5tidFRCjS6/qOjfUa/QXD3Khy2EPM81/doXFccj0aNOT+t37FyhVC4gOjsr/G zJlXpxOYXR0WvLkOSmpo4yDUlf3Kw2/ChkNh/biwgPOoCdN4qlS8n2a6GvuE3ozg4oru X6ffuNq93ANZ+v3fFtxO9be+IXxSiFhnm7X9r/Qyue9IiwxU4tfWohenvVubp46Kll/M 6LZeMhBBGDjkmZrh7P3MZCkiDussrivBeztDubu5es3NlJ02lAisa7Q5zWVxvxbrLl/P uTWxi9QDHvVUgF3uB1LuID8yuYXtPjTvJPO+6j1JMV3Qgq8P6RN7+mUmia24Cgk0BRoM s9xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IxDKV8AI; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id fw3-20020a17090b128300b002639acf55c7si6226348pjb.7.2023.09.22.08.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 08:47:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IxDKV8AI; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4B2F484A9741; Fri, 22 Sep 2023 05:10:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233187AbjIVMKv (ORCPT + 99 others); Fri, 22 Sep 2023 08:10:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231301AbjIVMKv (ORCPT ); Fri, 22 Sep 2023 08:10:51 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A9792; Fri, 22 Sep 2023 05:10:44 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-68bed2c786eso1848005b3a.0; Fri, 22 Sep 2023 05:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695384644; x=1695989444; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mPDulTQG32dEgsHx5Z26bnYKsvCd2L6FGqcW6KHfius=; b=IxDKV8AI2U15GgXSEo/bksHf69jRKL906eJOpx1+C7v9vBp79DJVDul2ZFjlCrIuyq +4QgWOxJeG8/R0NnbFUbnOHz4MBvkjUcIoPvVlz5A2ptLwJaWUqxaeh7nJChjpuSn3bd c2kNplqyvD9PenQeuLkAvd3aMaq0AiDwbToPCCwAt/Rh5rZkTqCIT6XOWhj4qMJMoD52 IfasnEOORKJjvW7PdLYIT/gv7chB4VVoyQpV/7g9OYE/0N3OOV7KKFqWZ/vxmflEC7wB pVpy9ko/kUDvqlKl06My/msd2rk9H0eK7dGJobtPJBxe2ViFVF8zHFaVZOqpEEa90m6g Qd6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695384644; x=1695989444; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mPDulTQG32dEgsHx5Z26bnYKsvCd2L6FGqcW6KHfius=; b=h9Rg6qaL4vZiNLfZ+C0qxr+TvtlQ48GIPQg4OrOAFuKZ6JpUx8EbcUYNWhFiQiHKv2 o6/V+LeUsqh6S0MP5afcDSMtjHWUK4qnRCXTTTOIo9e76ybEC27CLzq7HLAA/2FOhMYV GJtX2+P4iESBNG/ihyDIXU/n9GsJ5oF7ZxNYd8fzz6dXATvzQfIKlbWNcffRWd7+et/q +moOonfWt2UZ6eIORu7nuN1xMUWlh7k3+VqZjs2AuOrUE8Yl3xuIvUmhu3osvb5RIVwM yBYT+YgOgxcslVYWQxY8enWmNo4qa1ErIUWszzpbtXkjVCpz0/ph5wSWTCD/DfFW96EX 4fCg== X-Gm-Message-State: AOJu0YwHvJSSK2FYulX4jmdPUonai2TJjVtA3HzqZxpGpzuc+8OgHXZU Hmi0WDAx+rqRxL5aX087rzT4VckGGd8= X-Received: by 2002:a05:6a21:47ca:b0:157:b9e1:c82f with SMTP id as10-20020a056a2147ca00b00157b9e1c82fmr7412339pzc.35.1695384643788; Fri, 22 Sep 2023 05:10:43 -0700 (PDT) Received: from dw-tp.ihost.com ([49.207.223.191]) by smtp.gmail.com with ESMTPSA id d14-20020a17090ad98e00b00274803c4c90sm3127380pjv.40.2023.09.22.05.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 05:10:43 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, Jan Kara , Theodore Ts'o , "Ritesh Harjani (IBM)" , Gao Xiang Subject: [PATCH] generic: Add integrity tests with synchronous directio Date: Fri, 22 Sep 2023 17:40:36 +0530 Message-ID: <434beffaf18d39f898518ea9eb1cea4548e77c3a.1695383715.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <87y1gy5s9c.fsf@doe.com> References: <87y1gy5s9c.fsf@doe.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 22 Sep 2023 05:10:59 -0700 (PDT) This test covers data & metadata integrity check with directio with o_sync flag and checks the file contents & size after sudden fileystem shutdown once the directio write is completed. ext4 directio after iomap conversion was broken in the sense that if the FS crashes after synchronous directio write, it's file size is not properly updated. This test adds a testcase to cover such scenario. Man page of open says that - O_SYNC provides synchronized I/O file integrity completion, meaning write operations will flush data and all associated metadata to the underlying hardware Reported-by: Gao Xiang Signed-off-by: Ritesh Harjani (IBM) --- tests/generic/471 | 45 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/471.out | 8 ++++++++ 2 files changed, 53 insertions(+) create mode 100755 tests/generic/471 create mode 100644 tests/generic/471.out diff --git a/tests/generic/471 b/tests/generic/471 new file mode 100755 index 00000000..6c31cff8 --- /dev/null +++ b/tests/generic/471 @@ -0,0 +1,45 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 IBM Corporation. All Rights Reserved. +# +# FS QA Test 471 +# +# Integrity test with DIRECT_IO & O_SYNC with sudden shutdown +# +. ./common/preamble +_begin_fstest auto quick shutdown + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* +} + +# Import common functions. +. ./common/filter + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_require_scratch +_require_scratch_shutdown + +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount + +echo "Create a 1M file using O_DIRECT & O_SYNC" +xfs_io -fsd -c "pwrite -S 0x5a 0 1M" $SCRATCH_MNT/testfile > /dev/null 2>&1 + +echo "Shutdown the fs suddenly" +_scratch_shutdown + +echo "Cycle mount" +_scratch_cycle_mount + +echo "File contents after cycle mount" +_hexdump $SCRATCH_MNT/testfile + +status=0 +exit diff --git a/tests/generic/471.out b/tests/generic/471.out new file mode 100644 index 00000000..ae279b79 --- /dev/null +++ b/tests/generic/471.out @@ -0,0 +1,8 @@ +QA output created by 471 +Create a 1M file using O_DIRECT & O_SYNC +Shutdown the fs suddenly +Cycle mount +File contents after cycle mount +000000 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a >ZZZZZZZZZZZZZZZZ< +* +100000 -- 2.41.0