Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1792709ybn; Thu, 26 Sep 2019 02:15:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNlq4mrrEjGzhBkRkjxhMHXPFNDqCkG0kNMo69f8Xcdd6Th5kLB7eAl8UpNdsp01q+uAlU X-Received: by 2002:a17:906:8c8:: with SMTP id o8mr2218008eje.56.1569489301833; Thu, 26 Sep 2019 02:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569489301; cv=none; d=google.com; s=arc-20160816; b=jxB8VBVIu+H6S15bwIMNtPgNIL6uxcQcIxwcNqeL5wwfo+bWGOsgfleENHpOZblF1c 5l7CWdL0Gdk2WMeklcTDwa+kM6XmSIbDXqCuLVi7yLbAA8X6EAjOu6a+L4uHIe7zCc1n 3ReauY74qcJNqQhWNppchhZu8h0ijRa6xr1WLckwAg3TFrwEpTXIIcdWTLOL35fSo1P3 29fpIZPB3z+ouZcc/OVzPvl22ci0743Y6EZ2TNA3rEaC7PhSdlB/6mmc4a2Ty4/e23sq Zi6LsgrXiA3g/wiFbJ9ZYO/AJVEfmaXlXq6QJ9z4/L09UoVsNjls/8yfO1+FL3XrM+iS D3uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=aTBsP12DATcUOMWa5Bk+jjz4OmZX85QcGVgZ9gwN+4w=; b=HW0VV4rDT2QjpGwfu0ssaSS06y7jU/cqZONek820AM4VKir0cLSGFkBMcPSerQgs4c DNBTh8gYob/aP902GnTpgqh7D4G3XVx4jqRPg9VPbey39gBMJ/I1usmTEjX/CXuXdrE7 ii04sD54Jy+zPHJwRlzu4xNnxl+fHPdLYOm7edgx3wk1avt/LDqve+m53Dlw3SFOoADG VXrwyF7x7WUd5M5qyIZlwdOo5UQ2ob5gT5Cv9ZbCVLo7RyyDna9FnQoTXtY5koolpV1k RjcLdmX43+bECHZSZj0SLSNcFbzeDjpSvowtZSJ8kRVEOgw1G+70pvMf+xMPz64PHuAl iDhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si1097043edc.151.2019.09.26.02.14.38; Thu, 26 Sep 2019 02:15:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392542AbfIYG3E (ORCPT + 99 others); Wed, 25 Sep 2019 02:29:04 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2778 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390491AbfIYG3E (ORCPT ); Wed, 25 Sep 2019 02:29:04 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 31D1BA6A5DDE99DB5B69; Wed, 25 Sep 2019 14:28:51 +0800 (CST) Received: from huawei.com (10.90.53.225) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Wed, 25 Sep 2019 14:28:42 +0800 From: Zhihao Cheng To: , , , , CC: , , Subject: [PATCH xfstests v3] overlay: Enable character device to be the base fs partition Date: Wed, 25 Sep 2019 14:35:33 +0800 Message-ID: <1569393333-128141-1-git-send-email-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.90.53.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When running overlay tests using character devices as base fs partitions, all overlay usecase results become 'notrun'. Function '_overay_config_override' (common/config) detects that the current base fs partition is not a block device and will set FSTYP to base fs. The overlay usecase will check the current FSTYP, and if it is not 'overlay' or 'generic', it will skip the execution. For example, using UBIFS as base fs skips all overlay usecases: FSTYP -- ubifs # FSTYP should be overridden as 'overlay' MKFS_OPTIONS -- /dev/ubi0_1 # Character device MOUNT_OPTIONS -- -t ubifs /dev/ubi0_1 /tmp/scratch overlay/001 [not run] not suitable for this filesystem type: ubifs overlay/002 [not run] not suitable for this filesystem type: ubifs overlay/003 [not run] not suitable for this filesystem type: ubifs When checking that the base fs partition is a block/character device, FSTYP is overwritten as 'overlay'. This patch allows the base fs partition to be a character device that can also execute overlay usecases (such as ubifs). Signed-off-by: Zhihao Cheng Signed-off-by: Amir Goldstein --- common/config | 6 +++--- common/rc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/config b/common/config index 4c86a49..4eda36c 100644 --- a/common/config +++ b/common/config @@ -532,7 +532,7 @@ _canonicalize_mountpoint() # When SCRATCH/TEST_* vars are defined in evironment and not # in config file, this function is called after vars have already # been overriden in the previous test. -# In that case, TEST_DEV is a directory and not a blockdev and +# In that case, TEST_DEV is a directory and not a blockdev/chardev and # the function will return without overriding the SCRATCH/TEST_* vars. _overlay_config_override() { @@ -550,7 +550,7 @@ _overlay_config_override() # the new OVL_BASE_SCRATCH/TEST_DEV/MNT vars are set to the values # of the configured base fs and SCRATCH/TEST_DEV vars are set to the # overlayfs base and mount dirs inside base fs mount. - [ -b "$TEST_DEV" ] || return 0 + [ -b "$TEST_DEV" ] || [ -c "$TEST_DEV" ] || return 0 # Config file may specify base fs type, but we obay -overlay flag [ "$FSTYP" == overlay ] || export OVL_BASE_FSTYP="$FSTYP" @@ -570,7 +570,7 @@ _overlay_config_override() export TEST_DIR="$OVL_BASE_TEST_DIR/$OVL_MNT" export MOUNT_OPTIONS="$OVERLAY_MOUNT_OPTIONS" - [ -b "$SCRATCH_DEV" ] || return 0 + [ -b "$SCRATCH_DEV" ] || [ -c "$SCRATCH_DEV" ] || return 0 # Store original base fs vars export OVL_BASE_SCRATCH_DEV="$SCRATCH_DEV" diff --git a/common/rc b/common/rc index 66c7fd4..8d57c37 100644 --- a/common/rc +++ b/common/rc @@ -3100,7 +3100,7 @@ _require_scratch_shutdown() # SCRATCH_DEV, in this case OVL_BASE_SCRATCH_DEV # will be null, so check OVL_BASE_SCRATCH_DEV before # running shutdown to avoid shutting down base fs accidently. - _notrun "$SCRATCH_DEV is not a block device" + _notrun "This test requires a valid $OVL_BASE_SCRATCH_DEV as ovl base fs" else src/godown -f $OVL_BASE_SCRATCH_MNT 2>&1 \ || _notrun "Underlying filesystem does not support shutdown" -- 2.7.4