From patchwork Thu Oct 8 15:02:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11823151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E2086CA for ; Thu, 8 Oct 2020 15:04:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1152A21789 for ; Thu, 8 Oct 2020 15:04:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="vCq35kyk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730697AbgJHPET (ORCPT ); Thu, 8 Oct 2020 11:04:19 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:42394 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730685AbgJHPET (ORCPT ); Thu, 8 Oct 2020 11:04:19 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098ExnVp184583; Thu, 8 Oct 2020 15:04:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=lYYy72dMYtyAC9+oC+yYYAvL0nf5a0gxergGOr8uvcE=; b=vCq35kykJU28wXyqM4L5EvoGfTNAcLKNb4WkTvg17eJ6thWrLaO0hdnH6Lok1sVk+ERp H8ScjVvBtOGHYFnFluhAdajiQMe+ill9Td+GVKponXhkVRAES/zizXKPmONh7iTDg6UW szr6g9AkMpJbHAShAaPHIfNWc5eYsPIGAhFWdUoH6prq7Y0ehl9rMYJII7x2n+aTVbxu m4X5b+o1CxhStguQ67/C1y6EDMRZqhqv+9/3YnM+937xmzAuXZMP++Ql1+97EXoDy7b/ OGspEFPyOk/qyfXfT3q5YNlEFl0OmPkDYqFuGUxUE8ubo60l31JsRYXb2Xaw1GNzvt2j lA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 33xhxn850t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 08 Oct 2020 15:04:13 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098F0w8x054247; Thu, 8 Oct 2020 15:02:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 3410k1923q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Oct 2020 15:02:12 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 098F2Bjs022380; Thu, 8 Oct 2020 15:02:11 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Oct 2020 08:02:11 -0700 Subject: [PATCH 1/3] xfs: fix realtime bitmap/summary file truncation when growing rt volume From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: Chandan Babu R , linux-xfs@vger.kernel.org, chandanrlinux@gmail.com, sandeen@redhat.com Date: Thu, 08 Oct 2020 08:02:10 -0700 Message-ID: <160216933049.313389.12083508204520272104.stgit@magnolia> In-Reply-To: <160216932411.313389.9231180037053830573.stgit@magnolia> References: <160216932411.313389.9231180037053830573.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9767 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=1 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9768 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=1 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The realtime bitmap and summary files are regular files that are hidden away from the directory tree. Since they're regular files, inode inactivation will try to purge what it thinks are speculative preallocations beyond the incore size of the file. Unfortunately, xfs_growfs_rt forgets to update the incore size when it resizes the inodes, with the result that inactivating the rt inodes at unmount time will cause their contents to be truncated. Fix this by updating the incore size when we change the ondisk size as part of updating the superblock. Note that we don't do this when we're allocating blocks to the rt inodes because we actually want those blocks to get purged if the growfs fails. This fixes corruption complaints from the online rtsummary checker when running xfs/233. Since that test requires rmap, one can also trigger this by growing an rt volume, cycling the mount, and creating rt files. Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/xfs_rtalloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 9d4e33d70d2a..1c3969807fb9 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -1027,10 +1027,13 @@ xfs_growfs_rt( xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL); /* - * Update the bitmap inode's size. + * Update the bitmap inode's size ondisk and incore. We need + * to update the incore size so that inode inactivation won't + * punch what it thinks are "posteof" blocks. */ mp->m_rbmip->i_d.di_size = nsbp->sb_rbmblocks * nsbp->sb_blocksize; + i_size_write(VFS_I(mp->m_rbmip), mp->m_rbmip->i_d.di_size); xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE); /* * Get the summary inode into the transaction. @@ -1038,9 +1041,12 @@ xfs_growfs_rt( xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, mp->m_rsumip, XFS_ILOCK_EXCL); /* - * Update the summary inode's size. + * Update the summary inode's size. We need to update the + * incore size so that inode inactivation won't punch what it + * thinks are "posteof" blocks. */ mp->m_rsumip->i_d.di_size = nmp->m_rsumsize; + i_size_write(VFS_I(mp->m_rsumip), mp->m_rsumip->i_d.di_size); xfs_trans_log_inode(tp, mp->m_rsumip, XFS_ILOG_CORE); /* * Copy summary data from old to new sizes. From patchwork Thu Oct 8 15:02:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11823147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D9BE614D5 for ; Thu, 8 Oct 2020 15:02:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B086820782 for ; Thu, 8 Oct 2020 15:02:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="a40LyQqb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730757AbgJHPCY (ORCPT ); Thu, 8 Oct 2020 11:02:24 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:43846 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730697AbgJHPCY (ORCPT ); Thu, 8 Oct 2020 11:02:24 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098F0RuA158382; Thu, 8 Oct 2020 15:02:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=bnTMUVY0nKmxXNm0tm2ZViUAkInTgVseBfjcYvSi8/U=; b=a40LyQqbSXJsZFOXJMg4rRuDKEyxlleoXmv1KI9XsrPo7AwxZJZMKmRPIbsuReIqx+24 bLrbls6cCKIq86ft1AcgfP0/kx5GHs8MM5clwx5+0YM3Yf+y5tECfULC2UHqBrRM1r62 Y1oStEwYouxld55MbRjx1gS7rbKY+x4QHrNqYcJ37joVgwQ5LhnCv0Tcwpuq0nnisGdk ZmsQKiMTpAAp0ZyddtsvFDDClUnjRAwgmoV+YnuBmXNz6EK/6l6Eu04WrRpz46PfGoXf I8INEsOkXZpW8qOmdLu63pDoFUyC7qxYCA6b3hjvQ2uN1tXIoAQnObk7TNFrmXYVWXm3 yQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 33xetb8cf6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 08 Oct 2020 15:02:19 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098F1Gp9017171; Thu, 8 Oct 2020 15:02:19 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 341xnbt3qq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Oct 2020 15:02:19 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 098F2IEh023947; Thu, 8 Oct 2020 15:02:18 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Oct 2020 08:02:17 -0700 Subject: [PATCH 2/3] xfs: make xfs_growfs_rt update secondary superblocks From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, chandanrlinux@gmail.com, sandeen@redhat.com Date: Thu, 08 Oct 2020 08:02:17 -0700 Message-ID: <160216933700.313389.9746852330724569803.stgit@magnolia> In-Reply-To: <160216932411.313389.9231180037053830573.stgit@magnolia> References: <160216932411.313389.9231180037053830573.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9768 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=3 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9767 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 malwarescore=0 suspectscore=3 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong When we call growfs on the data device, we update the secondary superblocks to reflect the updated filesystem geometry. We need to do this for growfs on the realtime volume too, because a future xfs_repair run could try to fix the filesystem using a backup superblock. This was observed by the online superblock scrubbers while running xfs/233. One can also trigger this by growing an rt volume, cycling the mount, and creating new rt files. Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_rtalloc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 1c3969807fb9..9de83723462c 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -18,7 +18,7 @@ #include "xfs_trans_space.h" #include "xfs_icache.h" #include "xfs_rtalloc.h" - +#include "xfs_sb.h" /* * Read and return the summary information for a given extent size, @@ -1102,7 +1102,15 @@ xfs_growfs_rt( if (error) break; } + if (error) + goto out_free; + /* Update secondary superblocks now the physical grow has completed */ + error = xfs_update_secondary_sbs(mp); + if (error) + return error; + +out_free: /* * Free the fake mp structure. */ From patchwork Thu Oct 8 15:02:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11823149 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A981E14D5 for ; Thu, 8 Oct 2020 15:02:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EC1A20782 for ; Thu, 8 Oct 2020 15:02:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="YpV7Co/E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730741AbgJHPCc (ORCPT ); Thu, 8 Oct 2020 11:02:32 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:40852 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730697AbgJHPCb (ORCPT ); Thu, 8 Oct 2020 11:02:31 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098Exntl184471; Thu, 8 Oct 2020 15:02:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=nsOF70tKCoIGu5DEEOdctCTkzewjtfvweIVqXNHTZlI=; b=YpV7Co/Ep48q+ykmdgywLD9gmC1GTvb5/QflAAWHAvuoNlv9poLf5YJgZ6bJlfSGAqwi iNwQJ4rRaa5S0nK8zbdTQYDYP1OOrdiq6BPcMh494xnj2/kjMUYv3V1GYvThbxVALfA9 8WYhuGZUeNUFN8nB8Dg3M3srJsIPvYLtKMAw56CcS0F3k9orZ9gsA4jcII//NM9dYws/ eG5ctMLgz9t9Ho/DGIS/GhPEuM/sk1BDy/4xpGRud64k/iqB6hzzEEtst0rKOK2FgQXL xwfwrmnmhajPkXoknyt8xHMhVLflUFV7q/IzXu5SYN1bCG65/4uriRbUACdciWPaNsdw UA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 33xhxn84n8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 08 Oct 2020 15:02:26 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098F1NpU079157; Thu, 8 Oct 2020 15:02:25 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 33y2vr5d8d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Oct 2020 15:02:25 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 098F2OCp012561; Thu, 8 Oct 2020 15:02:24 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Oct 2020 08:02:24 -0700 Subject: [PATCH 3/3] xfs: annotate grabbing the realtime bitmap/summary locks in growfs From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, chandanrlinux@gmail.com, sandeen@redhat.com Date: Thu, 08 Oct 2020 08:02:23 -0700 Message-ID: <160216934339.313389.7386951309252031696.stgit@magnolia> In-Reply-To: <160216932411.313389.9231180037053830573.stgit@magnolia> References: <160216932411.313389.9231180037053830573.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9767 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=1 spamscore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9768 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=1 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Use XFS_ILOCK_RT{BITMAP,SUM} to annotate grabbing the rt bitmap and summary locks when we grow the realtime volume, just like we do most everywhere else. This shuts up lockdep warnings about grabbing the ILOCK class of locks recursively: ============================================ WARNING: possible recursive locking detected 5.9.0-rc4-djw #rc4 Tainted: G O -------------------------------------------- xfs_growfs/4841 is trying to acquire lock: ffff888035acc230 (&xfs_nondir_ilock_class){++++}-{3:3}, at: xfs_ilock+0xac/0x1a0 [xfs] but task is already holding lock: ffff888035acedb0 (&xfs_nondir_ilock_class){++++}-{3:3}, at: xfs_ilock+0xac/0x1a0 [xfs] other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&xfs_nondir_ilock_class); lock(&xfs_nondir_ilock_class); *** DEADLOCK *** May be due to missing lock nesting notation Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_rtalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 9de83723462c..678af4201699 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -1024,7 +1024,7 @@ xfs_growfs_rt( /* * Lock out other callers by grabbing the bitmap inode lock. */ - xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); + xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL | XFS_ILOCK_RTBITMAP); xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL); /* * Update the bitmap inode's size ondisk and incore. We need @@ -1038,7 +1038,7 @@ xfs_growfs_rt( /* * Get the summary inode into the transaction. */ - xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL); + xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL | XFS_ILOCK_RTSUM); xfs_trans_ijoin(tp, mp->m_rsumip, XFS_ILOCK_EXCL); /* * Update the summary inode's size. We need to update the From patchwork Thu Oct 8 15:05:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11823157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 522FE17E6 for ; Thu, 8 Oct 2020 15:05:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CC1021941 for ; Thu, 8 Oct 2020 15:05:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="BuKBjP+G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730841AbgJHPF5 (ORCPT ); Thu, 8 Oct 2020 11:05:57 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47374 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729833AbgJHPF5 (ORCPT ); Thu, 8 Oct 2020 11:05:57 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098F0FDd158194; Thu, 8 Oct 2020 15:05:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=xw7i5l+Ibg11/qQXDO8qXOvi0UlQywT6rtY/GcQXrJY=; b=BuKBjP+GlIuyYSgEcjFQe98WbV9HE0VjMuPf8+/GFMIZnMmySrHSOzZVGuYT+ptQzSLH FXL4TRJoHHYPh8NufajmkvTX3UYCPnsFmQGNMjdAr8vbQnhP4J+EeXcdfJ2pQzpsR8kd tpG4fuN5U2anDmU3n9M1WKJ9GRygH3bvWWtiFkQgQkLwvEn7od9zXQ+aCn47fBkxhxV7 jqy0RdqMA92rf2o8RGmIV1GJZNbhOOKGTYF5NRKMtudTkCNbIc4M8an15K/ZBfyG3c+m sTZEqlDvF0OLGMBvODqErfJBIED7ZyvbDRcKEUyELWQNfDKqnsRMK40Z6Lw60Mi3j7EU 8g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 33xetb8d5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 08 Oct 2020 15:05:53 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 098F0wjL054125; Thu, 8 Oct 2020 15:05:53 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 3410k1973k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Oct 2020 15:05:53 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 098F5qDT005308; Thu, 8 Oct 2020 15:05:52 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Oct 2020 08:05:52 -0700 Date: Thu, 8 Oct 2020 08:05:51 -0700 From: "Darrick J. Wong" To: Eryu Guan Cc: Chandan Babu R , linux-xfs@vger.kernel.org, sandeen@redhat.com, fstests Subject: [PATCH 4/3] xfstest: test running growfs on the realtime volume Message-ID: <20201008150551.GM6540@magnolia> References: <160216932411.313389.9231180037053830573.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <160216932411.313389.9231180037053830573.stgit@magnolia> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9767 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=1 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9767 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 malwarescore=0 suspectscore=1 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010080115 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Make sure that we can run growfs to expand the realtime volume without it blowing up. This is a regression test for the following patches: xfs: Set xfs_buf type flag when growing summary/bitmap files xfs: Set xfs_buf's b_ops member when zeroing bitmap/summary files xfs: fix realtime bitmap/summary file truncation when growing rt volume xfs: make xfs_growfs_rt update secondary superblocks xfs: annotate grabbing the realtime bitmap/summary locks in growfs Because the xfs maintainer realized that no, we have no tests for this particular piece of functionality. Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- tests/xfs/916 | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/916.out | 10 ++++++ tests/xfs/group | 1 + 3 files changed, 93 insertions(+) create mode 100755 tests/xfs/916 create mode 100644 tests/xfs/916.out diff --git a/tests/xfs/916 b/tests/xfs/916 new file mode 100755 index 00000000..cde00314 --- /dev/null +++ b/tests/xfs/916 @@ -0,0 +1,82 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 916 +# +# Tests xfs_growfs on the realtime volume to make sure none of it blows up. +# This is a regression test for the following patches: +# +# xfs: Set xfs_buf type flag when growing summary/bitmap files +# xfs: Set xfs_buf's b_ops member when zeroing bitmap/summary files +# xfs: fix realtime bitmap/summary file truncation when growing rt volume +# xfs: make xfs_growfs_rt update secondary superblocks +# xfs: annotate grabbing the realtime bitmap/summary locks in growfs +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + _scratch_unmount >> $seqres.full 2>&1 + test -e "$rtdev" && losetup -d $rtdev >> $seqres.full 2>&1 + rm -f $tmp.* $TEST_DIR/$seq.rtvol +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs xfs +# Note that we don't _require_realtime because we synthesize a rt volume +# below. +_require_scratch_nocheck +_require_no_large_scratch_dev + +echo "Create fake rt volume" +truncate -s 400m $TEST_DIR/$seq.rtvol +rtdev=$(_create_loop_device $TEST_DIR/$seq.rtvol) + +echo "Format and mount 100m rt volume" +export USE_EXTERNAL=yes +export SCRATCH_RTDEV=$rtdev +_scratch_mkfs -r size=100m > $seqres.full +_scratch_mount || _notrun "Could not mount scratch with synthetic rt volume" + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Check rt volume stats" +$XFS_IO_PROG -c 'chattr +t' $testdir +$XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full +before=$(stat -f -c '%b' $testdir) + +echo "Create some files" +_pwrite_byte 0x61 0 1m $testdir/original >> $seqres.full + +echo "Grow fs" +$XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 | _filter_growfs >> $seqres.full +_scratch_cycle_mount + +echo "Recheck 400m rt volume stats" +$XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full +after=$(stat -f -c '%b' $testdir) +_within_tolerance "rt volume size" $after $((before * 4)) 5% -v + +echo "Create more copies to make sure the bitmap really works" +cp -p $testdir/original $testdir/copy3 + +echo "Check filesystem" +_check_xfs_filesystem $SCRATCH_DEV none $rtdev + +# success, all done +status=0 +exit diff --git a/tests/xfs/916.out b/tests/xfs/916.out new file mode 100644 index 00000000..55f2356a --- /dev/null +++ b/tests/xfs/916.out @@ -0,0 +1,10 @@ +QA output created by 916 +Create fake rt volume +Format and mount 100m rt volume +Check rt volume stats +Create some files +Grow fs +Recheck 400m rt volume stats +rt volume size is in range +Create more copies to make sure the bitmap really works +Check filesystem diff --git a/tests/xfs/group b/tests/xfs/group index ef375397..4e58b5cc 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -549,6 +549,7 @@ 910 auto quick inobtcount 911 auto quick bigtime 915 auto quick quota +916 auto quick realtime growfs 1202 auto quick swapext 1208 auto quick swapext 1500 dangerous_fuzzers dangerous_bothrepair