From patchwork Mon Jan 9 13:30:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9504655 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 BBBE46075F for ; Mon, 9 Jan 2017 13:34:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA0E328473 for ; Mon, 9 Jan 2017 13:34:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF05B284AD; Mon, 9 Jan 2017 13:34:20 +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 67A7E284AA for ; Mon, 9 Jan 2017 13:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761934AbdAINc2 (ORCPT ); Mon, 9 Jan 2017 08:32:28 -0500 Received: from mail-wj0-f195.google.com ([209.85.210.195]:36657 "EHLO mail-wj0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938479AbdAINa6 (ORCPT ); Mon, 9 Jan 2017 08:30:58 -0500 Received: by mail-wj0-f195.google.com with SMTP id dh1so4309747wjb.3; Mon, 09 Jan 2017 05:30:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q9cab+S0ZFsfi0sqJkkXpAryOfmRoE5H/FLgjrsHnaE=; b=C5RWEdMJM/j6rXavH8ubj5wZwPzBJ55Qu4NOep010i08om90RitLaUqySfFrVc8+ip xm4jOgx4PMYxb4o9o9XBECxZNFcA9/c3WsSFL3N4voT4Ier6LwdD9C6i5xGhRNphFAZz v7ec9AHCxE9tmREd8nG/QagQKWBOojXRvP6L13aZVkEAQURvf/8py5xJiVAyvfpujTtz 4JhNIJF0bx0w99HT5su7A7FZ6jdV6BnfheI46UtRMVimbN8umOhFHvpng3E59CKKpj1w 2jbmo2Xx3GBQ+YO8JPVPsYJ3Nup209A6JogXwgdK8DF8h7fsooOyNW3/qgUswpGQUJ7Y Ch9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q9cab+S0ZFsfi0sqJkkXpAryOfmRoE5H/FLgjrsHnaE=; b=P+ZAuc1rWjS2dCcseSaC094CfWqZbnrucSSik+W0u1u0qj8dg/KOFHu1u65pGnxlRM /2KwohAeltwh96f8bkVL916QDWJzIrlZVktuGRfBPeJC/n882rzj1SFt3vW6hxMLoAaZ Ui0CcSAvUNxRSM6+jfwyGJnIcM1tD3DivMMcMGLi/UzZ1AgLp4NU3jjEL/6IRc27nCr/ dgpgeWXOsd2akeYmRDBQeyMhssjqlw+2KRh6WazQteuMU/rYOr+M3DKZgspZnvGkup7u AZ3Y4wW51e9SCamE7vfEn9Bs2NKwCXY1KxYGsTy5hb5ZXSPGJ/Okc/LmXYUr6K8u1hom P9ow== X-Gm-Message-State: AIkVDXJZ17pk7nf977Eh6wFqjw+Cb0TN6dI5zBmJJZYmB8gTXOL9q51sZeRuAXmI7XX7Jw== X-Received: by 10.194.136.166 with SMTP id qb6mr63868718wjb.42.1483968656515; Mon, 09 Jan 2017 05:30:56 -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 81sm18946348wmw.7.2017.01.09.05.30.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jan 2017 05:30:55 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Brian Foster , "Darrick J . Wong" , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v3 3/3] xfs: test readlink/readdir with malformed inode mode Date: Mon, 9 Jan 2017 15:30:25 +0200 Message-Id: <1483968625-29160-4-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483968625-29160-1-git-send-email-amir73il@gmail.com> References: <1483968625-29160-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In addition to testing xfs_repair on inodes with malformed mode, and fstat of those inodes on a mounted fs, try to also list content of mock directory and readlink of mock symlink. Readdir of mock directory triggers XFS assertion on kernel 4.9 with XFS_DEBUG=y XFS: Assertion failed: rval == 0 || args->dp->i_d.di_size == args->geo->blksize, file: /home/amir/build/src/linux/fs/xfs/libxfs/xfs_dir2.c, line: 634 A fix patch, as suggested by Darrick, changes this ASSERT() to return -EFSCORRUPTED ("xfs: sanity check directory inode di_size"). Merging this test should be deferred to after fix patch is merged. Signed-off-by: Amir Goldstein --- tests/xfs/348 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/xfs/348 b/tests/xfs/348 index 30825a4..20d5d7e 100755 --- a/tests/xfs/348 +++ b/tests/xfs/348 @@ -133,6 +133,15 @@ for dt in $dtypes; do cat $tmp.stat.err else echo "stat: '$testdir/$file' is a $ftype" + # Verify that readlink of a file posing as a symlink + # and ls of a file posing as a directory does not blow up. + # NOTE that ls DOES ASSERT with kernel 4.9 and XFS_DEBUG=y + # on malformed directory + if [ -d $testdir/$file ]; then + ls "$safety" $testdir/$file &> /dev/null + elif [ -h $testdir/$file ]; then + readlink $testdir/$file &> /dev/null + fi fi | _filter_scratch done _scratch_unmount