From patchwork Tue Dec 13 05:12:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9471769 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 40D22607EE for ; Tue, 13 Dec 2016 05:13:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3203E285E5 for ; Tue, 13 Dec 2016 05:13:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26A7C285E9; Tue, 13 Dec 2016 05:13:02 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 1813F285E5 for ; Tue, 13 Dec 2016 05:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750771AbcLMFNA (ORCPT ); Tue, 13 Dec 2016 00:13:00 -0500 Received: from mail-wj0-f194.google.com ([209.85.210.194]:32828 "EHLO mail-wj0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750717AbcLMFM7 (ORCPT ); Tue, 13 Dec 2016 00:12:59 -0500 Received: by mail-wj0-f194.google.com with SMTP id kp2so14582357wjc.0; Mon, 12 Dec 2016 21:12:58 -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=amhjY8pPwAEVZ+nX5epQLtm3JtxttcQoazoobNdNn/w=; b=Cc84RUDOtqxQ9H/C/7PUryiEqVERsEk+Yfit12oRsfza+xFGfgik+CMXjxnJUS8aAE 3esBibAjEUb2swgzjbVVOIENqwh71fO5e+NdNVzV6ruWfR/ASQTAyjsIkngW6RluYl/U bA3ZG4yg0Sc99ZG16wo/QIEGa4Cptwh0JJVG/e0C1mYo6q5AJfZAnITKwTrk5Kc4ZP9Y 8yaB2bAo98guvZnF79zpEh66WbXEseTrln+iLxlrf6eqMDNjm0dIrPckp8OmeUOCUnkG JISxJlqzvuWycNZMydTiIU4r5JfvdzRGwfVn9FOEFjRTNVdrgtE/WVRyjncofBmweJ3e TLkw== 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=amhjY8pPwAEVZ+nX5epQLtm3JtxttcQoazoobNdNn/w=; b=Yy/IWv9JEQg0VwL0WbLl7sX15QNO8PiLR9zjWQpdmNDF+4oPmy1JEuMk0sV90nog0x /RPkxSXZfV4Zq+7HbsdsMG753DroSLM9aC9ccua9QrZeVpxYWcjsFVepW7FA1cImRJ5v y5f2pR4U64NN0mGdFGGAJcrQxpZncbaXwoGgEGlL96r+ci+gefevQtkAt0U10OhE1fGr 6D5hrvbYn0/FGAEN8hDVcYHII7jxtWnRZUeq/a1TZ6h3lvVsa/elELkFb/qH1WCNrYdQ RXIjcz2nzUoGxgF52Zp6seOYXAJAZpilK1GSRMVAcQWuME/qf2wnyl9f+gYYDVvP9EZt vL4w== X-Gm-Message-State: AKaTC00DaW48Zw5Kl+A5DFWD64RFkwcVy95bGA/XffQoesrnX8w8huMnHfveKmhflgXxdA== X-Received: by 10.194.18.196 with SMTP id y4mr86187828wjd.73.1481605977769; Mon, 12 Dec 2016 21:12:57 -0800 (PST) Received: from amir-VirtualBox.Home (bzq-109-65-102-174.red.bezeqint.net. [109.65.102.174]) by smtp.gmail.com with ESMTPSA id 204sm738297wmj.7.2016.12.12.21.12.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 21:12:57 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v2] overlay: test hardlink breakage on copy up Date: Tue, 13 Dec 2016 07:12:37 +0200 Message-Id: <1481605957-8527-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 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/019.out | 2 ++ tests/overlay/group | 1 + 3 files changed, 92 insertions(+) create mode 100755 tests/overlay/019 create mode 100644 tests/overlay/019.out v2: avoid cd into $SCRATCH_MNT Eryu, Merging this test with unknown schedule for fix is up to you. I just wanted to write all the tests to cover https://github.com/amir73il/overlayfs/wiki/Non-standard-behavior and this was the last one. Anyway, I'll keep it hanging on my overlayfs-devel branch on github. Cheers, Amir. diff --git a/tests/overlay/019 b/tests/overlay/019 new file mode 100755 index 0000000..9ce945d --- /dev/null +++ b/tests/overlay/019 @@ -0,0 +1,89 @@ +#! /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() +{ + 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 + + +rm -f $tmp.before $tmp.after + +foo=$SCRATCH_MNT/foo +bar=$SCRATCH_MNT/bar + +# 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