From patchwork Mon Oct 1 17:04:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10622439 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 60433112B for ; Mon, 1 Oct 2018 17:04:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AF16212D6 for ; Mon, 1 Oct 2018 17:04:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E65F21BED; Mon, 1 Oct 2018 17:04:44 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 D81D4212D6 for ; Mon, 1 Oct 2018 17:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725994AbeJAXn1 (ORCPT ); Mon, 1 Oct 2018 19:43:27 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47198 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbeJAXn1 (ORCPT ); Mon, 1 Oct 2018 19:43:27 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w91H4GIT012057; Mon, 1 Oct 2018 17:04:39 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-2018-07-02; bh=HQLzzjDeuX4+fQeGzfZq2i8jJHxUEaBPVzpw+5iCLs4=; b=arDqWofAz1kVaULxfYc23pzQGxO036tlmNBw3HUStvI7eNVKJWFKYiPrRZMHqp5oflf/ LqKawnQRmMDo7+0Aapt/vem/6DdH9xzdH23VP1D8jy7bTWBxeY7+Kz6zbcjf4NNIH6/b QXiYHBZ3EIULAdySBzZ/tSwLVKPsA7ui4rexevFoQWUMmQy6sgtT2A9jpQqnhd+ts329 /9atDqLPuEV+PATMvKZ7LnSzFZ0WBf6SNEZ6lueY8P9mC5ox2HnDrBl9XpLkPSPakG9I 0uKf9ONlg8xMP6vTv6xp/ugMwdnUWJhZBoxur3TJBqrjhYsVBeKbWH3wo94jRludOpo8 CA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2mt1bprpu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Oct 2018 17:04:39 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w91H4csD013197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 1 Oct 2018 17:04:38 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w91H4bkK022669; Mon, 1 Oct 2018 17:04:37 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Oct 2018 10:04:37 -0700 Subject: [PATCH 3/8] xfs_repair: fix block reservation in mk_rsumino From: "Darrick J. Wong" To: sandeen@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 01 Oct 2018 10:04:36 -0700 Message-ID: <153841347645.27952.16962096446253318054.stgit@magnolia> In-Reply-To: <153841345236.27952.5050172703525712660.stgit@magnolia> References: <153841345236.27952.5050172703525712660.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9033 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810010163 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 From: Darrick J. Wong The functions mk_rsumino and rtinit both allocate transactions to create the realtime summary inode. In order to allocate and map blocks to the rtsummary file, these transactions require a block reservation. However, despite the comments in mk_rsumino about lifting the code from mkfs, it doesn't actually copy the same reservation calculation that mkfs uses in rtinit(). Practically speaking this has no effect since userspace doesn't care about transaction block reservations, but fix this logic bomb anyway. Signed-off-by: Darrick J. Wong --- repair/phase6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repair/phase6.c b/repair/phase6.c index d4b6a5cf..afa65c51 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -815,7 +815,7 @@ mk_rsumino(xfs_mount_t *mp) tres.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; error = -libxfs_trans_alloc(mp, &tres, - mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp,XFS_DATA_FORK) - 1), + nsumblocks + (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0, 0, &tp); if (error) res_failed(error);