From patchwork Thu Mar 31 12:54:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 12797068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A01B9C433EF for ; Thu, 31 Mar 2022 12:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236371AbiCaM4b (ORCPT ); Thu, 31 Mar 2022 08:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232332AbiCaM42 (ORCPT ); Thu, 31 Mar 2022 08:56:28 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3788170091; Thu, 31 Mar 2022 05:54:41 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id jx9so23946246pjb.5; Thu, 31 Mar 2022 05:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J8ueS+6eM6LzxmZNzgFTSM5N/JS9ols3wxxZjAjcXrY=; b=GXuICvc+jnGQmEnQIaCe7Z0h85RmrrE69OlQ2Ju+z6V7Qjmd8gNKH8se8DJY//otu/ 5EBatTDWRLe7CMuw1WsNHbhl2saj0blOrcubo/SEynKX5sbr5mDMTJjOF9bqfKl1kA6B BNttlKT2ybHgIhs6NIDNPicWp5ZD0EUFlydeBrYLZOj9ic93RWVm1VQttDXlRyjkgz9w fylan+mikAG2LchlVdCaOAM34n/SbsBMGbu7RuGuCweDcPOlVVz1XDmv1MlSYILe5Jmf B7inFMhEx0x/hLzIfrIsWDQvfzD/+P2UU6dsl0OpnYEXDdJGfQp7FiwXFT3AqXKYcmSa sw8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J8ueS+6eM6LzxmZNzgFTSM5N/JS9ols3wxxZjAjcXrY=; b=dFdNkTQcoKUgc9BdPDnkg4bq7xfe5Udok6TzRNzOjh9yUAzr2RghNP8u8vp+RFPlDZ FCdXxiIbpOM9j9lV8lPzQOxOAoWRW7mX6AECvJIjuth/qBqpAgelAPuT18n98P3zSs4C 7+tHyekiADZblUntTqVmiOFCI+TDn1RUhIHo/8n4F7fGTT6coWnqoYJprmHBmJwOVbXS IJ4Sq1jDzfnl4ZBea8cXi3/5EFgs/WOUnLIusY9n/yS8h9HYchirOLZZ5WIH7bvIakPE c9gs8MHMAttQFlJh3+eTOqIJW/yDPyZ00QuchSCzCocOdTuMOI3x35fTywaZgEaH2jA1 KwKg== X-Gm-Message-State: AOAM5318NdB32Y7gxUNptTuUhK9/sRcxdop5KGu7z9iICwMnowbjX5pF dgsMSKDdai8JG1mTFqZZXQAuPE4/owU= X-Google-Smtp-Source: ABdhPJx13uzzKnDWM6cNy3U/3LrcjPnOSeOBjZFtVGebXCttbZ5mKRU32TMnaZtQi5OO2A9DL8TnNw== X-Received: by 2002:a17:90a:ce:b0:1ca:308:977f with SMTP id v14-20020a17090a00ce00b001ca0308977fmr6069246pjd.195.1648731280964; Thu, 31 Mar 2022 05:54:40 -0700 (PDT) Received: from localhost ([2406:7400:63:7e03:b065:1995:217b:6619]) by smtp.gmail.com with ESMTPSA id j11-20020a63230b000000b00372a08b584asm22203758pgj.47.2022.03.31.05.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 05:54:40 -0700 (PDT) From: Ritesh Harjani To: fstests Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Darrick J . Wong" , Ritesh Harjani Subject: [PATCHv3 1/4] generic/468: Add another falloc test entry Date: Thu, 31 Mar 2022 18:24:20 +0530 Message-Id: <75f4c780e8402a8f993cb987e85a31e4895f13de.1648730443.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Ritesh Harjani Add another falloc test entry which could hit a kernel bug with ext4 fast_commit feature w/o below kernel commit [1]. [ 410.888496][ T2743] BUG: KASAN: use-after-free in ext4_mb_mark_bb+0x26a/0x6c0 [ 410.890432][ T2743] Read of size 8 at addr ffff888171886000 by task mount/2743 This happens when falloc -k size is huge which spans across more than 1 flex block group in ext4. This causes a bug in fast_commit replay code which is fixed by kernel commit at [1]. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?h=dev&id=bfdc502a4a4c058bf4cbb1df0c297761d528f54d Signed-off-by: Ritesh Harjani --- tests/generic/468 | 8 ++++++++ tests/generic/468.out | 2 ++ 2 files changed, 10 insertions(+) diff --git a/tests/generic/468 b/tests/generic/468 index 95752d3b..5e73cff9 100755 --- a/tests/generic/468 +++ b/tests/generic/468 @@ -34,6 +34,13 @@ _scratch_mkfs >/dev/null 2>&1 _require_metadata_journaling $SCRATCH_DEV _scratch_mount +# blocksize and fact are used in the last case of the fsync/fdatasync test. +# This is mainly trying to test recovery operation in case where the data +# blocks written, exceeds the default flex group size (32768*4096*16) in ext4. +blocks=32768 +blocksize=4096 +fact=18 + testfile=$SCRATCH_MNT/testfile # check inode metadata after shutdown @@ -85,6 +92,7 @@ for i in fsync fdatasync; do test_falloc $i "-k " 1024 test_falloc $i "-k " 4096 test_falloc $i "-k " 104857600 + test_falloc $i "-k " $(($blocks*$blocksize*$fact)) done status=0 diff --git a/tests/generic/468.out b/tests/generic/468.out index b3a28d5e..a09cedb8 100644 --- a/tests/generic/468.out +++ b/tests/generic/468.out @@ -5,9 +5,11 @@ QA output created by 468 ==== falloc -k 1024 test with fsync ==== ==== falloc -k 4096 test with fsync ==== ==== falloc -k 104857600 test with fsync ==== +==== falloc -k 2415919104 test with fsync ==== ==== falloc 1024 test with fdatasync ==== ==== falloc 4096 test with fdatasync ==== ==== falloc 104857600 test with fdatasync ==== ==== falloc -k 1024 test with fdatasync ==== ==== falloc -k 4096 test with fdatasync ==== ==== falloc -k 104857600 test with fdatasync ==== +==== falloc -k 2415919104 test with fdatasync ==== From patchwork Thu Mar 31 12:54:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 12797069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68239C433FE for ; Thu, 31 Mar 2022 12:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232332AbiCaM4l (ORCPT ); Thu, 31 Mar 2022 08:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236373AbiCaM4d (ORCPT ); Thu, 31 Mar 2022 08:56:33 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C35C717179C; Thu, 31 Mar 2022 05:54:46 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id c23so23348611plo.0; Thu, 31 Mar 2022 05:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wfpr7Xh+FqyWgrHb9mRhd4rKnQSyLplPFkeGhzZb9g0=; b=i/ngoARk9G29TRu+hD3k0dQHOk1wObrkCJsOm3kiIZUGiULzE0Fn4otgnZIf5EjPRt hzXWNN2BDpNYZA9c89KtvdIF1eV16n+J8SfuGEj/0JOpJxWt2uT2EhQusimH5cOgD/3K NHJuzEPtFOejFbPldk9Tl4hugh8qcUsHh6z1fIv3CFg6fVGHo+3lxH1EpV26BTkw+ztk k7+/9O/u9XkNZ0quJrRNSd9/lYr3xisC2CDcYDYxTLkjjH6T5Hr+lXIk55XCLZowm4Eb +VPEgm8dZOZ3aH5yp6P7qfUijB8uRiOfNVCuNvShz3Tes0P5tVrHTXQFD2yvBpSq3o6v rMaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wfpr7Xh+FqyWgrHb9mRhd4rKnQSyLplPFkeGhzZb9g0=; b=l8ISQ4GHsg5bnrXphkTxSa1MyQag3HV8WERZqwHpmTmEmpMDyKL675Xp8wEHgD1sZH RCxZtAF85D0Enz5f9iMZYx8fRP859nHEtyHldqqMsRiQmuQ010kcIcb5u0PW3o2n+OAM CPSL/65mFbdPq+gATcW8QkON4d6DL90W9Rlv3fsxbWjm1nJCCeM5zqp7qD0hJygVkGLQ yIj5yQK3KB2NR9qp0FsF58gIwQLfJlDZZaX/BVSTLv6r3166iohbsGxh1uOmT26vBvu/ Q62MR8qws9WOipF0iKWJm2vA3x325J/omqzwVAW7nGApX4Z9pllQAbG1pvY38dehh1VD SMkA== X-Gm-Message-State: AOAM533rO+Kh+Yjj0SfwpH8Ss59VvTuzxoWti0GzS3qv8NyiBHbyCmQ/ 2CUEhQl9qEBwIa+D9pOLVlwgCL3w4NY= X-Google-Smtp-Source: ABdhPJyIxh8bjfoXp9wP+YtcB3sGF8ILMbOkVTafMOPc1P4GJ8XxfJL2v9YtIFTFBwC2vUJjw7ytGQ== X-Received: by 2002:a17:902:b705:b0:154:a806:5325 with SMTP id d5-20020a170902b70500b00154a8065325mr40873453pls.30.1648731286249; Thu, 31 Mar 2022 05:54:46 -0700 (PDT) Received: from localhost ([2406:7400:63:7e03:b065:1995:217b:6619]) by smtp.gmail.com with ESMTPSA id y15-20020a17090a1f4f00b001c7ecaf9e13sm9977493pjy.35.2022.03.31.05.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 05:54:46 -0700 (PDT) From: Ritesh Harjani To: fstests Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Darrick J . Wong" , Ritesh Harjani Subject: [PATCHv3 2/4] common/punch: Add block_size argument to _filter_fiemap_** Date: Thu, 31 Mar 2022 18:24:21 +0530 Message-Id: <38648a1fb58b0ab554a21d11eef92f932a3bd7a9.1648730443.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Ritesh Harjani Add block_size paramter to _filter_fiemap_flags() and _filter_hole_fiemap(). This is used in next patches Also this fixes some of the end of line whitespace issues while we are at it. Signed-off-by: Ritesh Harjani --- common/punch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/punch b/common/punch index b6b8a0b9..706e7c11 100644 --- a/common/punch +++ b/common/punch @@ -109,6 +109,7 @@ _filter_fiemap() _filter_fiemap_flags() { + block_size=$1 $AWK_PROG ' $3 ~ /hole/ { print $1, $2, $3; @@ -135,19 +136,19 @@ _filter_fiemap_flags() } print $1, $2, flag_str }' | - _coalesce_extents + _coalesce_extents $block_size } -# Filters fiemap output to only print the +# Filters fiemap output to only print the # file offset column and whether or not # it is an extent or a hole _filter_hole_fiemap() { $AWK_PROG ' $3 ~ /hole/ { - print $1, $2, $3; + print $1, $2, $3; next; - } + } $5 ~ /0x[[:xdigit:]]+/ { print $1, $2, "extent"; }' | From patchwork Thu Mar 31 12:54:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 12797070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0DD5C4321E for ; Thu, 31 Mar 2022 12:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236388AbiCaM4m (ORCPT ); Thu, 31 Mar 2022 08:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236384AbiCaM4k (ORCPT ); Thu, 31 Mar 2022 08:56:40 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13D8175843; Thu, 31 Mar 2022 05:54:51 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id a16so6402658plh.13; Thu, 31 Mar 2022 05:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YdKrCzZxzKVcqcgPDrjDJsLO4bDaeI9ud7tYwYppoeA=; b=Q8/7bH4O2x6wGXrZIPRBtt8ePILsVBepVYI5Z42acUAIUhNUdPdlIu66AaN/8Hx9Ei wRAdeJGql4UyUhPaSL4iBT/4eJBHaIzUJHj/Siva9yfhy3QSyWlHSILHYaC/0WKPG4aM dLn57LpCk0wJoIbCiVoB9KJRxDJHUYAWsZQPdfxlsuoQ2hhOPFHQ/btl5DKPeDpGWemk JeIwbr1dqk8uogRQYwL7aHGCQeVa8wIr3X5e3oE+Z7PEov+1pOu8cdDZcYXx+7lfDYe2 P4fXu2EFcRyoq+Kz4md+7isQt3H5w08OLtAL+rNJu5ZAEym4800Xg0RMoktP3Dk4u2lu i52g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YdKrCzZxzKVcqcgPDrjDJsLO4bDaeI9ud7tYwYppoeA=; b=i8gmtbnj/Jd8vIgooa65fdgnnVLfIoAvRZjGa3kyCnzUTeObqJowVXltyyGLQOg4D9 0vVZiJIm6rcwchUtD/QNOzs0xtszRV+DDYu08SYw8OWXnhpO5C8HESsUkR+PBO4KlT6D XVYxKS8JsQtv1fndDczyafb2dmNq1ntf/a1J5XLY4GqYDok0SC8flMjIvYq4BVjZG/+Y LOEyAWb8cNiW6YD5UglaVNSq1+WWa2bIqGiOzkZ+nyOYZUrrc31GuVfS1CQPzg6dmFr7 Ab3N4Rp7BOh4nGn6bpxM3UHGJR/gpB3YZq2W+q4mt7upOj+TKChwNKRMPuospKdzFP3t myVw== X-Gm-Message-State: AOAM530z0kuUWaH+X05MTNMLc5+vpoAsNiRAdP4hiHF8UDVqhy+fVbe/ BqoNzBjUxJcuS9XIE+NsfGftmo/BApw= X-Google-Smtp-Source: ABdhPJy76UA88DJqcu7WyJMdmsX8fTxQgQTKcEC2DH9S1NBGbj3yquVKo8ujFSc76jvARwSQ+KFhuw== X-Received: by 2002:a17:902:e812:b0:154:19ec:538b with SMTP id u18-20020a170902e81200b0015419ec538bmr5169580plg.102.1648731291457; Thu, 31 Mar 2022 05:54:51 -0700 (PDT) Received: from localhost ([2406:7400:63:7e03:b065:1995:217b:6619]) by smtp.gmail.com with ESMTPSA id pj9-20020a17090b4f4900b001c744034e7csm10717436pjb.2.2022.03.31.05.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 05:54:51 -0700 (PDT) From: Ritesh Harjani To: fstests Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Darrick J . Wong" , Ritesh Harjani Subject: [PATCHv3 3/4] generic/678: Add a new shutdown recovery test Date: Thu, 31 Mar 2022 18:24:22 +0530 Message-Id: <2df6ee0680b5d2a6fad945e4936749f22abe72dd.1648730443.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Ritesh Harjani In certain cases (it is noted with ext4 fast_commit feature) that, replay phase may not delete the right range of blocks (after sudden FS shutdown) due to some operations which depends on inode->i_size (which during replay of an inode with fast_commit could be 0 for sometime). This fstest is added to test for such scenarios for all generic fs. This test case is based on the test case shared via Xin Yin. Signed-off-by: Ritesh Harjani --- tests/generic/678 | 72 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/678.out | 7 +++++ 2 files changed, 79 insertions(+) create mode 100755 tests/generic/678 create mode 100644 tests/generic/678.out diff --git a/tests/generic/678 b/tests/generic/678 new file mode 100755 index 00000000..46a7be6c --- /dev/null +++ b/tests/generic/678 @@ -0,0 +1,72 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 IBM Corporation. All Rights Reserved. +# +# FS QA Test 678 +# +# This test with ext4 fast_commit feature w/o below patch missed to delete the right +# range during replay phase, since it depends upon inode->i_size (which might not be +# stable during replay phase, at least for ext4). +# 0b5b5a62b945a141: ext4: use ext4_ext_remove_space() for fast commit replay delete range +# (Based on test case shared by Xin Yin ) +# + +. ./common/preamble +_begin_fstest auto shutdown quick log recoveryloop + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* +} + +# Import common functions. +. ./common/filter +. ./common/punch + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_require_scratch +_require_xfs_io_command "fpunch" +_require_xfs_io_command "fzero" +_require_xfs_io_command "fiemap" +_require_scratch_shutdown + +t1=$SCRATCH_MNT/foo +t2=$SCRATCH_MNT/bar + +_scratch_mkfs > $seqres.full 2>&1 + +_scratch_mount >> $seqres.full 2>&1 + +bs=$(_get_file_block_size $SCRATCH_MNT) + +# create and write data to t1 +$XFS_IO_PROG -f -c "pwrite 0 $((100*$bs))" $t1 | _filter_xfs_io_numbers + +# fzero certain range in between with -k +$XFS_IO_PROG -c "fzero -k $((40*$bs)) $((20*$bs))" $t1 + +# create and fsync a new file t2 +$XFS_IO_PROG -f -c "fsync" $t2 + +# fpunch within the i_size of a file +$XFS_IO_PROG -c "fpunch $((30*$bs)) $((20*$bs))" $t1 + +# fsync t1 to trigger journal operation +$XFS_IO_PROG -c "fsync" $t1 + +# shutdown FS now for replay journal to kick in next mount +_scratch_shutdown -v >> $seqres.full 2>&1 + +_scratch_cycle_mount + +# check fiemap reported is valid or not +$XFS_IO_PROG -c "fiemap -v" $t1 | _filter_fiemap_flags $bs + +# success, all done +status=0 +exit diff --git a/tests/generic/678.out b/tests/generic/678.out new file mode 100644 index 00000000..e0992edd --- /dev/null +++ b/tests/generic/678.out @@ -0,0 +1,7 @@ +QA output created by 678 +wrote XXXX/XXXX bytes at offset XXXX +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +0: [0..29]: none +1: [30..49]: hole +2: [50..59]: unwritten +3: [60..99]: nonelast From patchwork Thu Mar 31 12:54:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 12797071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F51C433FE for ; Thu, 31 Mar 2022 12:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236396AbiCaM4q (ORCPT ); Thu, 31 Mar 2022 08:56:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236384AbiCaM4o (ORCPT ); Thu, 31 Mar 2022 08:56:44 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D989177095; Thu, 31 Mar 2022 05:54:57 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id o68-20020a17090a0a4a00b001c686a48263so2927669pjo.1; Thu, 31 Mar 2022 05:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LHo/SdnNdRZSmP8pzyHHOdEbBJV/03V1Re1aAbJD2Gc=; b=SgklHYzOSi3fjID+QSeRHLtlahscqSRaADv5CBvzVTNSeyx8NW74mxGbBs8EN/3aBh 6HTBgn9q2gNp1X58O7/CupgNNwdjE7gRYRK1HE6lwgJiT8/HAkDqut3hF1RhSgvcn6/s gIIkbLz6eIaUzLno6+9bthQIWBOVAQprG4xg7Inyqj4MYHcA3s43js3/QiMkkMoBUzlf B7VMzjHurKBNqq+EONESmcgKiwRieJKz/mRhNvbsIR/sMGHENTtUXoa9lFTIsQTlAuCY 8m8VkzPwF8I+Hl8ZrFVlhiaYTCt6rEz3DIXMHceSCCKOECeu2lfgkYJtN6XxIf0fj1ZC ojrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LHo/SdnNdRZSmP8pzyHHOdEbBJV/03V1Re1aAbJD2Gc=; b=2x8Osp0rHXnVJNu3BrrNk1BD6FVnjd2fn6PjPY8pmFjvjPnHl/RWeXIvORaKHTLqfy rYrMmFIU3IT2+YYGL7LEuS5hx7FQvrwkHfLbiG6z8+BCHUqxzHIoloytFhqLA1gpG0Yq jpGvI+QfNXi4eTwBMLrVGfUMtKzL3Q7Mx3QQxxfD8/0vfbckfy0aUFL2+3WjhD/xzGsO Mj6zIWXwkT4Sr2oNWYRFKZyjfBEIF7g4h3ErK0Wm00IDNuJiJs4gIeSbBNto5aQ0cdl2 27ooRrCjZtZ4Yr72vIH5y7TtXjreAwKlQrBXz29meeHxF/pD6VZpjU4iEP5V5hILyLJ/ VDPA== X-Gm-Message-State: AOAM530qZO32mPu/NElRUWQ9sEyGOESZhGoeO5k4CourY94x//ZIwPRR RBCNPgIESCkGeCKkfW8AcYCw9EmgQPY= X-Google-Smtp-Source: ABdhPJy8fzYBBWX6X83T9W9WfaKZGq1VpsF5iaS+grrRT+GuiNeOUqC6Ud9fxIYWWbOfmHouDWwqWg== X-Received: by 2002:a17:902:e9d4:b0:153:bd06:859c with SMTP id 20-20020a170902e9d400b00153bd06859cmr4929160plk.8.1648731297010; Thu, 31 Mar 2022 05:54:57 -0700 (PDT) Received: from localhost ([2406:7400:63:7e03:b065:1995:217b:6619]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a150200b001c9f1a7aafesm6135370pja.29.2022.03.31.05.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 05:54:56 -0700 (PDT) From: Ritesh Harjani To: fstests Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Darrick J . Wong" , Ritesh Harjani Subject: [PATCHv3 4/4] generic/679: Add a test to check unwritten extents tracking Date: Thu, 31 Mar 2022 18:24:23 +0530 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Ritesh Harjani With these sequence of operation (in certain cases like with ext4 fast_commit) could miss to track unwritten extents during replay phase (after sudden FS shutdown). This fstest adds a test case to test this. 5e4d0eba1ccaf19f ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE Signed-off-by: Ritesh Harjani --- tests/generic/679 | 65 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/679.out | 6 ++++ 2 files changed, 71 insertions(+) create mode 100755 tests/generic/679 create mode 100644 tests/generic/679.out diff --git a/tests/generic/679 b/tests/generic/679 new file mode 100755 index 00000000..4f35a9cd --- /dev/null +++ b/tests/generic/679 @@ -0,0 +1,65 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 IBM Corporation. All Rights Reserved. +# +# FS QA Test 679 +# +# Test below sequence of operation which (w/o below kernel patch) in case of +# ext4 with fast_commit may misss to track unwritten extents. +# commit 5e4d0eba1ccaf19f +# ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE +# +. ./common/preamble +_begin_fstest auto quick log shutdown recoveryloop + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* +} + +# Import common functions. +. ./common/filter +. ./common/punch + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_require_scratch +_require_xfs_io_command "fzero" +_require_xfs_io_command "fiemap" +_require_scratch_shutdown + +t1=$SCRATCH_MNT/t1 + +_scratch_mkfs > $seqres.full 2>&1 + +_scratch_mount >> $seqres.full 2>&1 + +bs=$(_get_file_block_size $SCRATCH_MNT) + +# create and write data to t1 +$XFS_IO_PROG -f -c "pwrite 0 $((100*$bs))" $t1 | _filter_xfs_io_numbers + +# fsync t1 +$XFS_IO_PROG -c "fsync" $t1 + +# fzero certain range in between +$XFS_IO_PROG -c "fzero -k $((40*$bs)) $((20*$bs))" $t1 + +# fsync t1 +$XFS_IO_PROG -c "fsync" $t1 + +# shutdown FS now for replay of journal to kick during next mount +_scratch_shutdown -v >> $seqres.full 2>&1 + +_scratch_cycle_mount + +# check fiemap reported is valid or not +$XFS_IO_PROG -c "fiemap -v" $t1 | _filter_fiemap_flags $bs + +# success, all done +status=0 +exit diff --git a/tests/generic/679.out b/tests/generic/679.out new file mode 100644 index 00000000..4d3c3377 --- /dev/null +++ b/tests/generic/679.out @@ -0,0 +1,6 @@ +QA output created by 679 +wrote XXXX/XXXX bytes at offset XXXX +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +0: [0..39]: none +1: [40..59]: unwritten +2: [60..99]: nonelast