Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1318078yba; Tue, 2 Apr 2019 06:47:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjTBTCBioR6IqgRlbMqIt0+oWIUp6PqwSl3B0178tnQ5XWunJZuwSqkUpuiM385rNJ+hkf X-Received: by 2002:a65:6150:: with SMTP id o16mr36842896pgv.285.1554212824443; Tue, 02 Apr 2019 06:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554212824; cv=none; d=google.com; s=arc-20160816; b=n95YmRcJcvUFY0Fp8iowRtjQtl9cQ4i8yElysThGHevhv/DouEOeJgBFP8YD/1gzEs 8Uibk7HrM50J4p1LesbCL5jc93Ba9SLDhKBZtvlHbAaQ17zo8LqhTShS5R7wBt9u6wpX q/Vl0GH5Z2q54snOLUbydgh+QRwg4nn2JOw0RtW5HtHg1dQxvTyVhoyit5vyNhz3W6VT A/Loj8fKVuDiDggs8TiWMzKjKzh2CeQY+EPFsXFgi4gacpA+x725dZxmem8HL6Wl9dft 0O16aPAipjM6kymJ0ri0BkeAextIu8KpXh++b2Fvnobgs6qG/8CyvRfTZcBXgRrO4Knl qSyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=j//MnnoiFZV44NG5ZnBsQZdik8LRoeztwA+w7GoF7sU=; b=Pr9ByLYb1D1nKmSfVZHBFxEKpUsME34X5MmqM/SnRVnT7mbZQ1YKmQWUNK2ztdc94L 7A5H5Y5uOf4r2OoGAuiCc+EQ82ZZbwSy1vYyfkZVjgHQFwGO90i+jpiiYufCs5RpkSie AuhLcF/ej6joMJZbUnKfIXRbDRxzY1017tTdvp7CaxCT8O+WY9/kYXLfOQkyBYmbiiBU yDAc5N42kUyv6UQGuoulSHk8uCRzOpB6dZfObC5IxzbBzJPokBf0R1vAXUcyexj8vXIT JwqJCk6aJWKFLyOTjDhoCuNR/hOu0kc1C1IbVueH6W5AxyyiRP8uy71FY5v1D5kSfyyr cgAQ== ARC-Authentication-Results: i=1; mx.google.com; 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 140si11197406pga.460.2019.04.02.06.46.48; Tue, 02 Apr 2019 06:47:04 -0700 (PDT) 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; 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 S1732016AbfDBNob (ORCPT + 99 others); Tue, 2 Apr 2019 09:44:31 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:43444 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731475AbfDBNkI (ORCPT ); Tue, 2 Apr 2019 09:40:08 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJe0-0002oX-J4; Tue, 02 Apr 2019 14:40:04 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdx-0004wq-L9; Tue, 02 Apr 2019 14:40:01 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Theodore Ts'o" Date: Tue, 02 Apr 2019 14:38:28 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 79/99] ext4: make sure enough credits are reserved for dioread_nolock writes In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 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 [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- fs/ext4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2579,7 +2579,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_CACHE_SIZE >> inode->i_blkbits); + rsv_blocks = 1 + ext4_chunk_trans_blocks(inode, + PAGE_CACHE_SIZE >> inode->i_blkbits); } /*