Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp35291imu; Thu, 8 Nov 2018 14:17:25 -0800 (PST) X-Google-Smtp-Source: AJdET5dtUJJRoDlyhzkjszP+zJiEGQ1yL5qfMXw0iYH8o7UmBjRAjbIcwblUStyPhuTGkP3h2AOV X-Received: by 2002:aa7:828a:: with SMTP id s10-v6mr6256622pfm.63.1541715445472; Thu, 08 Nov 2018 14:17:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541715445; cv=none; d=google.com; s=arc-20160816; b=gLqdXRfx2rVybesXrctpTpaPE16sH4rF3H9JKhOw7MAbRBJNT0nTiV77e+TTkZBRtz wtAhJFGoab69Nmn3gc4r0ZjWHOtGolu2yW7+dOTA1wU51pbeiCKqrvXA6hoUbFt0Q/r4 2TcvfWIWukxAMX2xiLRQ/TulTtaZELWDeKgsOITi2rLKtbNq4ujxCX85F7yP4JRtCrbJ 1QdP3u0wms85khNAipUN1iifa0AN1k7P/RoUwrwseHFgvbHBmUQP011fM1sS7lsxaH9k 6rvOSmhdknmoM9m+VlIturFgRSVY9UiKWiC2wxoyLs3WIlsprrjgV1FJ2apsit/7a7Ch GcBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=85SEyYXE1LykD31fsW8V3wSDh3djhw8u88JwPyJQUrg=; b=kv6vZnk3euxuVyxeteS+WcwmHfY6/lBZqZQDNuKUPVaYUo5HIIYhRtBeajYZXd0V3r FkQ0ZQlXZ4FF3ilogSN6BLMctBWUCIf7zcTZ+zONAINUEIzGP9e8bPQO4rqkKTlMt/ad H80+zdkW6pD+811UttvSL7+5/HktgFwcVVwusA3l+Ki2ssyzbOIWs2AjzbtFbmM0E/C1 Z8lY8eeyirWa/yaTOdfmPoiS/M2SJlWytCEBoXi48kzskveBfrFQvuicZc4PLIvfmo4E xLFjRQ0eA3oOp87relil9D80eBhQQefnFAcMPyG8IXXBvPkoGBs2Ng/xhJLIdgLxzXGR 3k2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pZZNHURD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19-v6si2914401pfb.81.2018.11.08.14.17.10; Thu, 08 Nov 2018 14:17:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pZZNHURD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732285AbeKIHos (ORCPT + 99 others); Fri, 9 Nov 2018 02:44:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:37948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731329AbeKIHos (ORCPT ); Fri, 9 Nov 2018 02:44:48 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2EC021019; Thu, 8 Nov 2018 22:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714836; bh=nTrniBm5PmXMueNCXooEys4CDptAjOXL7jLuqn9xXSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZZNHURDvxvHqT9u8uxZ/W9+sC5+S9PlEO9T8Xyym/4D04y3CYz3JH0SiQBhdPw9F iF/gb3O9C/R1WYsT75iNITvx9a0wPbcbxD+oPYRUPad/R2Odd199h87F8SPAqBJoWe Og+viZCQNVtlWcHQofOtBvcIak04xwU4zJISaX8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Foster , Dave Chinner , "Darrick J. Wong" , Amir Goldstein , Sasha Levin Subject: [PATCH 4.9 157/171] xfs: truncate transaction does not modify the inobt Date: Thu, 8 Nov 2018 13:52:07 -0800 Message-Id: <20181108215138.086428271@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215127.257643509@linuxfoundation.org> References: <20181108215127.257643509@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit a606ebdb859e78beb757dfefa08001df366e2ef5 ] The truncate transaction does not ever modify the inode btree, but includes an associated log reservation. Update xfs_calc_itruncate_reservation() to remove the reservation associated with inobt updates. [Amir: This commit was merged for kernel v4.16 and a twin commit was merged for xfsprogs v4.16. As a result, a small xfs filesystem formatted with features -m rmapbt=1,reflink=1 using mkfs.xfs version >= v4.16 cannot be mounted with kernel < v4.16. For example, xfstests generic/17{1,2,3} format a small fs and when trying to mount it, they fail with an assert on this very demonic line: XFS (vdc): Log size 3075 blocks too small, minimum size is 3717 blocks XFS (vdc): AAIEEE! Log failed size checks. Abort! XFS: Assertion failed: 0, file: src/linux/fs/xfs/xfs_log.c, line: 666 The simple solution for stable kernels is to apply this patch, because mkfs.xfs v4.16 is already in the wild, so we have to assume that xfs filesystems with a "too small" log exist. Regardless, xfsprogs maintainers should also consider reverting the twin patch to stop creating those filesystems for the sake of users with unpatched kernels.] Signed-off-by: Brian Foster Reviewed-by: Dave Chinner Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Cc: # v4.9+ Signed-off-by: Amir Goldstein Reviewed-by: Darrick J . Wong Signed-off-by: Sasha Levin --- fs/xfs/libxfs/xfs_trans_resv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c index b456cca1bfb2..c0ecdec8e0a9 100644 --- a/fs/xfs/libxfs/xfs_trans_resv.c +++ b/fs/xfs/libxfs/xfs_trans_resv.c @@ -232,8 +232,6 @@ xfs_calc_write_reservation( * the super block to reflect the freed blocks: sector size * worst case split in allocation btrees per extent assuming 4 extents: * 4 exts * 2 trees * (2 * max depth - 1) * block size - * the inode btree: max depth * blocksize - * the allocation btrees: 2 trees * (max depth - 1) * block size */ STATIC uint xfs_calc_itruncate_reservation( @@ -245,12 +243,7 @@ xfs_calc_itruncate_reservation( XFS_FSB_TO_B(mp, 1))), (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + xfs_calc_buf_res(xfs_allocfree_log_count(mp, 4), - XFS_FSB_TO_B(mp, 1)) + - xfs_calc_buf_res(5, 0) + - xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1), - XFS_FSB_TO_B(mp, 1)) + - xfs_calc_buf_res(2 + mp->m_ialloc_blks + - mp->m_in_maxlevels, 0))); + XFS_FSB_TO_B(mp, 1)))); } /* -- 2.17.1