From patchwork Wed Jan 11 06:41:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9509343 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 7A49860231 for ; Wed, 11 Jan 2017 06:41:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68E1C28541 for ; Wed, 11 Jan 2017 06:41:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ACF828563; Wed, 11 Jan 2017 06:41:28 +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 0AABD28541 for ; Wed, 11 Jan 2017 06:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752492AbdAKGl1 (ORCPT ); Wed, 11 Jan 2017 01:41:27 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36788 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbdAKGl0 (ORCPT ); Wed, 11 Jan 2017 01:41:26 -0500 Received: by mail-wm0-f68.google.com with SMTP id r126so14439728wmr.3; Tue, 10 Jan 2017 22:41:26 -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=EM/rVl+tbcGdfOk93tBKApCP9hzNGn/iNkhuRzJXKxM=; b=qj1JX6ybwbOQZgU0k4JRSIIJ3rbI7D5ScP+gDsj9KyjQxL4ZzwvSweqnpr5KNksdPg HsZ5xikMHfBxPvtSJuC4AQc3j/C2vPIIJ+XaLUGeGjX2VRg2Kq3v29GjJ317nj2F6vRT WrKoZgMrIZuuZ+tj4iVVbN2XmQaEGcE3jvvM/6AaITCVZc3ogW+M0MK1E3iWBGd0oOqO aDfczOtvxNEd4vWJMhPT+2rV0zOe0Si5oAjUyGkpEI23badbeKCTzS4/QKqAmQJGaMzF 3Q0fkP0/pGvYlZrBt4t/xXM+i7+N8HIpHsjuM39RmjRqDxAH7Qvy3jRb4QBVXNRXHbvX nMGw== 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=EM/rVl+tbcGdfOk93tBKApCP9hzNGn/iNkhuRzJXKxM=; b=mrCRvPwh/4RF/i63JbKr750pGzlT05AlNjsbGdCmRgqXkiVJgnwnH9V895MuH5Mblc ixIZscjFgc+BLnmqCvZzsbdgrIgxGdKlSUdGsNHzX7jtohtgd5dsZvbtj55uBPFhI5L7 m0f6EBBoNPLpQSo9UMmfaFAYzgtB9gptQo40YLQDtmCkSVwTp0GuCS2x8E+STA09Noc6 CYG0bz8GM6RfLY1EB3n8stCekDrtFgiCFPvri/uaYEMqb9Y+kguluTAU+uUPbTsW6Cny +IKbizHe4Urt1sOlAP49h4cVchkzRe6U3APWKQmaU7hGRVmJ45dcrUXgsKcf4vy2ztAF APyQ== X-Gm-Message-State: AIkVDXIfuIaBqTeL7qjQezTYuEFNiRLyRTshojsUGXhzJ73xqbfPdUFGJiKTMLIhH69/pg== X-Received: by 10.223.152.33 with SMTP id v30mr4700381wrb.180.1484116885321; Tue, 10 Jan 2017 22:41:25 -0800 (PST) Received: from amir-VirtualBox.Home (bzq-79-176-86-32.red.bezeqint.net. [79.176.86.32]) by smtp.gmail.com with ESMTPSA id ks1sm5734923wjb.26.2017.01.10.22.41.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Jan 2017 22:41:24 -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: Wed, 11 Jan 2017 08:41:12 +0200 Message-Id: <1484116872-8063-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483968625-29160-4-git-send-email-amir73il@gmail.com> References: <1483968625-29160-4-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 $testdir/$file &> /dev/null + elif [ -h $testdir/$file ]; then + readlink $testdir/$file &> /dev/null + fi fi | _filter_scratch done _scratch_unmount