From patchwork Mon Sep 12 10:03:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxiao Bi X-Patchwork-Id: 9326091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 128E56048B for ; Mon, 12 Sep 2016 10:05:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0355F28B85 for ; Mon, 12 Sep 2016 10:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBF9D28BAB; Mon, 12 Sep 2016 10:05:09 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D286228B90 for ; Mon, 12 Sep 2016 10:05:07 +0000 (UTC) Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8CA4Cha029237 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Sep 2016 10:04:13 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u8CA46mv006327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Sep 2016 10:04:07 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1bjO5u-0004od-CX; Mon, 12 Sep 2016 03:04:06 -0700 Received: from aserv0021.oracle.com ([141.146.126.233]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1bjO5X-0004np-RX for ocfs2-devel@oss.oracle.com; Mon, 12 Sep 2016 03:03:43 -0700 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u8CA3hvU001191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Sep 2016 10:03:43 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8CA3guv011686; Mon, 12 Sep 2016 10:03:43 GMT Received: from bijx-OptiPlex-780.cn.oracle.com (/10.182.64.189) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Sep 2016 03:03:42 -0700 From: Junxiao Bi To: ocfs2-devel@oss.oracle.com, akpm@linux-foundation.org Date: Mon, 12 Sep 2016 18:03:43 +0800 Message-Id: <1473674623-11810-2-git-send-email-junxiao.bi@oracle.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1473674623-11810-1-git-send-email-junxiao.bi@oracle.com> References: <1473674623-11810-1-git-send-email-junxiao.bi@oracle.com> Cc: mfasheh@suse.de Subject: [Ocfs2-devel] [PATCH 2/2] ocfs2: fix trans extend while free cached blocks X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Virus-Scanned: ClamAV using ClamSMTP Root cause of this issue is the same with the one fixed by last patch, but this time credits for allocator inode and group descriptor may not be consumed before trans extend. The following error was caught. [ 685.240276] WARNING: CPU: 0 PID: 2037 at fs/jbd2/transaction.c:269 start_this_handle+0x4c3/0x510 [jbd2]() [ 685.240294] Modules linked in: ocfs2 nfsd lockd grace nfs_acl auth_rpcgss sunrpc autofs4 ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue configfs sd_mod sg ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ppdev xen_kbdfront fb_sys_fops sysimgblt sysfillrect syscopyarea xen_netfront parport_pc parport pcspkr i2c_piix4 i2c_core acpi_cpufreq ext4 jbd2 mbcache xen_blkfront floppy pata_acpi ata_generic ata_piix dm_mirror dm_region_hash dm_log dm_mod [ 685.240296] CPU: 0 PID: 2037 Comm: rm Tainted: G W 4.1.12-37.6.3.el6uek.bug24573128v2.x86_64 #2 [ 685.240296] Hardware name: Xen HVM domU, BIOS 4.4.4OVM 02/11/2016 [ 685.240298] 000000000000010d ffff88007ac3f808 ffffffff816bc5bc 000000000000010d [ 685.240300] 0000000000000000 ffff88007ac3f848 ffffffff81081475 ffff88007ac3f828 [ 685.240301] ffff880037bbf000 ffff880037688210 0000000000000095 0000000000000050 [ 685.240301] Call Trace: [ 685.240305] [] dump_stack+0x48/0x5c [ 685.240308] [] warn_slowpath_common+0x95/0xe0 [ 685.240310] [] warn_slowpath_null+0x1a/0x20 [ 685.240313] [] start_this_handle+0x4c3/0x510 [jbd2] [ 685.240317] [] ? __jbd2_log_start_commit+0xe5/0xf0 [jbd2] [ 685.240319] [] ? __wake_up+0x53/0x70 [ 685.240322] [] jbd2__journal_restart+0x161/0x1b0 [jbd2] [ 685.240325] [] jbd2_journal_restart+0x13/0x20 [jbd2] [ 685.240340] [] ocfs2_extend_trans+0x74/0x220 [ocfs2] [ 685.240347] [] ocfs2_free_cached_blocks+0x16b/0x4e0 [ocfs2] [ 685.240349] [] ? internal_add_timer+0x91/0xc0 [ 685.240356] [] ocfs2_run_deallocs+0x70/0x270 [ocfs2] [ 685.240363] [] ocfs2_commit_truncate+0x474/0x6f0 [ocfs2] [ 685.240374] [] ? ocfs2_xattr_tree_et_ops+0x60/0xfffffffffffe8c00 [ocfs2] [ 685.240384] [] ? ocfs2_journal_access_eb+0x20/0x20 [ocfs2] [ 685.240385] [] ? __sb_end_write+0x33/0x70 [ 685.240394] [] ocfs2_truncate_for_delete+0xbd/0x380 [ocfs2] [ 685.240402] [] ? ocfs2_query_inode_wipe+0xf4/0x320 [ocfs2] [ 685.240409] [] ocfs2_wipe_inode+0x136/0x6a0 [ocfs2] [ 685.240415] [] ? ocfs2_query_inode_wipe+0xf4/0x320 [ocfs2] [ 685.240422] [] ocfs2_delete_inode+0x2a2/0x3e0 [ocfs2] [ 685.240424] [] ? __inode_wait_for_writeback+0x69/0xc0 [ 685.240437] [] ? __PRETTY_FUNCTION__.112282+0x20/0xffffffffffffb500 [ocfs2] [ 685.240444] [] ocfs2_evict_inode+0x28/0x60 [ocfs2] [ 685.240445] [] evict+0xab/0x1a0 [ 685.240456] [] ? __PRETTY_FUNCTION__.112282+0x20/0xffffffffffffb500 [ocfs2] [ 685.240457] [] iput_final+0xf6/0x190 [ 685.240458] [] iput+0xc8/0xe0 [ 685.240460] [] do_unlinkat+0x1b7/0x310 [ 685.240462] [] ? __audit_syscall_entry+0xac/0x110 [ 685.240464] [] ? do_audit_syscall_entry+0x6c/0x70 [ 685.240465] [] ? syscall_trace_enter_phase1+0x153/0x180 [ 685.240467] [] SyS_unlinkat+0x22/0x40 [ 685.240468] [] system_call_fastpath+0x12/0x71 [ 685.240469] ---[ end trace a62437cb060baa71 ]--- [ 685.240470] JBD2: rm wants too many credits (149 > 128) Signed-off-by: Junxiao Bi Reviewed-by: Joseph Qi --- fs/ocfs2/alloc.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 51128789a661..f165f867f332 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -6404,43 +6404,34 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, goto out_mutex; } - handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE); - if (IS_ERR(handle)) { - ret = PTR_ERR(handle); - mlog_errno(ret); - goto out_unlock; - } - while (head) { if (head->free_bg) bg_blkno = head->free_bg; else bg_blkno = ocfs2_which_suballoc_group(head->free_blk, head->free_bit); + handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE); + if (IS_ERR(handle)) { + ret = PTR_ERR(handle); + mlog_errno(ret); + goto out_unlock; + } + trace_ocfs2_free_cached_blocks( (unsigned long long)head->free_blk, head->free_bit); ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, head->free_bit, bg_blkno, 1); - if (ret) { + if (ret) mlog_errno(ret); - goto out_journal; - } - ret = ocfs2_extend_trans(handle, OCFS2_SUBALLOC_FREE); - if (ret) { - mlog_errno(ret); - goto out_journal; - } + ocfs2_commit_trans(osb, handle); tmp = head; head = head->free_next; kfree(tmp); } -out_journal: - ocfs2_commit_trans(osb, handle); - out_unlock: ocfs2_inode_unlock(inode, 1); brelse(di_bh);