From patchwork Mon Dec 12 10:29:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9470357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8463F60573 for ; Mon, 12 Dec 2016 10:29:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72CC42845D for ; Mon, 12 Dec 2016 10:29:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 672E028477; Mon, 12 Dec 2016 10:29:53 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 049712845D for ; Mon, 12 Dec 2016 10:29:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932167AbcLLK3w (ORCPT ); Mon, 12 Dec 2016 05:29:52 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36156 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754253AbcLLK3v (ORCPT ); Mon, 12 Dec 2016 05:29:51 -0500 Received: by mail-wm0-f65.google.com with SMTP id m203so10236148wma.3; Mon, 12 Dec 2016 02:29:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=PR3JG50nFqneBQMKgthiOpeGJi4MhYHUbg3EOU5OFMk=; b=MaJ0vMe/dYTbjX32qFLl/IQWoVOT1euMIhQ3efMfpbBWSWN+0R89x4zWSjbFAnUnEZ Y0MAY+n7kAXnFW7/5qd2+imSBmMoGktnsBBcbZPEhJYe0oNZrAL7Gm/vQxzyEXhvt+VQ 9EFnAJ8iecd0ePWpHbj3XN5evEx2/Ubhro2FsrLIHcu4Ci2nvKm3XgDpoNvuuH8cgq7w iBpY5/HVOQri5WtI5w3xfI3QjHQN7bsuyRzCQMRZUf1NkWKBFODqs03h8cDwfJIq2vMO sd2l3oKfS8OOgF+0MJGI1EbLX9NvR4dfzcehtrAPDRxuROjYObEwL4u7IgRa4x5uUh+h /VIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PR3JG50nFqneBQMKgthiOpeGJi4MhYHUbg3EOU5OFMk=; b=bk4hdEMoHCX3cv5m0+g2r7vq+bNeGed2u0iFW1KQlCGI4U5jw0Q90mx0/aJwjuwvLJ 22p7wfLhNdEJbHiMQ5lODPsLdeY3+W1z17jzRbWBDFFh/Jc7y5OV706Z6c433O42ArFS IIuighgTDhpeeJ2pY8Re/ePAdb9lAoAiJSi2DQIIumij6pAX1VFx4BmeZknKb+Tv6D6d m5JjV99ALtATfqrNPuxbB21d7SNKPUKpawlwXnFPgMrgJBB5rgNpbOzoqGF/pLVZoPRz QqYCWqnL8ifk3oUbPJq/FWhQwZEY1b67BuLrpkNL3PtJesNPu/gBPL3GHz2L7Rs6oFBq ih6A== X-Gm-Message-State: AKaTC03o86V6AotEn6CeAKn+e64r0IWLZDF8lyN1YMOfRCx8eeCroaDA8V5c6OnlQwdUzA== X-Received: by 10.28.45.212 with SMTP id t203mr17685294wmt.46.1481538589987; Mon, 12 Dec 2016 02:29:49 -0800 (PST) Received: from amir-VirtualBox.ctera.local (bzq-82-81-193-202.cablep.bezeqint.net. [82.81.193.202]) by smtp.gmail.com with ESMTPSA id p144sm34801186wme.23.2016.12.12.02.29.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 02:29:48 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH] overlay: test hardlink breakage on copy up Date: Mon, 12 Dec 2016 12:29:21 +0200 Message-Id: <1481538561-10558-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce a new test to demonstrate a known issue with overlayfs: - file A and B are hardlinked in lower - modify A to trigger copy up - file A is no longer a hardlink of file B There is no fix for this issue at this time. Signed-off-by: Amir Goldstein --- tests/overlay/019 | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/019.out | 2 ++ tests/overlay/group | 1 + 3 files changed, 91 insertions(+) create mode 100755 tests/overlay/019 create mode 100644 tests/overlay/019.out diff --git a/tests/overlay/019 b/tests/overlay/019 new file mode 100755 index 0000000..382e4ee --- /dev/null +++ b/tests/overlay/019 @@ -0,0 +1,88 @@ +#! /bin/bash +# FSQA Test No. 019 +# +# Test hardlink breakage +# +# This simple test demonstrates a known issue with overlayfs: +# - file A and B are hardlinked in lower +# - modify A to trigger copy up +# - file A is no longer a hardlink of file B +# +#----------------------------------------------------------------------- +# +# Copyright (C) 2016 CTERA Networks. All Rights Reserved. +# Author: Amir Goldstein +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch + +rm -f $seqres.full + +_scratch_mkfs >>$seqres.full 2>&1 + +# Create 2 hardlinked files in lower +lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR +mkdir -p $lowerdir +echo "patient zero" >> $lowerdir/foo +ln $lowerdir/foo $lowerdir/bar + + +_scratch_mount + +cd $SCRATCH_MNT + +rm -f $tmp.before $tmp.after + +# Record inode number and nlink before copy up +ls -li foo bar | awk '{ print $1, $3 }' > $tmp.before + +# Modify content of one of the hardlinks +echo "mutated" >> foo + +# Record inode number and nlink after copy up +ls -li foo bar | awk '{ print $1, $3 }' > $tmp.after + +# Compare ino/nlink before..after - expect silence +diff $tmp.before $tmp.after + +# Compare content of files - expect silence +diff foo bar + +echo "Silence is golden" +status=0 +exit diff --git a/tests/overlay/019.out b/tests/overlay/019.out new file mode 100644 index 0000000..163484b --- /dev/null +++ b/tests/overlay/019.out @@ -0,0 +1,2 @@ +QA output created by 019 +Silence is golden diff --git a/tests/overlay/group b/tests/overlay/group index fb6610d..f266b0a 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -20,3 +20,4 @@ 015 auto quick whiteout 016 auto quick copyup 018 auto quick copyup +019 auto quick copyup