From patchwork Wed Feb 26 03:22:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 1244617 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48S1PC09x8z9sRG for ; Wed, 26 Feb 2020 14:24:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729623AbgBZDYO (ORCPT ); Tue, 25 Feb 2020 22:24:14 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:10692 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727880AbgBZDYO (ORCPT ); Tue, 25 Feb 2020 22:24:14 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id AE8AEC40EFCBC33E271E; Wed, 26 Feb 2020 11:24:12 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Wed, 26 Feb 2020 11:24:05 +0800 From: "zhangyi (F)" To: , CC: , Subject: [PATCH v2] ext4/021: make sure the fdatasync subprocess exits Date: Wed, 26 Feb 2020 11:22:56 +0800 Message-ID: <20200226032256.10978-1-yi.zhang@huawei.com> X-Mailer: git-send-email 2.17.2 MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Now we just kill fdatasync_work process and wait nothing after the test, so a busy unmount failure may appear if the fdatasync syscall doesn't return in time. umount: /tmp/scratch: target is busy. mount: /tmp/scratch: /dev/sdb already mounted on /tmp/scratch. !!! failed to remount /dev/sdb on /tmp/scratch This patch wait the xfs_io fdatasync subprocess exit to make sure _check_scratch_fs success. Signed-off-by: zhangyi (F) Reviewed-by: Theodore Ts'o --- tests/ext4/021 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/ext4/021 b/tests/ext4/021 index 519737e1..3fc38e89 100755 --- a/tests/ext4/021 +++ b/tests/ext4/021 @@ -80,6 +80,10 @@ _scratch_mount do_fdatasync_work() { + # Wait for running subcommand before exitting so that + # mountpoint is not busy when we try to unmount it + trap "wait; exit" SIGTERM + while [ 1 ]; do $XFS_IO_PROG -f -c "fdatasync" $SCRATCH_MNT/testfile done @@ -89,6 +93,7 @@ do_fdatasync_work & datasync_work_pid=$! sleep 10 kill $datasync_work_pid >/dev/null 2>&1 +wait # success, all done status=0