Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp10959imc; Tue, 15 Jan 2019 15:09:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN60gvaS4evjequxYEdrLHFTlTCeSblnZcRpjkrzYi8krSX5NejULvHQ5PpPL1Rccef7qHFg X-Received: by 2002:a63:451a:: with SMTP id s26mr6120389pga.150.1547593775018; Tue, 15 Jan 2019 15:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547593775; cv=none; d=google.com; s=arc-20160816; b=yqWESbeaEQUW2u9rb25tEXJO9HlWwcX5dasGjl5KPRhQfTkGd8IZgQ7USp/LzVwtET S+CZgmRz1h1sVDXvJKGIQo2/jo/UtyrIWbDta3rDwRO+ItUq/nc6ZPt7uWVPmN6BSJX4 yfJY96oMV2Y+2Q5gFs2Qo1eJi4GWe5W+p0rsGt2U/qUrSPUpNmARcIrjwdO7l9nEgzn8 0lwXi0MBG+E+LyDHAWsTqnpTw+1ZC0pk0BeZ7VbXMocOLoKwZ980zPAlVb993TrEaMyV uL7m3UoJxwf5NCRwke/JjZC6IzWzQbqS/aMEnUjTBvcZ/g0JlwFgMe5oxFX9sfCO80hU kOSQ== 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=9A7kYo8jm/ZhFiJ/r9DBHYQ3OwQqklY2fMx6H3iGBC8=; b=Ijt4vnmPzJZ5NC013R3HpsvELALSYGlqfZD91BqqFJR6mWJVleVpOZbuw5XS5SN36T 97W8pN9yA4HrNU2sllusaahoC15dSRnLz3wcbOR0ZT92aWa8RMkZ37aqVG/hEBFRFqG7 4rIGyQp0z7J1NcG5qG+89w3tr3ONLG5wxzk1y6EGyvrpgAUwt0G8M3tKwhjiGJxceibk d05tCo57AOYmoosEhMkQPRiq1tQLaEKhAwPvxgM6z9i5VsmcWaQTZ/LhURUDcYSbSK2A up6cS12UDtI/Xp2QvOCqCeomO+cfjx3YgYQRKSv5p497Xp2f52fQpFUy4YKOQITUqxSg w87A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XFBx7E6a; 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 b30si4758890pla.285.2019.01.15.15.09.15; Tue, 15 Jan 2019 15:09:35 -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=XFBx7E6a; 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 S1731709AbfAOQrj (ORCPT + 99 others); Tue, 15 Jan 2019 11:47:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:35052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387768AbfAOQpV (ORCPT ); Tue, 15 Jan 2019 11:45:21 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 3095120645; Tue, 15 Jan 2019 16:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570720; bh=U2NrJ0jeZ2u+8EQcpNnqHWcMZCguWursJETynHLVkC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XFBx7E6agkak2meVye4xLAARbtoew8ac3a+kcPdHpAxyvO1I00uGxhR31NxrYnMPu LQKYCs2aIwf/m5QGuHM0JPUeGfbvXIG5AW+x4eXT8cuZW+wRFxUEz8Sfd9kYttymq6 Zgb7N8TWN0BtR7qfR5V0F4telx4cm2yg0cKDpHJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org Subject: [PATCH 4.20 47/57] ext4: make sure enough credits are reserved for dioread_nolock writes Date: Tue, 15 Jan 2019 17:36:28 +0100 Message-Id: <20190115154913.615006838@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit 812c0cab2c0dfad977605dbadf9148490ca5d93f upstream. There are enough credits reserved for most dioread_nolock writes; however, if the extent tree is sufficiently deep, and/or quota is enabled, the code was not allowing for all eventualities when reserving journal credits for the unwritten extent conversion. This problem can be seen using xfstests ext4/034: WARNING: CPU: 1 PID: 257 at fs/ext4/ext4_jbd2.c:271 __ext4_handle_dirty_metadata+0x10c/0x180 Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work RIP: 0010:__ext4_handle_dirty_metadata+0x10c/0x180 ... EXT4-fs: ext4_free_blocks:4938: aborting transaction: error 28 in __ext4_handle_dirty_metadata EXT4: jbd2_journal_dirty_metadata failed: handle type 11 started at line 4921, credits 4/0, errcode -28 EXT4-fs error (device dm-1) in ext4_free_blocks:4950: error 28 Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2778,7 +2778,8 @@ static int ext4_writepages(struct addres * We may need to convert up to one extent per block in * the page and we may dirty the inode. */ - rsv_blocks = 1 + (PAGE_SIZE >> inode->i_blkbits); + rsv_blocks = 1 + ext4_chunk_trans_blocks(inode, + PAGE_SIZE >> inode->i_blkbits); } /*