From patchwork Mon Jan 11 11:38:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 8002631 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22FE6BEEE5 for ; Mon, 11 Jan 2016 11:38:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A6F5202D1 for ; Mon, 11 Jan 2016 11:38:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B417B20295 for ; Mon, 11 Jan 2016 11:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759859AbcAKLip (ORCPT ); Mon, 11 Jan 2016 06:38:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47715 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759856AbcAKLin (ORCPT ); Mon, 11 Jan 2016 06:38:43 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B82E02631; Mon, 11 Jan 2016 11:38:43 +0000 (UTC) Received: from localhost (dhcp-13-211.nay.redhat.com [10.66.13.211]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0BBce0g008169; Mon, 11 Jan 2016 06:38:42 -0500 From: Eryu Guan To: fstests@vger.kernel.org Cc: linux-unionfs@vger.kernel.org, Eryu Guan Subject: [PATCH 1/2] common: remove all files in $SCRATCH_DEV for overlayfs in _scratch_cleanup_files() Date: Mon, 11 Jan 2016 19:38:20 +0800 Message-Id: <1452512301-22145-1-git-send-email-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP All files in lower/upper dirs should be removed for overlayfs in _scratch_cleanup_files(), not only files in merged dir, otherwise files from lower dir won't be removed. Signed-off-by: Eryu Guan --- common/rc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/rc b/common/rc index e5ae1d0..e2a32da 100644 --- a/common/rc +++ b/common/rc @@ -701,9 +701,17 @@ _mkfs_dev() # remove all files in $SCRATCH_MNT, useful when testing on NFS/CIFS _scratch_cleanup_files() { - _scratch_mount - rm -rf $SCRATCH_MNT/* - _scratch_unmount + case $FSTYP in + overlay) + # $SCRATCH_DEV is a valid directory in overlay case + rm -rf $SCRATCH_DEV/* + ;; + *) + _scratch_mount + rm -rf $SCRATCH_MNT/* + _scratch_unmount + ;; + esac } _scratch_mkfs()