From patchwork Fri Jan 25 11:46:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 10781251 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 27DC8139A for ; Fri, 25 Jan 2019 11:46:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 183E92EFD9 for ; Fri, 25 Jan 2019 11:46:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CA932F1FE; Fri, 25 Jan 2019 11:46:21 +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 autolearn=unavailable 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 066392EFD9 for ; Fri, 25 Jan 2019 11:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbfAYLqT (ORCPT ); Fri, 25 Jan 2019 06:46:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:53858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbfAYLqS (ORCPT ); Fri, 25 Jan 2019 06:46:18 -0500 Received: from localhost.localdomain (bl8-197-74.dsl.telepac.pt [85.241.197.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72780218CD; Fri, 25 Jan 2019 11:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548416778; bh=WVISnRyPSf4/WjTzoCWRwHHPNhb2ygaN9avb4Q/gSl0=; h=From:To:Cc:Subject:Date:From; b=sG6T7HJwQ6ucITM5/VbcY3tLrmepf8fCA4PXDoCEn+HQ/4m9UQZy7vYauCsOCLyiZ Kud3cfcFmmsTpTNcGbnHzyQH0XqIa9/Z0w17y/cWvzlDvX+7pFSYnJfVRmxwbqxkkZ 4q/at7Du/FRx0J0/SuBrVc2py0LWjP+AgG/NTIeA= From: fdmanana@kernel.org To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Filipe Manana Subject: [PATCH 1/2] fstests: btrfs/081 declare local variables as local Date: Fri, 25 Jan 2019 11:46:11 +0000 Message-Id: <20190125114611.3954-1-fdmanana@kernel.org> X-Mailer: git-send-email 2.11.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Filipe Manana Some variables inside the test's functions were used as local but were not being declared as such. Add the local declaration for them. Signed-off-by: Filipe Manana --- tests/btrfs/081 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/btrfs/081 b/tests/btrfs/081 index dc357e53..7e83525f 100755 --- a/tests/btrfs/081 +++ b/tests/btrfs/081 @@ -45,7 +45,7 @@ extent_size=8192 create_source_file() { - name=$1 + local name=$1 # Create a file with $num_extents extents, each with a size of # $extent_size bytes. @@ -60,8 +60,8 @@ create_source_file() create_target_file() { - name=$1 - file_size=$(($num_extents * $extent_size)) + local name=$1 + local file_size=$(($num_extents * $extent_size)) $XFS_IO_PROG -f -c "pwrite -S 0xff 0 $file_size" \ -c "fsync" $SCRATCH_MNT/$name | _filter_xfs_io @@ -69,7 +69,7 @@ create_target_file() reader_loop() { - name=$1 + local name=$1 while true; do cat $SCRATCH_MNT/$name > /dev/null From patchwork Fri Jan 25 11:46:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 10781255 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 3C865139A for ; Fri, 25 Jan 2019 11:46:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CE942EFD9 for ; Fri, 25 Jan 2019 11:46:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20FF92F147; Fri, 25 Jan 2019 11:46:32 +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 autolearn=unavailable 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 C71952F201 for ; Fri, 25 Jan 2019 11:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728035AbfAYLqb (ORCPT ); Fri, 25 Jan 2019 06:46:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:53934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbfAYLqa (ORCPT ); Fri, 25 Jan 2019 06:46:30 -0500 Received: from localhost.localdomain (bl8-197-74.dsl.telepac.pt [85.241.197.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45F33218CD; Fri, 25 Jan 2019 11:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548416790; bh=hEmHoTgAGwbr3lOvWOYczS/wFWn9ysTCj5jIcsJTKbc=; h=From:To:Cc:Subject:Date:From; b=TeJ35SaoblVHn5LVgZRs1u4rwSRNhHWK0tTH+idJy4pgZed5/hR2rAeKcovkH2tBp oMH6FBAJyeQKx3TteTgr4JWaURgUylOFUbaByl7SAZZKvwFpeNv12XYklRdvwGFzqj +gSRWuloAIHek2Sd2+OjgXKXByAMg2PjA12RocH4= From: fdmanana@kernel.org To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Filipe Manana Subject: [PATCH 2/2] fstests: btrfs/081, fix killing of reader loop subshell Date: Fri, 25 Jan 2019 11:46:24 +0000 Message-Id: <20190125114624.4004-1-fdmanana@kernel.org> X-Mailer: git-send-email 2.11.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Filipe Manana The test creates a subshell that keeps running the 'cat' command against a test file in an infinite loop, and after it kills the subshell it unmounts the filesystem, after which point any 'cat' subcommand that runs after or at that time will fail resulting in an unexpected golden output: $ ./check btrfs/081 btrfs/081 3s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/081.out.bad) --- tests/btrfs/081.out 2018-09-16 21:30:48.501104179 +0100 +++ /home/fdmanana/git/hub/xfstests/results//btrfs/081.out.bad 2019-01-24 20:36:18.989746185 +0000 @@ -206,5 +206,6 @@ Verifying file digests after cloning 14968c092c68e32fa35e776392d14523 SCRATCH_MNT/foo 14968c092c68e32fa35e776392d14523 SCRATCH_MNT/bar +cat: /mnt/scratch/bar: No such file or directory Verifying target file digest after umount + mount 14968c092c68e32fa35e776392d14523 SCRATCH_MNT/bar ... (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/081.out /home/fdmanana/git/hub/xfstests/results//btrfs/081.out.bad' to see the entire diff) Ran: btrfs/081 Failures: btrfs/081 Failed 1 of 1 tests Fix that by adding a proper trap to the reader loop function so that the subshell waits for executed 'cat' commands when it receives SIGTERM. Signed-off-by: Filipe Manana --- tests/btrfs/081 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/btrfs/081 b/tests/btrfs/081 index 7e83525f..726a370f 100755 --- a/tests/btrfs/081 +++ b/tests/btrfs/081 @@ -69,6 +69,12 @@ create_target_file() reader_loop() { + # Wait for any running 'cat' subcommand before exitting so that after + # the test kills the reader loop subshell it does not fail with an + # error message from a 'cat' subcommand due to the test file being + # temporarily unavailable due to the scratch fs unmount operation. + trap "wait; exit" SIGTERM + local name=$1 while true; do