From patchwork Tue Jul 31 05:41:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 10549931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48A2396FA for ; Tue, 31 Jul 2018 05:41:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37E5B2A44E for ; Tue, 31 Jul 2018 05:41:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C0462A498; Tue, 31 Jul 2018 05:41:27 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 CC2352A4C3 for ; Tue, 31 Jul 2018 05:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726369AbeGaHTz (ORCPT ); Tue, 31 Jul 2018 03:19:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43416 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726287AbeGaHTz (ORCPT ); Tue, 31 Jul 2018 03:19:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3FC63F68AE; Tue, 31 Jul 2018 05:41:25 +0000 (UTC) Received: from dhcp-12-136.nay.redhat.com (unknown [10.66.12.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A39051C666; Tue, 31 Jul 2018 05:41:23 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: linux-xfs@vger.kernel.org, yangx.jy@cn.fujitsu.com Subject: [PATCH v2 1/2] xfs/288: use -d option of xfs_db write command for v5 XFS Date: Tue, 31 Jul 2018 13:41:18 +0800 Message-Id: <20180731054119.13539-1-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 31 Jul 2018 05:41:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 31 Jul 2018 05:41:25 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'zlang@redhat.com' RCPT:'' 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 The commit b3cf8b72334fd35ef961869506e5a72ab398bc82 update xfs/288 to support v5 filesystem testing. That commit thought xfs_db write command can work well with -d option on V5 XFS. But the truth is the case doesn't use that option. So turn to use _scratch_xfs_set_metadata_field, it will help to use proper options for xfs_db write command. Signed-off-by: Zorro Lang --- Hi, This patch has been reviewed by Darrick J. Wong: https://marc.info/?l=linux-xfs&m=153287978423915&w=2 I sent this patch again only because it's related with next [2/2] patch. Thanks, Zorro tests/xfs/288 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/xfs/288 b/tests/xfs/288 index bccdb6fc..f4165b6c 100755 --- a/tests/xfs/288 +++ b/tests/xfs/288 @@ -56,9 +56,8 @@ $SETFATTR_PROG -n "user.testattr${seq}" \ _scratch_unmount # manually corrupt the XFS, by set the header count of attr to 0 -_scratch_xfs_db -x -c "inode $inum" \ - -c "ablock 0" \ - -c "write hdr.count 0" >> $seqres.full +_scratch_xfs_set_metadata_field "hdr.count" "0" \ + "inode $inum" "ablock 0" >> $seqres.full # make sure xfs_repair can find above corruption. If it can't, that # means we need to fix this bug on current xfs_repair From patchwork Tue Jul 31 05:41:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 10549937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA8AD96FA for ; Tue, 31 Jul 2018 05:41:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA6322A44E for ; Tue, 31 Jul 2018 05:41:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE6522A4C3; Tue, 31 Jul 2018 05:41:30 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable 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 4AFA82A498 for ; Tue, 31 Jul 2018 05:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727241AbeGaHT7 (ORCPT ); Tue, 31 Jul 2018 03:19:59 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44222 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726287AbeGaHT7 (ORCPT ); Tue, 31 Jul 2018 03:19:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB0BF40241C0; Tue, 31 Jul 2018 05:41:28 +0000 (UTC) Received: from dhcp-12-136.nay.redhat.com (unknown [10.66.12.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FF7B1C666; Tue, 31 Jul 2018 05:41:26 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: linux-xfs@vger.kernel.org, yangx.jy@cn.fujitsu.com Subject: [PATCH v2 2/2] xfs/288: _notrun if xfs_db can't write values into dir or attr Date: Tue, 31 Jul 2018 13:41:19 +0800 Message-Id: <20180731054119.13539-2-zlang@redhat.com> In-Reply-To: <20180731054119.13539-1-zlang@redhat.com> References: <20180731054119.13539-1-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 31 Jul 2018 05:41:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 31 Jul 2018 05:41:28 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'zlang@redhat.com' RCPT:'' 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 Commit b3cf8b72334fd35ef961869506e5a72ab398bc82 help xfs/288 to support v5 filesystems testing, but there're still some old distributions don't support xfs_db write '-d' option, or can't write values into dir/attr of v5 filesystems. For compatible with older versions, skip this test on v5 xfs if xfs_db write can't write v5 XFS dir/attr. Signed-off-by: Zorro Lang --- Hi, Xiao found v1 can't work well on xfsprogs-4.9, due to 'write -d' can't write vaules into dir/attr of v5 filesystems before xfsprogs-4.13. Only check "if write command has -d option" is not enough. So I write a function _require_xfs_db_write_da() to make sure current xfs_db can write dir/attr (not only on v5, but especially for v5). Thanks, Zorro common/xfs | 28 ++++++++++++++++++++++++++++ tests/xfs/288 | 1 + 2 files changed, 29 insertions(+) diff --git a/common/xfs b/common/xfs index d971b4a8..95dcfd59 100644 --- a/common/xfs +++ b/common/xfs @@ -720,6 +720,34 @@ _require_xfs_db_write_array() [ $supported -eq 0 ] && _notrun "xfs_db write can't support array" } +# Before xfsprogs commit 89baf918(xfs_db: write values into dir/attr blocks and +# recalculate CRCs), xfs_db write command can't write invalid data into dir/attr +# field of v5 filesystems. For some cases need to write dir/attr (especially crc +# enabled), use this _require at first. +_require_xfs_db_write_da() +{ + local inum + local count + + _require_scratch + + _scratch_mkfs > /dev/null 2>&1 + _scratch_mount + mkdir $SCRATCH_MNT/$seq.dir + inum=$(stat -c '%i' $SCRATCH_MNT/$seq.dir) + $SETFATTR_PROG -n "user.testda" \ + -v "$(perl -e "print 'v' x 65536;")" \ + $SCRATCH_MNT/$seq.dir + _scratch_unmount + _scratch_xfs_set_metadata_field "hdr.count" "0" \ + "inode $inum" "ablock 0" >/dev/null 2>&1 + count=$(_scratch_xfs_get_metadata_field "hdr.count" \ + "inode $inum" "ablock 0") + if [ "$count" != "0" ]; then + _notrun "xfs_db write can't write values into dir/attr blocks" + fi +} + _require_xfs_spaceman_command() { if [ -z "$1" ]; then diff --git a/tests/xfs/288 b/tests/xfs/288 index f4165b6c..e9589fd5 100755 --- a/tests/xfs/288 +++ b/tests/xfs/288 @@ -35,6 +35,7 @@ _supported_fs xfs _supported_os Linux _require_scratch _require_attrs +_require_xfs_db_write_da # get block size ($dbsize) from the mkfs output _scratch_mkfs_xfs 2>/dev/null | _filter_mkfs 2>$tmp.mkfs >/dev/null