From patchwork Thu Feb 11 22:59:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26CEBC433DB for ; Thu, 11 Feb 2021 22:59:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D601264E58 for ; Thu, 11 Feb 2021 22:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbhBKW7u (ORCPT ); Thu, 11 Feb 2021 17:59:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:45860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhBKW7t (ORCPT ); Thu, 11 Feb 2021 17:59:49 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A8DE064E3D; Thu, 11 Feb 2021 22:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084347; bh=2nYHqGMPl3YRJRiNgor3zNMGRLLt0XUwPh3DeanmAgs=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=poPDdEyC59fd/oPu8voVeyI/eZvyyAyMwiAPS5xxVqQ7gikr7Vlt67IaCMAkkvesk 1T8iF+LoXpPY3tBmcCGcnnwsdWZ//d6udAo4/Wue2tfS+ZNHB27DRE8DFK/AhzbK8U Kums+DXxq92g1QwoXK7MFqBy1TMrClaZXg4lkQ92/58QJLZjLX01cKMuukEox1htw6 e/y00spOWFXH+Ti3c0a3ouco6veykscTmL33ChVy0c0ldhAhb1Dgt2iSNzi18XJHdB MuRrWxy9sXOVmV2oSxNCSyUn5QnijWMWPqq+hUBMSxb0pVZpQFlOpjA5r6h27wcnkE wp1OnETNSfreg== Subject: [PATCH 01/11] xfs_admin: clean up string quoting From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Brian Foster , Christoph Hellwig , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:07 -0800 Message-ID: <161308434707.3850286.16561299406740612589.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Clean up the string quoting in this script so that we don't trip over users feeding us arguments like "/dev/sd ha ha ha lol". Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Reviewed-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- db/xfs_admin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh index bd325da2..71a9aa98 100755 --- a/db/xfs_admin.sh +++ b/db/xfs_admin.sh @@ -43,7 +43,7 @@ case $# in if [ -n "$DB_OPTS" ] then - eval xfs_db -x -p xfs_admin $DB_OPTS $1 + eval xfs_db -x -p xfs_admin $DB_OPTS "$1" status=$? fi if [ -n "$REPAIR_OPTS" ] @@ -53,7 +53,7 @@ case $# in # running xfs_admin. # Ideally, we need to improve the output behaviour # of repair for this purpose (say a "quiet" mode). - eval xfs_repair $REPAIR_OPTS $1 2> /dev/null + eval xfs_repair $REPAIR_OPTS "$1" 2> /dev/null status=`expr $? + $status` if [ $status -ne 0 ] then From patchwork Thu Feb 11 22:59:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4E3AC433DB for ; Thu, 11 Feb 2021 22:59:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82E7F64E55 for ; Thu, 11 Feb 2021 22:59:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbhBKW7z (ORCPT ); Thu, 11 Feb 2021 17:59:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:45880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhBKW7y (ORCPT ); Thu, 11 Feb 2021 17:59:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E86064E42; Thu, 11 Feb 2021 22:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084353; bh=UqEngCFltsVVc4Sg7u8+2+Q2wxmZlRz6PjZa8I4EEik=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=M03sF4AxMt02JXuc9ezL5uqg6UPC+wz3V3Jp405VWFuCsfyqy9UYvVu66Gn0C0623 +eL6BWNz3TMYsf48WGb5kuNSI6UrjShBOGrKZKVfeYy6Jyd/RdF+Au0qXbed/Y40Qn /njso1Tg6wZMJoS1+syvliMlb2UwEwQOO34Bu6H35H9lCYQjw24kPwJGBftZXx1Sgk pLu/1b46MVzsdGhLiOH94rJWIaADVM466XlNBC4+5OtUZFBneYaCNIfPTg8TLGsGeV NS6s7uYatCVylkTgA6ab7Pyv7GJkJv6MX0+KMImhNKGfDfwmZ6x/vyV2nFUxLCIspG 99GuD3n0bFDew== Subject: [PATCH 02/11] xfs_admin: support filesystems with realtime devices From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , Brian Foster , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:12 -0800 Message-ID: <161308435277.3850286.13874179572153084568.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Add a -r option to xfs_admin so that we can pass the name of the realtime device to xfs_repair. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Chaitanya Kulkarni --- db/xfs_admin.sh | 11 ++++++----- man/man8/xfs_admin.8 | 8 ++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh index 71a9aa98..430872ef 100755 --- a/db/xfs_admin.sh +++ b/db/xfs_admin.sh @@ -7,9 +7,10 @@ status=0 DB_OPTS="" REPAIR_OPTS="" -USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device [logdev]" +REPAIR_DEV_OPTS="" +USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-r rtdev] [-U uuid] device [logdev]" -while getopts "efjlpuc:L:U:V" c +while getopts "c:efjlL:pr:uU:V" c do case $c in c) REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;; @@ -19,6 +20,7 @@ do l) DB_OPTS=$DB_OPTS" -r -c label";; L) DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";; p) DB_OPTS=$DB_OPTS" -c 'version projid32bit'";; + r) REPAIR_DEV_OPTS=" -r '$OPTARG'";; u) DB_OPTS=$DB_OPTS" -r -c uuid";; U) DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";; V) xfs_db -p xfs_admin -V @@ -37,8 +39,7 @@ case $# in # Pick up the log device, if present if [ -n "$2" ]; then DB_OPTS=$DB_OPTS" -l '$2'" - test -n "$REPAIR_OPTS" && \ - REPAIR_OPTS=$REPAIR_OPTS" -l '$2'" + REPAIR_DEV_OPTS=$REPAIR_DEV_OPTS" -l '$2'" fi if [ -n "$DB_OPTS" ] @@ -53,7 +54,7 @@ case $# in # running xfs_admin. # Ideally, we need to improve the output behaviour # of repair for this purpose (say a "quiet" mode). - eval xfs_repair $REPAIR_OPTS "$1" 2> /dev/null + eval xfs_repair $REPAIR_DEV_OPTS $REPAIR_OPTS "$1" 2> /dev/null status=`expr $? + $status` if [ $status -ne 0 ] then diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index 8afc873f..cccbb224 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -13,6 +13,9 @@ xfs_admin \- change parameters of an XFS filesystem ] [ .B \-U .I uuid +] [ +.B \-r +.I rtdev ] .I device [ @@ -123,6 +126,11 @@ not be able to mount the filesystem. To remove this incompatible flag, use which will restore the original UUID and remove the incompatible feature flag as needed. .TP +.BI \-r " rtdev" +Specifies the device special file where the filesystem's realtime section +resides. +Only for those filesystems which use a realtime section. +.TP .B \-V Prints the version number and exits. .PP From patchwork Thu Feb 11 22:59:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE1AFC433E0 for ; Thu, 11 Feb 2021 23:00:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91AFF64E55 for ; Thu, 11 Feb 2021 23:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230005AbhBKXAA (ORCPT ); Thu, 11 Feb 2021 18:00:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:45900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhBKW77 (ORCPT ); Thu, 11 Feb 2021 17:59:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EC6DA64E45; Thu, 11 Feb 2021 22:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084359; bh=EQyv+2tV702VcR7DfyihyF5UejBebc12Ks4An41ZuP4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ijmyLI0Cc4bQMyhCr/t9PyltnAXDjL/sol7QBycIJ5OI+23C/UZN03OTC0S3eMa+v OV/9M+HkkTN6fysR/mwMQbujilChAJ26yezb+LdWOKpYazOVUdEGtZLFEAfXdhypnD ZNvUiQvRCMLqfGpPFNd19WlRTnX/y92Qxoi08CjQHy61kWbLEr4NCwrq6n4BbhnTst w/m5naC/gA0FR0CMOp+uxqKGxlAm2SCYjEkKKeYbSLp4v7gC1Qahfr0LWnE1KqH8Cz h5xjOeF77RGbD9vGiTuc6PbaFpNW5R55Ox95a1NCTDrDqnwAJPrNRU9L/lzTKmMQ3B G96IEjcYOlOVg== Subject: [PATCH 03/11] xfs_db: report the needsrepair flag in check and version commands From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Brian Foster , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:18 -0800 Message-ID: <161308435838.3850286.1999965170245294704.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Teach the version and check commands to report the presence of the NEEDSREPAIR flag. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster --- db/check.c | 5 +++++ db/sb.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/db/check.c b/db/check.c index 33736e33..485e855e 100644 --- a/db/check.c +++ b/db/check.c @@ -3970,6 +3970,11 @@ scan_ag( dbprintf(_("mkfs not completed successfully\n")); error++; } + if (xfs_sb_version_needsrepair(sb)) { + if (!sflag) + dbprintf(_("filesystem needs xfs_repair\n")); + error++; + } set_dbmap(agno, XFS_SB_BLOCK(mp), 1, DBM_SB, agno, XFS_SB_BLOCK(mp)); if (sb->sb_logstart && XFS_FSB_TO_AGNO(mp, sb->sb_logstart) == agno) set_dbmap(agno, XFS_FSB_TO_AGBNO(mp, sb->sb_logstart), diff --git a/db/sb.c b/db/sb.c index d09f653d..d7111e92 100644 --- a/db/sb.c +++ b/db/sb.c @@ -691,6 +691,8 @@ version_string( strcat(s, ",INOBTCNT"); if (xfs_sb_version_hasbigtime(sbp)) strcat(s, ",BIGTIME"); + if (xfs_sb_version_needsrepair(sbp)) + strcat(s, ",NEEDSREPAIR"); return s; } From patchwork Thu Feb 11 22:59:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE4A2C433DB for ; Thu, 11 Feb 2021 23:00:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CCB964E4B for ; Thu, 11 Feb 2021 23:00:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbhBKXAP (ORCPT ); Thu, 11 Feb 2021 18:00:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:45996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbhBKXAO (ORCPT ); Thu, 11 Feb 2021 18:00:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A47C364E4A; Thu, 11 Feb 2021 22:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084364; bh=eYTE8MxWR0l0+sBxedArH65I5fhuR0B+OsSJpCSB5iU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=lx1ZipNtFdnn8QHS1gLN797aeyKB2Y+HKrg2mqrjYrvMmgOS6gzKwGk9D6TbgVIEA n5EUQey2JNqZx457RxxQKK7yHwIE3kz9Xxj0+kpYxm4mmedIhweHEkoXDMOYZdMXeR ZhMgORnLUxYAdj0gP3c4WKwOof1x2YGPifYRe2YloLNV6oWmGXIydKQOL50av8bA3w RFamkzJrkALxPCYPXKF47x6xNdFGdT5A//8p2z73jfQI2kvqVICFpnP6Bd17luwelG Wr1hIitjfMU1Ax2qm5/Gte+wzSrKpohPXUjs2Wbn89+tCm7gFXyZ1EPx/aIwvVh1PH b6VvHEnb7hM8w== Subject: [PATCH 04/11] xfs_db: don't allow label/uuid setting if the needsrepair flag is set From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Brian Foster , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:24 -0800 Message-ID: <161308436401.3850286.10329324186479058348.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The NEEDSREPAIR flag can be set on filesystems where we /know/ that there's something wrong with the metadata and want to force the sysadmin to run xfs_repair before the next mount. The goal here is to prevent non-repair changes to a filesystem when we are confident of its instability. Normally we wouldn't bother with such safety checks for the debugger, but the label and uuid functions can be called from xfs_admin, so we should prevent these administrative tasks until the filesystem can be repaired. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster --- db/sb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/db/sb.c b/db/sb.c index d7111e92..cec7dce9 100644 --- a/db/sb.c +++ b/db/sb.c @@ -379,6 +379,11 @@ uuid_f( progname); return 0; } + if (xfs_sb_version_needsrepair(&mp->m_sb)) { + dbprintf(_("%s: filesystem needs xfs_repair\n"), + progname); + return 0; + } if (!strcasecmp(argv[1], "generate")) { platform_uuid_generate(&uu); @@ -543,6 +548,12 @@ label_f( return 0; } + if (xfs_sb_version_needsrepair(&mp->m_sb)) { + dbprintf(_("%s: filesystem needs xfs_repair\n"), + progname); + return 0; + } + dbprintf(_("writing all SBs\n")); for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) if ((p = do_label(ag, argv[1])) == NULL) { From patchwork Thu Feb 11 22:59:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D362BC433DB for ; Thu, 11 Feb 2021 23:00:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9979964E57 for ; Thu, 11 Feb 2021 23:00:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229989AbhBKXAP (ORCPT ); Thu, 11 Feb 2021 18:00:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:45998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhBKXAO (ORCPT ); Thu, 11 Feb 2021 18:00:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4970064E4B; Thu, 11 Feb 2021 22:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084370; bh=2+ktohsYSZ7SIz6e/CLwjMvXUZiKLZYu7GuXyJiIEvw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ZWSRdH1ga9b9+U6yotbk9pzZaLrb4VBeV8/JaZ0S4NEuwXineK9k23WsvnYgiCGaE crX6DeS+WVqfX0f7aoAw9/YBMH0LPaxbBS/i0vR4wufcvUFE6TVq+Fu4FFjOYDKVMY 0SUjds/jlsMB2m/xlCoIDQEl4PkobSc2DqrkT56bC3y4sbnQzW8xoapy6Qum5ZiFg7 cCT3v0mwGcVuzuepCSWxuxOmf6gn6cyH0rA5Mh1dN6OUnAMwohQ4JFsFJsMkpyZTUo QutXRj8HTVhBH2IPRPeEPknyKqui39B/YroK09eWAIywN6fsPQzbtVdyO+VstrRrk6 HD28nqntdfBeg== Subject: [PATCH 05/11] xfs_repair: fix unmount error message to have a newline From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Brian Foster , Christoph Hellwig , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:29 -0800 Message-ID: <161308436971.3850286.1647270104945019584.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Add a newline so that this is consistent with the other error messages. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Reviewed-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- repair/xfs_repair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 724661d8..9409f0d8 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -1136,7 +1136,7 @@ _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\ error = -libxfs_umount(mp); if (error) do_error( - _("File system metadata writeout failed, err=%d. Re-run xfs_repair."), + _("File system metadata writeout failed, err=%d. Re-run xfs_repair.\n"), error); libxfs_destroy(&x); From patchwork Thu Feb 11 22:59:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41481C433E0 for ; Thu, 11 Feb 2021 23:00:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB7E764E4D for ; Thu, 11 Feb 2021 23:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbhBKXA2 (ORCPT ); Thu, 11 Feb 2021 18:00:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:46060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbhBKXAZ (ORCPT ); Thu, 11 Feb 2021 18:00:25 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F6A664E44; Thu, 11 Feb 2021 22:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084376; bh=E+nr4GUSFhrROrwtzLXtQkq0fOas518cxwYs4EPNyX8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=YMtMfYBIBh2NZxoDio4s5NfzjZMx2vMjfzF8dlBtvvUUKtjWYRwrWGk1q+fsxFwlm u/2NZuxbiZ4CAS+aMl0TCs3Sio6dLxUb5qDMMdWoTe7821PMFuVkSTAFkyUPHS9J1j lPhB1Q2kOeT7E8pIAtcwsO2ZcGAj1zMfYhuGZ4h4s7pFCK8d0l3kUFpWbwHhb9UG74 3WwtfC4uw1n9j7SK8XH+wMyfQC2aCViNKbSmP32jKL1K70GnhGXgB1KKbB5nJomxtx CTxgAAQyTe8/os2R9vghG81gZgHnhHORIwxwH34fEXAVbzrqsUUkmpnWiavPztDXbL vvdBkTOKOXqnQ== Subject: [PATCH 06/11] xfs_repair: clear quota CHKD flags on the incore superblock too From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , Brian Foster , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:35 -0800 Message-ID: <161308437536.3850286.2827497981728883408.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong At the end of a repair run, xfs_repair clears the superblock's quota checked flags if it found mistakes in the quota accounting to force a quotacheck at the next mount. This is currently the last time repair modifies the primary superblock, so it is sufficient to update the ondisk buffer and not the incore mount structure. However, we're about to introduce code to clear the needsrepair feature at the very end of repair, after all metadata blocks have been written to disk and all disk caches flush. Since the convention everywhere else in xfs is to update the incore superblock, call libxfs_sb_to_disk to translate that into the ondisk buffer, and then write the buffer to disk, switch the quota CHKD code to use this mechanism too. (Get rid of dsb too, since the incore super should be in sync with the ondisk super.) Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster --- repair/xfs_repair.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 9409f0d8..40352458 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -717,7 +717,6 @@ main(int argc, char **argv) { xfs_mount_t *temp_mp; xfs_mount_t *mp; - xfs_dsb_t *dsb; struct xfs_buf *sbp; xfs_mount_t xfs_m; struct xlog log = {0}; @@ -1103,22 +1102,19 @@ _("Warning: project quota information would be cleared.\n" if (!sbp) do_error(_("couldn't get superblock\n")); - dsb = sbp->b_addr; - if ((mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD) != quotacheck_results()) { do_warn(_("Note - quota info will be regenerated on next " "quota mount.\n")); - dsb->sb_qflags &= cpu_to_be16(~(XFS_UQUOTA_CHKD | - XFS_GQUOTA_CHKD | - XFS_PQUOTA_CHKD | - XFS_OQUOTA_CHKD)); + mp->m_sb.sb_qflags &= ~(XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | + XFS_PQUOTA_CHKD | XFS_OQUOTA_CHKD); + libxfs_sb_to_disk(sbp->b_addr, &mp->m_sb); } if (copied_sunit) { do_warn( _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\n" "Please reset with mount -o sunit=,swidth= if necessary\n"), - be32_to_cpu(dsb->sb_unit), be32_to_cpu(dsb->sb_width)); + mp->m_sb.sb_unit, mp->m_sb.sb_width); } libxfs_buf_mark_dirty(sbp); From patchwork Thu Feb 11 22:59:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A462C433E6 for ; Thu, 11 Feb 2021 23:00:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D99064E4B for ; Thu, 11 Feb 2021 23:00:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229946AbhBKXA2 (ORCPT ); Thu, 11 Feb 2021 18:00:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:46062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229960AbhBKXA0 (ORCPT ); Thu, 11 Feb 2021 18:00:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C89D664E4D; Thu, 11 Feb 2021 22:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084381; bh=kshpFGwnWZ8RSpTHePwMTNzZQ6gGQi/ujxZCcp8l1uI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=qrB1/N6Rfodz/UmngCCYoCke2IH00IO4MpXTDLjN1TGa/18/aul5WGps9NGlUe/Rc IT00lVMNmy6HOGFAjnf829cY7TY0JG366dVNDrM8zBIp8Gly8902QFMSx7fik+zVn8 mLdDefeA2OTpoOjZ67z9ebbUMvDpM2LebnpmkiNXVBYZ/8giaK17F0vZMrKpicbNsw FcAWQjBg5jUI6OdGWbcxj9QdEd+UMkjjBIu33ZlUFg978GSxR0Wt3F4gG3BQwyLKXX BorlktSYhLcOBQsBLD9H7WOPtLKxs9r8pxLbL8yFl9EFuTSBrFgPLgvnw0S6LMyPn5 fs6l58e2hgv+w== Subject: [PATCH 07/11] xfs_repair: clear the needsrepair flag From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , Brian Foster , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:41 -0800 Message-ID: <161308438117.3850286.9338169953118054325.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Clear the needsrepair flag, since it's used to prevent mounting of an inconsistent filesystem. We only do this if we make it to the end of repair with a non-zero error code, and all the rebuilt indices and corrected metadata are persisted correctly. Note that we cannot combine clearing needsrepair with clearing the quota checked flags because we need to clear the quota flags even if reformatting the log fails, whereas we can't clear needsrepair if the log reformat fails. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster --- include/xfs_mount.h | 1 + libxfs/init.c | 20 +++++++++++++------- repair/agheader.c | 21 +++++++++++++++++++++ repair/xfs_repair.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 7 deletions(-) diff --git a/include/xfs_mount.h b/include/xfs_mount.h index 36594643..75230ca5 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -181,6 +181,7 @@ xfs_perag_resv( extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *, dev_t, dev_t, dev_t, int); +int libxfs_flush_mount(struct xfs_mount *mp); int libxfs_umount(struct xfs_mount *mp); extern void libxfs_rtmount_destroy (xfs_mount_t *); diff --git a/libxfs/init.c b/libxfs/init.c index 9fe13b8d..8a8ce3c4 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -870,7 +870,7 @@ _("%s: Flushing the %s failed, err=%d!\n"), * Flush all dirty buffers to stable storage and report on writes that didn't * make it to stable storage. */ -static int +int libxfs_flush_mount( struct xfs_mount *mp) { @@ -878,13 +878,13 @@ libxfs_flush_mount( int err2; /* - * Purge the buffer cache to write all dirty buffers to disk and free - * all incore buffers. Buffers that fail write verification will cause - * the CORRUPT_WRITE flag to be set in the buftarg. Buffers that - * cannot be written will cause the LOST_WRITE flag to be set in the - * buftarg. + * Flush the buffer cache to write all dirty buffers to disk. Buffers + * that fail write verification will cause the CORRUPT_WRITE flag to be + * set in the buftarg. Buffers that cannot be written will cause the + * LOST_WRITE flag to be set in the buftarg. Once that's done, + * instruct the disks to persist their write caches. */ - libxfs_bcache_purge(); + libxfs_bcache_flush(); /* Flush all kernel and disk write caches, and report failures. */ if (mp->m_ddev_targp) { @@ -923,6 +923,12 @@ libxfs_umount( libxfs_rtmount_destroy(mp); + /* + * Purge the buffer cache to write all dirty buffers to disk and free + * all incore buffers, then pick up the outcome when we tell the disks + * to persist their write caches. + */ + libxfs_bcache_purge(); error = libxfs_flush_mount(mp); for (agno = 0; agno < mp->m_maxagi; agno++) { diff --git a/repair/agheader.c b/repair/agheader.c index 8bb99489..2af24106 100644 --- a/repair/agheader.c +++ b/repair/agheader.c @@ -452,6 +452,27 @@ secondary_sb_whack( rval |= XR_AG_SB_SEC; } + if (xfs_sb_version_needsrepair(sb)) { + if (i == 0) { + if (!no_modify) + do_warn( + _("clearing needsrepair flag and regenerating metadata\n")); + else + do_warn( + _("would clear needsrepair flag and regenerate metadata\n")); + } else { + /* + * Quietly clear needsrepair on the secondary supers as + * part of ensuring them. If needsrepair is set on the + * primary, it will be cleared at the end of repair + * once we've flushed all other dirty blocks to disk. + */ + sb->sb_features_incompat &= + ~XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR; + rval |= XR_AG_SB_SEC; + } + } + return(rval); } diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 40352458..90d1a95a 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -712,6 +712,45 @@ check_fs_vs_host_sectsize( } } +/* Clear needsrepair after a successful repair run. */ +void +clear_needsrepair( + struct xfs_mount *mp) +{ + struct xfs_buf *bp; + int error; + + /* + * If we're going to clear NEEDSREPAIR, we need to make absolutely sure + * that everything is ok with the ondisk filesystem. Make sure any + * dirty buffers are sent to disk and that the disks have persisted + * writes to stable storage. If that fails, leave NEEDSREPAIR in + * place. Don't purge the buffer cache here since we're not done yet. + */ + error = -libxfs_flush_mount(mp); + if (error) { + do_warn( + _("Cannot clear needsrepair due to flush failure, err=%d.\n"), + error); + return; + } + + /* Clear needsrepair from the superblock. */ + bp = libxfs_getsb(mp); + if (!bp || bp->b_error) { + do_warn( + _("Cannot clear needsrepair from primary super, err=%d.\n"), + bp ? bp->b_error : ENOMEM); + } else { + mp->m_sb.sb_features_incompat &= + ~XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR; + libxfs_sb_to_disk(bp->b_addr, &mp->m_sb); + libxfs_buf_mark_dirty(bp); + } + if (bp) + libxfs_buf_relse(bp); +} + int main(int argc, char **argv) { @@ -1128,6 +1167,9 @@ _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\ libxfs_bcache_flush(); format_log_max_lsn(mp); + if (xfs_sb_version_needsrepair(&mp->m_sb)) + clear_needsrepair(mp); + /* Report failure if anything failed to get written to our fs. */ error = -libxfs_umount(mp); if (error) From patchwork Thu Feb 11 22:59:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5299C43381 for ; Thu, 11 Feb 2021 23:00:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85F4E64E44 for ; Thu, 11 Feb 2021 23:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbhBKXAe (ORCPT ); Thu, 11 Feb 2021 18:00:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:46168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhBKXAa (ORCPT ); Thu, 11 Feb 2021 18:00:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B73264E3E; Thu, 11 Feb 2021 22:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084387; bh=JIjujzwOwioXYa0QvpDSb1avGGS4+UIpCW9MhPrIK+U=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=aU66UZHDzeLZEQ+6E8qA/cL89EinJhCh3oZbCVtlNmZ2nVdbSn+KgJ2dfhTstoU3i DX3OKiaSFRChCtq7EKF5N4SNGu/cjp4D20Dwj/7sgK7lG097JG5d0cm6QjePlRtgVl 5Mkmxe34WAE5hBkoBMgYDwQ/niCVQpFNOssTvy2SChASHdTImaAL/rug5sDUyCvBA+ sQHO+6RYLxHakOSH8HoagcZEKMgLqB4hhggcIq7FjGGkr7aa9HXZ2ioOFQLjvZEtSN EqywluIPavrpCr2V6gyDWcceUfIgiDTdayX0qdPWqEz9+QJxjE02w/2/MvuQLj7zbu cmxfksvV1uxGA== Subject: [PATCH 08/11] xfs_repair: allow setting the needsrepair flag From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , Brian Foster , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:46 -0800 Message-ID: <161308438691.3850286.3501696811159590596.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Quietly set up the ability to tell xfs_repair to set NEEDSREPAIR at program start and (presumably) clear it by the end of the run. This code isn't terribly useful to users; it's mainly here so that fstests can exercise the functionality. We don't document this flag in the manual pages at all because repair clears needsrepair at exit, which means the knobs only exist for fstests to exercise the functionality. Note that we can't do any of these upgrades until we've at least done a preliminary scan of the primary super and the log. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster --- repair/globals.c | 2 ++ repair/globals.h | 2 ++ repair/phase2.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ repair/xfs_repair.c | 9 +++++++ 4 files changed, 76 insertions(+) diff --git a/repair/globals.c b/repair/globals.c index 110d98b6..699a96ee 100644 --- a/repair/globals.c +++ b/repair/globals.c @@ -49,6 +49,8 @@ int rt_spec; /* Realtime dev specified as option */ int convert_lazy_count; /* Convert lazy-count mode on/off */ int lazy_count; /* What to set if to if converting */ +bool add_needsrepair; /* forcibly set needsrepair while repairing */ + /* misc status variables */ int primary_sb_modified; diff --git a/repair/globals.h b/repair/globals.h index 1d397b35..043b3e8e 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -90,6 +90,8 @@ extern int rt_spec; /* Realtime dev specified as option */ extern int convert_lazy_count; /* Convert lazy-count mode on/off */ extern int lazy_count; /* What to set if to if converting */ +extern bool add_needsrepair; + /* misc status variables */ extern int primary_sb_modified; diff --git a/repair/phase2.c b/repair/phase2.c index 952ac4a5..9a8d42e1 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -131,6 +131,63 @@ zero_log( libxfs_max_lsn = log->l_last_sync_lsn; } +static bool +set_needsrepair( + struct xfs_mount *mp) +{ + if (!xfs_sb_version_hascrc(&mp->m_sb)) { + printf( + _("needsrepair flag only supported on V5 filesystems.\n")); + exit(0); + } + + if (xfs_sb_version_needsrepair(&mp->m_sb)) { + printf(_("Filesystem already marked as needing repair.\n")); + exit(0); + } + + printf(_("Marking filesystem in need of repair.\n")); + mp->m_sb.sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR; + return true; +} + +/* Perform the user's requested upgrades on filesystem. */ +static void +upgrade_filesystem( + struct xfs_mount *mp) +{ + struct xfs_buf *bp; + bool dirty = false; + int error; + + if (add_needsrepair) + dirty |= set_needsrepair(mp); + + if (no_modify || !dirty) + return; + + bp = libxfs_getsb(mp); + if (!bp || bp->b_error) { + do_error( + _("couldn't get superblock for feature upgrade, err=%d\n"), + bp ? bp->b_error : ENOMEM); + } else { + libxfs_sb_to_disk(bp->b_addr, &mp->m_sb); + + /* + * Write the primary super to disk immediately so that + * needsrepair will be set if repair doesn't complete. + */ + error = -libxfs_bwrite(bp); + if (error) + do_error( + _("filesystem feature upgrade failed, err=%d\n"), + error); + } + if (bp) + libxfs_buf_relse(bp); +} + /* * ok, at this point, the fs is mounted but the root inode may be * trashed and the ag headers haven't been checked. So we have @@ -235,4 +292,10 @@ phase2( do_warn(_("would correct\n")); } } + + /* + * Upgrade the filesystem now that we've done a preliminary check of + * the superblocks, the AGs, the log, and the metadata inodes. + */ + upgrade_filesystem(mp); } diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 90d1a95a..a613505f 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -65,11 +65,13 @@ static char *o_opts[] = { */ enum c_opt_nums { CONVERT_LAZY_COUNT = 0, + CONVERT_NEEDSREPAIR, C_MAX_OPTS, }; static char *c_opts[] = { [CONVERT_LAZY_COUNT] = "lazycount", + [CONVERT_NEEDSREPAIR] = "needsrepair", [C_MAX_OPTS] = NULL, }; @@ -302,6 +304,13 @@ process_args(int argc, char **argv) lazy_count = (int)strtol(val, NULL, 0); convert_lazy_count = 1; break; + case CONVERT_NEEDSREPAIR: + if (!val) + do_abort( + _("-c needsrepair requires a parameter\n")); + if (strtol(val, NULL, 0) == 1) + add_needsrepair = true; + break; default: unknown('c', val); break; From patchwork Thu Feb 11 22:59:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C15E2C433E0 for ; Thu, 11 Feb 2021 23:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F68864E3E for ; Thu, 11 Feb 2021 23:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229960AbhBKXAo (ORCPT ); Thu, 11 Feb 2021 18:00:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:46230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbhBKXAg (ORCPT ); Thu, 11 Feb 2021 18:00:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E4C964E56; Thu, 11 Feb 2021 22:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084393; bh=mqUbxIPBUA/n7QCoXV1GrEjb+C10PTYhbrk4IEF2qx8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Hu+8+ucd2C0tCeAQqRZGBTwH1hFoE/NRFqdDqtlrVWNYv+zMDKERAEjp39UNeeBTz D0zC8ObVhAw3/W8EVI5dbn8SXx1Vs71JgBM5KfEcKD6CD0aF1Iff264ll0fwAPzD7a 4mcmZvyCkr3aN843cmn6lWvP96jgt/gABEIYhyfT49h8EynZNjVsmlvkZUCH0mWCXw cnye76Pe3x+Ru4Z2liQaiM4rEizeVr+EtVPkOElnohD4HnSkM4qeHFt/KPd9+iSRFd t9AfffHsGKAlhbDam0pQXCgmV/9Ch94lPsZ7dwWzc2dXw1mew+apaXWCwmskK2f2s9 sgMjymZe2i4gA== Subject: [PATCH 09/11] xfs_repair: add a testing hook for NEEDSREPAIR From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:52 -0800 Message-ID: <161308439253.3850286.5243500865602980663.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Simulate a crash when anyone calls force_needsrepair. This is a debug knob so that we can test that the kernel won't mount after setting needsrepair and that a re-run of xfs_repair will clear the flag. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- repair/globals.c | 1 + repair/globals.h | 2 ++ repair/phase2.c | 4 ++++ repair/xfs_repair.c | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/repair/globals.c b/repair/globals.c index 699a96ee..b0e23864 100644 --- a/repair/globals.c +++ b/repair/globals.c @@ -40,6 +40,7 @@ int dangerously; /* live dangerously ... fix ro mount */ int isa_file; int zap_log; int dumpcore; /* abort, not exit on fatal errs */ +bool abort_after_force_needsrepair; int force_geo; /* can set geo on low confidence info */ int assume_xfs; /* assume we have an xfs fs */ char *log_name; /* Name of log device */ diff --git a/repair/globals.h b/repair/globals.h index 043b3e8e..9fa73b2c 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -82,6 +82,8 @@ extern int isa_file; extern int zap_log; extern int dumpcore; /* abort, not exit on fatal errs */ extern int force_geo; /* can set geo on low confidence info */ +/* Abort after forcing NEEDSREPAIR to test its functionality */ +extern bool abort_after_force_needsrepair; extern int assume_xfs; /* assume we have an xfs fs */ extern char *log_name; /* Name of log device */ extern int log_spec; /* Log dev specified as option */ diff --git a/repair/phase2.c b/repair/phase2.c index 9a8d42e1..177e0831 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -183,6 +183,10 @@ upgrade_filesystem( do_error( _("filesystem feature upgrade failed, err=%d\n"), error); + + /* Simulate a crash after setting needsrepair. */ + if (abort_after_force_needsrepair) + exit(55); } if (bp) libxfs_buf_relse(bp); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index a613505f..293d89b1 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -44,6 +44,7 @@ enum o_opt_nums { BLOAD_LEAF_SLACK, BLOAD_NODE_SLACK, NOQUOTA, + FORCE_NEEDSREPAIR_ABORT, O_MAX_OPTS, }; @@ -57,6 +58,7 @@ static char *o_opts[] = { [BLOAD_LEAF_SLACK] = "debug_bload_leaf_slack", [BLOAD_NODE_SLACK] = "debug_bload_node_slack", [NOQUOTA] = "noquota", + [FORCE_NEEDSREPAIR_ABORT] = "debug_force_needsrepair_abort", [O_MAX_OPTS] = NULL, }; @@ -282,6 +284,9 @@ process_args(int argc, char **argv) _("-o debug_bload_node_slack requires a parameter\n")); bload_node_slack = (int)strtol(val, NULL, 0); break; + case FORCE_NEEDSREPAIR_ABORT: + abort_after_force_needsrepair = true; + break; case NOQUOTA: quotacheck_skip(); break; From patchwork Thu Feb 11 22:59:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E051EC433E9 for ; Thu, 11 Feb 2021 23:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4BF464E42 for ; Thu, 11 Feb 2021 23:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbhBKXAo (ORCPT ); Thu, 11 Feb 2021 18:00:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:46260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbhBKXAj (ORCPT ); Thu, 11 Feb 2021 18:00:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0129A64E3D; Thu, 11 Feb 2021 22:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084399; bh=0ikUNpWOhr8TgUcd+BFDwk+S5osJ1K5XlekiDPZ7Xt0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=OWGLup7TA8qU3ebXIfpTs8Zcapn3DjKIr6ExZjGc6c1LFkqNzJG2K59liZxzCj/Al J+1RTC9ODDJC/wkCDl4ndht3GHamhTgJQQBeBXfp40MM3tIgIcvuHQLXUGt05pNIVl n3oyjzIF4SRfMyojhJKRH3AwO65z45esDGD7hQ+os8ws6SfKhAa6zvd+7Wzxi/HrV3 Br1is+k331LuqimfIW3ZHjg0WoWMsmc7nPF6KDEC7/kXL/LRJklyfBlmDBZZBkKDsT h7infSf+KCuoUb1SbCDnDKwaUdkw+TlWk3N/+ZvDt8nbfAjrhsrkH0YjLtmqRwP0wk 5bM8GlHJTPjlw== Subject: [PATCH 10/11] xfs_admin: support adding features to V5 filesystems From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 14:59:58 -0800 Message-ID: <161308439838.3850286.2084912955688223044.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Teach the xfs_admin script how to add features to V5 filesystems. Technically speaking we could add lazycount to the list, but that option is only useful for the V4 format which is deprecated. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/xfs_admin.sh | 6 ++++-- man/man8/xfs_admin.8 | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh index 430872ef..7a467dbe 100755 --- a/db/xfs_admin.sh +++ b/db/xfs_admin.sh @@ -8,9 +8,10 @@ status=0 DB_OPTS="" REPAIR_OPTS="" REPAIR_DEV_OPTS="" -USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-r rtdev] [-U uuid] device [logdev]" +DB_LOG_OPTS="" +USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-O v5_feature] [-r rtdev] [-U uuid] device [logdev]" -while getopts "c:efjlL:pr:uU:V" c +while getopts "c:efjlL:O:pr:uU:V" c do case $c in c) REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;; @@ -19,6 +20,7 @@ do j) DB_OPTS=$DB_OPTS" -c 'version log2'";; l) DB_OPTS=$DB_OPTS" -r -c label";; L) DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";; + O) REPAIR_OPTS=$REPAIR_OPTS" -c $OPTARG=1";; p) DB_OPTS=$DB_OPTS" -c 'version projid32bit'";; r) REPAIR_DEV_OPTS=" -r '$OPTARG'";; u) DB_OPTS=$DB_OPTS" -r -c uuid";; diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index cccbb224..055a502a 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -6,6 +6,8 @@ xfs_admin \- change parameters of an XFS filesystem [ .B \-eflpu ] [ +.BI \-O " featurelist" +] [ .BR "\-c 0" | 1 ] [ .B \-L @@ -106,6 +108,26 @@ The filesystem label can be cleared using the special "\c " value for .IR label . .TP +.BI \-O " feature1" = "status" , "feature2" = "status..." +Add or remove features on an existing V5 filesystem. +The features should be specified as a comma-separated list. +.I status +should be either 0 to disable the feature or 1 to enable the feature. +Note, however, that most features cannot be disabled. +.IP +.B NOTE: +Administrators must ensure the filesystem is clean by running +.B xfs_repair -n +to inspect the filesystem before performing the upgrade. +If corruption is found, recovery procedures (e.g. reformat followed by +restoration from backup; or running +.B xfs_repair +without the +.BR -n ) +must be followed to clean the filesystem. +.IP +There are currently no feature options. +.TP .BI \-U " uuid" Set the UUID of the filesystem to .IR uuid . From patchwork Thu Feb 11 23:00:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12084343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 049A8C433E6 for ; Thu, 11 Feb 2021 23:01:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA0BE64E3D for ; Thu, 11 Feb 2021 23:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbhBKXAt (ORCPT ); Thu, 11 Feb 2021 18:00:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:46388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbhBKXAp (ORCPT ); Thu, 11 Feb 2021 18:00:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6E2464E42; Thu, 11 Feb 2021 23:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613084404; bh=TV1mSUbbsX7PqotkP5J3piXutJZ5GX45hm6y3jEWHKI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=llbiZn7m8RSHAsfzl0Vv1uV5Dwe5E+soqFpSFZOWRSseo+NkCSVn42YqjywTiCB9Q 4BtL6MGoSVgCcHTvRm2taxNtOkk1eiIWnkolD06aaNrUigigZzZtTa5mhK81haUiFU uOnXhzbA5VaIfVtpvSKgQ3Mll6ZIPFBLApJRoBH0+eRT6sWlWeAk2F4zL/ANEkyTG1 SBN7IR4oXrnyKTNwnUCAUZNBvN6v4CbCYJ46/eoDPXSwAMlp7zMxcn0xIiM6x0siGa 2A2xarzBzWcGVj/eq99XLonIOus8lxEmDA1HY5MVWKqWkPsqSEL1eh+5EANMovLwx+ UF9K21im40pFQ== Subject: [PATCH 11/11] man: mark all deprecated V4 format options From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Thu, 11 Feb 2021 15:00:04 -0800 Message-ID: <161308440412.3850286.3647885169553854136.stgit@magnolia> In-Reply-To: <161308434132.3850286.13801623440532587184.stgit@magnolia> References: <161308434132.3850286.13801623440532587184.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Update the manual pages for the most popular tools to note which options are only useful with the V4 XFS format, and that the V4 format is deprecated and will be removed no later than September 2030. Signed-off-by: Darrick J. Wong --- man/man8/mkfs.xfs.8 | 16 ++++++++++++++++ man/man8/xfs_admin.8 | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index fac82d74..df25abaa 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -223,6 +223,11 @@ of calculating and checking the CRCs is not noticeable in normal operation. By default, .B mkfs.xfs will enable metadata CRCs. +.IP +Formatting a filesystem without CRCs selects the V4 format, which is deprecated +and will be removed from upstream in September 2030. +Distributors may choose to withdraw support for the V4 format earlier than +this date. .TP .BI finobt= value This option enables the use of a separate free inode btree index in each @@ -592,6 +597,8 @@ This option can be used to turn off inode alignment when the filesystem needs to be mountable by a version of IRIX that does not have the inode alignment feature (any release of IRIX before 6.2, and IRIX 6.2 without XFS patches). +.IP +This option only applies to the deprecated V4 format. .TP .BI attr= value This is used to specify the version of extended attribute inline @@ -602,6 +609,8 @@ between attribute and extent data. The previous version 1, which has fixed regions for attribute and extent data, is kept for backwards compatibility with kernels older than version 2.6.16. +.IP +This option only applies to the deprecated V4 format. .TP .BI projid32bit[= value ] This is used to enable 32bit quota project identifiers. The @@ -609,6 +618,8 @@ This is used to enable 32bit quota project identifiers. The is either 0 or 1, with 1 signifying that 32bit projid are to be enabled. If the value is omitted, 1 is assumed. (This default changed in release version 3.2.0.) +.IP +This option only applies to the deprecated V4 format. .TP .BI sparse[= value ] Enable sparse inode chunk allocation. The @@ -690,6 +701,7 @@ stripe-aligned log writes (see the sunit and su options, below). The previous version 1, which is limited to 32k log buffers and does not support stripe-aligned writes, is kept for backwards compatibility with very old 2.4 kernels. +This option only applies to the deprecated V4 format. .TP .BI sunit= value This specifies the alignment to be used for log writes. The @@ -744,6 +756,8 @@ is 1 (on) so you must specify .B lazy-count=0 if you want to disable this feature for older kernels which don't support it. +.IP +This option only applies to the deprecated V4 format. .RE .PP .PD 0 @@ -803,6 +817,8 @@ will be stored in the directory structure. The default value is 1. When CRCs are enabled (the default), the ftype functionality is always enabled, and cannot be turned off. .IP +This option only applies to the deprecated V4 format. +.IP .RE .TP .BI \-p " protofile" diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index 055a502a..be5c189f 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -56,6 +56,8 @@ for a detailed description of the XFS log. Enables unwritten extent support on a filesystem that does not already have this enabled (for legacy filesystems, it can't be disabled anymore at mkfs time). +.IP +This option only applies to the deprecated V4 format. .TP .B \-f Specifies that the filesystem image to be processed is stored in a @@ -69,12 +71,16 @@ option). .B \-j Enables version 2 log format (journal format supporting larger log buffers). +.IP +This option only applies to the deprecated V4 format. .TP .B \-l Print the current filesystem label. .TP .B \-p Enable 32bit project identifier support (PROJID32BIT feature). +.IP +This option only applies to the deprecated V4 format. .TP .B \-u Print the current filesystem UUID (Universally Unique IDentifier). @@ -85,6 +91,8 @@ Enable (1) or disable (0) lazy-counters in the filesystem. Lazy-counters may not be disabled on Version 5 superblock filesystems (i.e. those with metadata CRCs enabled). .IP +In other words, this option only applies to the deprecated V4 format. +.IP This operation may take quite a bit of time on large filesystems as the entire filesystem needs to be scanned when this option is changed. .IP @@ -94,6 +102,8 @@ information is kept in other parts of the filesystem to be able to maintain the counter values without needing to keep them in the superblock. This gives significant improvements in performance on some configurations and metadata intensive workloads. +.IP +This option only applies to the deprecated V4 format. .TP .BI \-L " label" Set the filesystem label to