From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC4141D8DFB for ; Mon, 2 Dec 2024 11:43:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733139793; cv=none; b=I8Vb6jlfABG3y6smxXQUzu1r7BTfVygsMSIr4V857/KDc6pX+h4j2Z4zqRtkzn1yO1/vUzTDrlKM54mmPaZCJ50dyb8qGWamsGPkWvVMsjCCqFJhNYHpLns3tdRXZuc09S/bEi/inTIsuStKSY3M/4CiE7Jd3vcAzzB9R71o4hk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733139793; c=relaxed/simple; bh=hspy3GOF2R29pUWjr+WGkU33VslKmEFqfIpp0rB2bWA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=jEjiT9SbKdw8fEeIMmacNiNELAwMxoOgrDHvf7R2U9ulm9n1vYM2vycRu2xmiziXwyWu5YOrtox7FvGkcWiCjUPwP+eoaLwKoNkT5M8OITJO6H+DFCGFGPCAOTfK2pq/EHD6VDKCAWZ1SwgiftplMDeWxRjR9gcZn/dOViDVy2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dlt8EKPp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dlt8EKPp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BA02C4CED1; Mon, 2 Dec 2024 11:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733139793; bh=hspy3GOF2R29pUWjr+WGkU33VslKmEFqfIpp0rB2bWA=; h=From:To:Cc:Subject:Date:From; b=Dlt8EKPpR+AKXdYBnibD+j0F1C4Nk4DlCk0YLWLoQ8f2EEsaAMmYOKLGBA/j2xfuz fo710RYwY9Ey+0VVh1UqDGpJrvyqROGGRhxPK8YtmFI0CiNKyf1dmj+d8OQjxQQVxo QQ0P8vHURLlETtK4DrTa01xqrXW+wj0At8jI0Fa/XFOIG70+/WfepWN4wQ+YoLux0T 9cM+jdMFJfLaCGEASnz/J5+atGUDA3SPy8DHpmfShUDosi6DceW6OgokZmFUZA2mXu SIrbRo6HCGjafpSerRBJy3uOJrVOOREreSWaaQx9s1oLKUprMs2NlYHeeZEYZziqB8 bu1xFUlXtFFUQ== From: Chao Yu To: Zorro Lang , fstests@vger.kernel.org Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, Chao Yu Subject: [PATCH] f2fs/008: test snapshot creation/deletion on lvm device Date: Mon, 2 Dec 2024 19:43:07 +0800 Message-Id: <20241202114307.2747-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch introduce a regression testcase to check whether f2fs can handle discard correctly once underlying lvm device changes to not support discard after user creates snapshot on it. Related bug was fixed by commit bc8aeb04fd80 ("f2fs: fix to drop all discards after creating snapshot on lvm device") Cc: Jaegeuk Kim Signed-off-by: Chao Yu --- tests/f2fs/008 | 53 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/008.out | 2 ++ 2 files changed, 55 insertions(+) create mode 100755 tests/f2fs/008 create mode 100644 tests/f2fs/008.out diff --git a/tests/f2fs/008 b/tests/f2fs/008 new file mode 100755 index 00000000..a9a3f263 --- /dev/null +++ b/tests/f2fs/008 @@ -0,0 +1,53 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oppo. All Rights Reserved. +# +# FS QA Test No. f2fs/008 +# +# This is a regression test to check whether f2fs can handle +# discard correctly once underlying lvm device changes to not +# support discard after user creates snapshot on it. +# + +. ./common/preamble +_begin_fstest auto quick rw + +_fixed_by_kernel_commit bc8aeb04fd80 \ + "f2fs: fix to drop all discards after creating snapshot on lvm device" + +_require_scratch_nolvm +_require_block_device $SCRATCH_DEV +_require_command "$LVM_PROG" lvm + +lvname=lv_$sed +vgname=vg_$Sseg +testfile=$SCRATCH_MNT/testfile + +_cleanup() +{ + $LVM_PROG lvremove -f /dev/mapper/$lvname-snapshot $vgname >>$seqres.full 2>&1 + $LVM_PROG lvremove -f /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 + $LVM_PROG vgremove -f $vgname >>$seqres.full 2>&1 + $LVM_PROG pvremove -f $SCRATCH_DEV >>$seqres.full 2>&1 +} + +$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1 +$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1 +$LVM_PROG lvcreate -L 1024m -n $lvname $vgname >>$seqres.full 2>&1 + +$MKFS_F2FS_PROG /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 +mount -o discard /dev/mapper/$vgname-$lvname $SCRATCH_MNT >>$seqres.full 2>&1 + +dd if=/dev/zero of=$testfile bs=1M count=20 >>$seqres.full 2>&1 +sync +rm $testfile +sync + +# create a snapshot on lvm device +$LVM_PROG lvcreate -L 1024m -s -n $lvname-snapshot /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 +umount $SCRATCH_MNT + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/f2fs/008.out b/tests/f2fs/008.out new file mode 100644 index 00000000..dd68d5a4 --- /dev/null +++ b/tests/f2fs/008.out @@ -0,0 +1,2 @@ +QA output created by 008 +Silence is golden -- 2.40.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A6C4D7830E for ; Mon, 2 Dec 2024 11:43:26 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tI4pq-00048L-5U; Mon, 02 Dec 2024 11:43:26 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tI4po-00048E-US for linux-f2fs-devel@lists.sourceforge.net; Mon, 02 Dec 2024 11:43:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=lXehNYUV/kxz0GssWjqfkvliurWy4HJYsoUNocd0T10=; b=cI1Z/bRXWH1o4J6E57n5fTiiUP Tj9GaAgXz4JV0gaBr83v8plbqcMHiQs7U+H0Va/RCDVTYqttPUZduyo9G7VhZRmYcfCIZGOPTKd/1 63Vok6Q+2s93ktfcPk9zCXlZRkL4ILfTuEEXjLuzj9efkpbtG5EV7fKYJp4jSPgVZVlw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=lXehNYUV/kxz0GssWjqfkvliurWy4HJYsoUNocd0T10=; b=N OqNTuUEcHGpgFFDyg7+5luoYuI560ggf5o9mB+CiVzIcwHTJhjCI/UwuKMR3Mq+baEAZNPjMATw4q W/YVYIPBOdGoZopmZ44yAo+8yMdtIvL19en/KsHXJwJKHUIT/msug7rN7Ea8Vhf7eouFteQDQb3KA CnExAm/M5sniW7Pc=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tI4po-0006B4-6j for linux-f2fs-devel@lists.sourceforge.net; Mon, 02 Dec 2024 11:43:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D25C05C639D for ; Mon, 2 Dec 2024 11:42:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BA02C4CED1; Mon, 2 Dec 2024 11:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733139793; bh=hspy3GOF2R29pUWjr+WGkU33VslKmEFqfIpp0rB2bWA=; h=From:To:Cc:Subject:Date:From; b=Dlt8EKPpR+AKXdYBnibD+j0F1C4Nk4DlCk0YLWLoQ8f2EEsaAMmYOKLGBA/j2xfuz fo710RYwY9Ey+0VVh1UqDGpJrvyqROGGRhxPK8YtmFI0CiNKyf1dmj+d8OQjxQQVxo QQ0P8vHURLlETtK4DrTa01xqrXW+wj0At8jI0Fa/XFOIG70+/WfepWN4wQ+YoLux0T 9cM+jdMFJfLaCGEASnz/J5+atGUDA3SPy8DHpmfShUDosi6DceW6OgokZmFUZA2mXu SIrbRo6HCGjafpSerRBJy3uOJrVOOREreSWaaQx9s1oLKUprMs2NlYHeeZEYZziqB8 bu1xFUlXtFFUQ== To: Zorro Lang , fstests@vger.kernel.org Date: Mon, 2 Dec 2024 19:43:07 +0800 Message-Id: <20241202114307.2747-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1tI4po-0006B4-6j Subject: [f2fs-dev] [PATCH] f2fs/008: test snapshot creation/deletion on lvm device X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chao Yu via Linux-f2fs-devel Reply-To: Chao Yu Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This patch introduce a regression testcase to check whether f2fs can handle discard correctly once underlying lvm device changes to not support discard after user creates snapshot on it. Related bug was fixed by commit bc8aeb04fd80 ("f2fs: fix to drop all discards after creating snapshot on lvm device") Cc: Jaegeuk Kim Signed-off-by: Chao Yu --- tests/f2fs/008 | 53 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/008.out | 2 ++ 2 files changed, 55 insertions(+) create mode 100755 tests/f2fs/008 create mode 100644 tests/f2fs/008.out diff --git a/tests/f2fs/008 b/tests/f2fs/008 new file mode 100755 index 00000000..a9a3f263 --- /dev/null +++ b/tests/f2fs/008 @@ -0,0 +1,53 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oppo. All Rights Reserved. +# +# FS QA Test No. f2fs/008 +# +# This is a regression test to check whether f2fs can handle +# discard correctly once underlying lvm device changes to not +# support discard after user creates snapshot on it. +# + +. ./common/preamble +_begin_fstest auto quick rw + +_fixed_by_kernel_commit bc8aeb04fd80 \ + "f2fs: fix to drop all discards after creating snapshot on lvm device" + +_require_scratch_nolvm +_require_block_device $SCRATCH_DEV +_require_command "$LVM_PROG" lvm + +lvname=lv_$sed +vgname=vg_$Sseg +testfile=$SCRATCH_MNT/testfile + +_cleanup() +{ + $LVM_PROG lvremove -f /dev/mapper/$lvname-snapshot $vgname >>$seqres.full 2>&1 + $LVM_PROG lvremove -f /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 + $LVM_PROG vgremove -f $vgname >>$seqres.full 2>&1 + $LVM_PROG pvremove -f $SCRATCH_DEV >>$seqres.full 2>&1 +} + +$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1 +$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1 +$LVM_PROG lvcreate -L 1024m -n $lvname $vgname >>$seqres.full 2>&1 + +$MKFS_F2FS_PROG /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 +mount -o discard /dev/mapper/$vgname-$lvname $SCRATCH_MNT >>$seqres.full 2>&1 + +dd if=/dev/zero of=$testfile bs=1M count=20 >>$seqres.full 2>&1 +sync +rm $testfile +sync + +# create a snapshot on lvm device +$LVM_PROG lvcreate -L 1024m -s -n $lvname-snapshot /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 +umount $SCRATCH_MNT + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/f2fs/008.out b/tests/f2fs/008.out new file mode 100644 index 00000000..dd68d5a4 --- /dev/null +++ b/tests/f2fs/008.out @@ -0,0 +1,2 @@ +QA output created by 008 +Silence is golden -- 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel