Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2142765rdb; Mon, 20 Nov 2023 03:20:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJaOptHk3vG3PL17Idttqh2GAf4gw3lxd4RlhDFBjJs/CjAlilD3Fr68LFApbfVRiysqXK X-Received: by 2002:a17:903:2385:b0:1cc:5cbf:50d2 with SMTP id v5-20020a170903238500b001cc5cbf50d2mr8849573plh.59.1700479204169; Mon, 20 Nov 2023 03:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700479204; cv=none; d=google.com; s=arc-20160816; b=uzETvpiN2DblXLMb2n53H9OPNk8iryKu87CxcDwDUE2Z8pvkONgVNAmDdLaiuDWx6X AGPWJNWbTQUMIQB++8HMDB/38dLRhuQrTaN7Hr3i4zb/u1u4RQ4P7JZ/Xsc9rNEhhp/t M8XNbyK4qhHudCR2n70J4Zbeq5+9RBI6BEg+cnKLqHyBm6oB/xElgsP2BqGmXodeDgNu 6jI+wrKBIfHv3OHlj7kpZuqURUa2QBZqqepX117L1EQOTylDGn9vYFSHioUbeGjqBUyV l2oxsnKF306RiqCv8pbq9W3FNmxuY3EY4FvDt75rq1K4q21g+YEAGaG85ArD7SE+nIR+ x1/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CdVx1mLPYgJ8PSK+Wh+08fLU/+3jz9bwfAobWV4CEv0=; fh=KCs4WDQQKMlA870dPYinDLCZwDJjI6KBF8m5ZjUE9Ss=; b=i6WROpHsxGxqXRad3vt3zuQ89ecyB7McAQC/w7F32A4i1TUXQmtK8DaVoQHYMJmcdy W28+WcHMeTk7HUfhWODQ+vMOsvtygbUN1KKkHD2peV67RaHCC2RZ39iC+oVI83kELsdQ lVYEQX+A/mML1uBSPs/dxvVSbn8sgc1yooA5YqW61XUEJowig3/V6gAZ+aktBaIGIV4t aN0oNoChzeYr0tKeP+7nEP8qudwBdlGy3X0VQR+bC3mG/v98jTRGhYKETukkUSRWSXRH JFNuarAW51LwnVp/pCnGh6twPBVZab2uhaBNZagrgbywuyCQbXTgjByviza19E5bNDLK DcHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aFlXQQ4z; spf=pass (google.com: domain of linux-ext4+bounces-39-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-39-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bd6-20020a170902830600b0019c354055d0si7645430plb.304.2023.11.20.03.20.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 03:20:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-39-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aFlXQQ4z; spf=pass (google.com: domain of linux-ext4+bounces-39-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-39-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4E3D2B219AA for ; Mon, 20 Nov 2023 11:19:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34A9514AA9; Mon, 20 Nov 2023 11:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aFlXQQ4z" X-Original-To: linux-ext4@vger.kernel.org Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1464D62; Mon, 20 Nov 2023 03:19:45 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6c4eb5fda3cso4387868b3a.2; Mon, 20 Nov 2023 03:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700479184; x=1701083984; 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=CdVx1mLPYgJ8PSK+Wh+08fLU/+3jz9bwfAobWV4CEv0=; b=aFlXQQ4zDFmPTxtTM9at2dxqlru5bUoo6SA1fGw+ICgRyoYEBnYlLY1vLj8pGSWEbV VpjDrKEVVZXIoshh2NIsfNflACa4qsUJ/BtUAIBexvEwJaCBj/YJ0F9TJMazSfYVzjK0 wpKvtxVblCsuOCS1hvAw804tzhQtvGYGkCUUcnTwOB0aMzENWNDaF2r9p1zBYycvIWtw 6ro41PjC55OUo6aawVn86oeNuPJjdFRONfdJn9UDOvsptRduCsZ5pUL2Catm2ln4V+mz biDT6ZOTqUBJJIw77Bq1eoa5ofpHM3y9I5xrygsSQbd9fEQsFeH1WwU8deYaOKIOb62i luCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700479184; x=1701083984; 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=CdVx1mLPYgJ8PSK+Wh+08fLU/+3jz9bwfAobWV4CEv0=; b=TmJHf54HFaRBJnD84F0cOgK0uHlSdSLfBXW3SQmLvOfFaiB2eiv24xuvaNLmsQBxwx xSxTGtm7e1nMX5Md6YK8RQHVVSm3OV4plb4+/if4lEQvcwAOQQAG/bEFjgT97dKLKZSZ Rhd7NSnG0zPQa/jYrgieA8/LkvajQZK5p8WSSyGkazGXVHkuBzyjX3jBA5glSxs9vK/8 KC9iud8tAQHuFvUqemAcNZHJ2BTx6e0x7e8WDh+8aDQc55XGOIKL/8I5OkOq6XYwCF6r HTVYSmCdPprSVdSdcS8+MX59z8pFE3V7EH4NBTD9EmWIUwgNNBV2PDzGrEWqIF3adJZZ l69g== X-Gm-Message-State: AOJu0YxelfyrK/E6Iw7thvZV2rcGH0N+k1CUFwX7WqviFsrGXG6sfgZb xTyY+ON0I9OS7sw0hw7QZXLZKeCBIm8= X-Received: by 2002:a05:6a00:8c5:b0:6be:4e6e:2a85 with SMTP id s5-20020a056a0008c500b006be4e6e2a85mr7898914pfu.30.1700479184601; Mon, 20 Nov 2023 03:19:44 -0800 (PST) Received: from dw-tp.c4p-in.ibmmobiledemo.com ([129.41.58.19]) by smtp.gmail.com with ESMTPSA id k10-20020aa788ca000000b006cb6ba5fe72sm3056158pff.122.2023.11.20.03.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 03:19:44 -0800 (PST) From: "Ritesh Harjani (IBM)" To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, Jan Kara , Gao Xiang , Ojaswin Mujoo , "Ritesh Harjani (IBM)" Subject: [PATCHv3 2/2] generic: Add integrity tests with synchronous directio Date: Mon, 20 Nov 2023 16:49:34 +0530 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <8379b5df9f70a1d75692e029a565199e98a535e8.1700478575.git.ritesh.list@gmail.com> References: <8379b5df9f70a1d75692e029a565199e98a535e8.1700478575.git.ritesh.list@gmail.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/733 | 54 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/733.out | 22 ++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100755 tests/generic/733 create mode 100644 tests/generic/733.out diff --git a/tests/generic/733 b/tests/generic/733 new file mode 100755 index 00000000..18021e8a --- /dev/null +++ b/tests/generic/733 @@ -0,0 +1,54 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 IBM Corporation. All Rights Reserved. +# +# FS QA Test 471 +# +# Integrity test for O_SYNC with buff-io, dio, aio-dio with sudden shutdown. +# Based on a testcase reported by Gao Xiang +# + +. ./common/preamble +_begin_fstest auto quick shutdown aio + +# real QA test starts here +_supported_fs generic +_require_scratch +_require_scratch_shutdown +_require_aiodio aio-dio-write-verify + +_fixed_by_kernel_commit 91562895f803 \ + "ext4: properly sync file size update after O_SYNC direct IO" + +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount + +echo "T-1: Create a 1M file using buff-io & O_SYNC" +$XFS_IO_PROG -fs -c "pwrite -S 0x5a 0 1M" $SCRATCH_MNT/testfile.t1 > /dev/null 2>&1 +echo "T-1: Shutdown the fs suddenly" +_scratch_shutdown +echo "T-1: Cycle mount" +_scratch_cycle_mount +echo "T-1: File contents after cycle mount" +_hexdump $SCRATCH_MNT/testfile.t1 + +echo "T-2: Create a 1M file using O_DIRECT & O_SYNC" +$XFS_IO_PROG -fsd -c "pwrite -S 0x5a 0 1M" $SCRATCH_MNT/testfile.t2 > /dev/null 2>&1 +echo "T-2: Shutdown the fs suddenly" +_scratch_shutdown +echo "T-2: Cycle mount" +_scratch_cycle_mount +echo "T-2: File contents after cycle mount" +_hexdump $SCRATCH_MNT/testfile.t2 + +echo "T-3: Create a 1M file using AIO-DIO & O_SYNC" +$AIO_TEST -a size=1048576 -S -N $SCRATCH_MNT/testfile.t3 > /dev/null 2>&1 +echo "T-3: Shutdown the fs suddenly" +_scratch_shutdown +echo "T-3: Cycle mount" +_scratch_cycle_mount +echo "T-3: File contents after cycle mount" +_hexdump $SCRATCH_MNT/testfile.t3 + +status=0 +exit diff --git a/tests/generic/733.out b/tests/generic/733.out new file mode 100644 index 00000000..e0536a4e --- /dev/null +++ b/tests/generic/733.out @@ -0,0 +1,22 @@ +QA output created by 733 +T-1: Create a 1M file using buff-io & O_SYNC +T-1: Shutdown the fs suddenly +T-1: Cycle mount +T-1: File contents after cycle mount +000000 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a >ZZZZZZZZZZZZZZZZ< +* +100000 +T-2: Create a 1M file using O_DIRECT & O_SYNC +T-2: Shutdown the fs suddenly +T-2: Cycle mount +T-2: File contents after cycle mount +000000 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a >ZZZZZZZZZZZZZZZZ< +* +100000 +T-3: Create a 1M file using AIO-DIO & O_SYNC +T-3: Shutdown the fs suddenly +T-3: Cycle mount +T-3: 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