From patchwork Sun Dec 25 18:09:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9488263 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 857E562AAC for ; Sun, 25 Dec 2016 18:10:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8790C204BE for ; Sun, 25 Dec 2016 18:10:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C57622A63; Sun, 25 Dec 2016 18:10:05 +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 369D826E69 for ; Sun, 25 Dec 2016 18:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753140AbcLYSKE (ORCPT ); Sun, 25 Dec 2016 13:10:04 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36394 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752426AbcLYSKD (ORCPT ); Sun, 25 Dec 2016 13:10:03 -0500 Received: by mail-wm0-f67.google.com with SMTP id m203so50281619wma.3; Sun, 25 Dec 2016 10:10:02 -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=ZDqeFpJ7odv8oCzYpMrbtInRWq7tuhnUAecnyHuoyeI=; b=iRt2Wli1iqzWUsKE1lvjJ10RBkgupQviVIs91nSCVVJptmuoHfRete0xxHKJGHuARQ bdyn30yqwzyM3tq4t1dWiFKs0A+9kjJEth/k/CedqI9NSaGy4YB7WCbHAW64o2BMGwn2 tUUrApDk07IMh6WDJzvMt7EeK2LU/86iWFXyTxwsvjO9GVcwG3sfnZquVl54x+jkIpVT 1ZVJrG+2CzVBwzSyuUE1O9IPFyqcDQQ4ldABviK7IJvGkSfWNHA5UJQdFd7lSl5qr2Bn i/04MAL4B2+IDUwArFkktrVewrI1SQsEsb+7WctyWKIajbPOTrDwEFtcrNp0ZFIoKhad ZjpA== 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=ZDqeFpJ7odv8oCzYpMrbtInRWq7tuhnUAecnyHuoyeI=; b=oCAANICu54i0QqQvl9nTwkQ8J1FgZhWmSW3QolAYZxtZyq9jieezWHXV8BG7pH/h4w us3Co0LVElFAj/gbQuZwC3io2N6f6rrTxXFnotvxxueZo/C7/GGpAWrx6bgbJZipSNxO 1nbb96r2g1B6lNNSIHJJhD+85Pu9WtGqtK6yjvTkrWbDDWrwNxk4rCyma+vyoGTkIg0h cbgnFiGtK332QvuiDvgXj766C4MhCQ+kDpbGb9v/aQQzqVBMx3RmW3R42H55i2ETKqgt xjngTc52N2u8Z0/rn5EZXIJ22CQB0/+WSzqrDENoTDWX36WthogRKh943Z3RCtL3cU2e ep3Q== X-Gm-Message-State: AIkVDXLem92M/mZCGdiURMB123/6IA7mCJz8X7Xp/qFfN19Yoi0S/lwvMxKKvAl6WHBqPA== X-Received: by 10.28.158.196 with SMTP id h187mr17208607wme.59.1482689401451; Sun, 25 Dec 2016 10:10:01 -0800 (PST) Received: from amir-VirtualBox.Home (bzq-79-180-107-203.red.bezeqint.net. [79.180.107.203]) by smtp.gmail.com with ESMTPSA id d184sm48068733wmd.8.2016.12.25.10.10.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Dec 2016 10:10:00 -0800 (PST) From: Amir Goldstein To: Eryu Guan , "Darrick J . Wong" , Christoph Hellwig Cc: Brian Foster , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v2 3/3] xfs/348: test readlink/readdir with malformed inode mode Date: Sun, 25 Dec 2016 20:09:36 +0200 Message-Id: <1482689376-23553-4-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482689376-23553-1-git-send-email-amir73il@gmail.com> References: <1482689376-23553-1-git-send-email-amir73il@gmail.com> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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 umount: XFS: Assertion failed: !rwsem_is_locked(&inode->i_rwsem), file: /home/amir/build/src/linux/fs/xfs/xfs_super.c, line: 951 To reproduce, need to comment out the variable 'safety'. Signed-off-by: Amir Goldstein --- tests/xfs/348 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/xfs/348 b/tests/xfs/348 index 2a54f9e..cb0e3ea 100755 --- a/tests/xfs/348 +++ b/tests/xfs/348 @@ -132,6 +132,16 @@ 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 + safety="-d" + # NOTE that ls DOES blow up with kernel 4.9 on malformed + # directory - remove the safety pin to explode + 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