From patchwork Fri Feb 22 17:17:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 222577 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A63592C029C for ; Sat, 23 Feb 2013 04:18:08 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758573Ab3BVRSF (ORCPT ); Fri, 22 Feb 2013 12:18:05 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:42617 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758556Ab3BVRSD (ORCPT ); Fri, 22 Feb 2013 12:18:03 -0500 Received: by mail-lb0-f171.google.com with SMTP id gg13so723262lbb.2 for ; Fri, 22 Feb 2013 09:18:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:subject:user-agent:cc:date:message-id :mime-version:content-type; bh=DJ6Q24ZENmgSnZ3/Qkk9lu913QpcFHel2AixaRIgQ24=; b=xsAca5G6N8dTgUD00Kv4V3FYefyMgSmSLQzcoUtd0qD9ebe0nAgZNIoFyYMqFI0/ao cBpkmJy1Cdv15vr/4r+j+EJ+jqja89hR8+PPlTJ2VTmxXEBZA7W1aHzw//YLBxWc/ggO pN8YHO3xrrGZCd5BB00Zyszx7A48gDsL2Dx5xZTU2/i0P1TSeOSXz3uTvGavt1OpN8L7 Ph/3AVhwu9f1WlFcRH9AFYAuvP8B1sTyXeghwIlI9lFUngdwfGDgjAUT1VfMoEcwBsEE cpAV8t8vC44zbctX/6RuBAIFL33crvUinLnHNRZDTIrb85b1Q4HV1oGBfm7LSCMWF7gA Ebbw== X-Received: by 10.112.43.198 with SMTP id y6mr1258497lbl.93.1361553480607; Fri, 22 Feb 2013 09:18:00 -0800 (PST) Received: from smtp.gmail.com (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id w5sm1099192lbj.15.2013.02.22.09.17.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Feb 2013 09:17:59 -0800 (PST) From: Dmitry Monakhov To: linux-ext4@vger.kernel.org Subject: ext4 xfstest regression due to ext4_es_lookup_extent User-Agent: Notmuch/0.6.1 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-redhat-linux-gnu) CC: Zheng Liu Date: Fri, 22 Feb 2013 21:17:57 +0400 Message-ID: <87obfcs1x6.fsf@openvz.org> MIME-Version: 1.0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 301'th xfstests are failed due to : commit d100eef2440fea13e4f09e88b1c8bcbca64beb9f Author: Zheng Liu Date: Mon Feb 18 00:29:59 2013 -0500 ext4: lookup block mapping in extent status tree TESTCASE: https://github.com/dmonakhov/xfstests/commit/7b7efeee30a41109201e2040034e71db9b66ddc0 ------------[ cut here ]------------ kernel BUG at fs/ext4/inode.c:1452! invalid opcode: 0000 [#1] SMP Modules linked in: cpufreq_ondemand acpi_cpufreq freq_table mperf coretemp kvm_intel kvm crc32c_intel ghash_clmulni_intel microcode sg xhci_hcd button sd_mod crc_t10dif aesni_intel ablk_helper cryptd lrw aes\ l ahci libahci pata_acpi ata_generic dm_mirror dm_region_hash dm_log dm_mod CPU 2 Pid: 2142, comm: fio Not tainted 3.8.0-rc3+ #41 /DQ67SW RIP: 0010:[] [] mpage_da_submit_io+0x41b/0x5b0 RSP: 0018:ffff8801c2837a48 EFLAGS: 00010202 RAX: ffff880231e64bb0 RBX: ffff880231e64bb0 RCX: 0000000000000000 RDX: 0000000000000003 RSI: 0000000000000001 RDI: ffffffff821372d8 RBP: ffff8801c2837bb8 R08: ffff8801c2837df8 R09: 0000000000000001 R10: ffff880231e64bb1 R11: 0000000000000003 R12: ffffea00076f5c28 R13: 00000000000026d0 R14: ffff8801c2837be8 R15: 00000000000ea6d0 FS: 00007fefeaeb5700(0000) GS:ffff88023d800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fefdf10299c CR3: 0000000209154000 CR4: 00000000000407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process fio (pid: 2142, threadinfo ffff8801c2836000, task ffff8801d3c48580) Stack: ffffffff82030f00 ffff8801c2837b58 ffff8801c2837df8 0000000000000000 ffff880231e64bb1 0000000000000001 ffff880231e64bb0 000000002ba68688 ffff8801c2837ae8 00000000000d4800 ffff880231f1cb98 00000000000026d0 Call Trace: [] mpage_da_map_and_submit+0x369/0x3d0 [] write_cache_pages_da+0x1db/0x6f0 [] ext4_da_writepages+0x49f/0x8b0 [] ? __lock_acquire+0x4ca/0x560 [] do_writepages+0x51/0x70 [] __filemap_fdatawrite_range+0x64/0x70 [] sys_fadvise64_64+0x25b/0x300 [] sys_fadvise64+0xe/0x10 [] system_call_fastpath+0x16/0x1b Code: a0 fe ff ff 4c 8b 95 b0 fe ff ff 49 63 d1 48 83 c2 02 48 8b 34 d5 30 4c 2b 82 48 83 c6 01 45 85 c9 48 89 34 d5 30 4c 2b 82 74 04 <0f> 0b eb fe 41 0f b6 56 13 83 e2 01 48 63 f2 48 83 c6 02 48 8b RIP [] mpage_da_submit_io+0x41b/0x5b0 RSP ---[ end trace 6f79fb4f46cf9f0e ]--- ------------[ cut here ]------------ Commit (d100eef2) this is very first commit where we try to make extent-status-tree usefull. Definitely this is because cached value is out of sync with real on-disk structure. I'll try to find out exact place where this happen, but i'm shure this is just a beginning. So Zheng please add sane self-testing infastructure for extent status tree, for example like follows: From 65c5fc212b1c684c76899c6e5e1f24d88550c6fc Mon Sep 17 00:00:00 2001 From: Dmitry Monakhov Date: Fri, 22 Feb 2013 20:55:52 +0400 Subject: [PATCH] ext4 add sanity ext4_es_lookup_extent This patch does very simple thing: it recheck result returned from ext4_es_lookup_extent() by comparing it old-good lookup via ext4_{ind,ext}_map_blocks() under i_data_sem Signed-off-by: Dmitry Monakhov --- fs/ext4/inode.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 95a0c62..706db1f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -482,6 +482,41 @@ static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx, return num; } +#define ES_AGGRESSIVE_TEST 1 +#ifdef ES_AGGRESSIVE_TEST +void ext4_map_blocks_es_recheck(handle_t *handle, struct inode *inode, + struct ext4_map_blocks *es_map, int es_ret, + struct ext4_map_blocks *map, int flags) +{ + int ret; + + map->m_flags = 0; + if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) + down_read((&EXT4_I(inode)->i_data_sem)); + if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { + ret = ext4_ext_map_blocks(handle, inode, map, flags & + EXT4_GET_BLOCKS_KEEP_SIZE); + } else { + ret = ext4_ind_map_blocks(handle, inode, map, flags & + EXT4_GET_BLOCKS_KEEP_SIZE); + } + if (es_map->m_lblk != map->m_lblk || + es_map->m_flags != map->m_flags || + es_map->m_len != map->m_len || + es_map->m_pblk != map->m_pblk || + es_ret != ret) { + printk("Assertation failed for inode:%lu " + "es_cached_ex [%d/%d/%llu/%x]:%d != " + "found_ex [%d/%d/%llu/%x]:%d\n", inode->i_ino, + es_map->m_lblk, es_map->m_len, es_map->m_pblk, + es_map->m_flags, es_ret, + map->m_lblk, map->m_len, map->m_pblk, map->m_flags, ret); + BUG(); + } + if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) + up_read((&EXT4_I(inode)->i_data_sem)); +} +#endif /* * The ext4_map_blocks() function tries to look up the requested blocks, * and returns if the blocks are already mapped. @@ -509,7 +544,11 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, { struct extent_status es; int retval; +#ifdef ES_AGGRESSIVE_TEST + struct ext4_map_blocks orig_map; + memcpy(&orig_map, map, sizeof(*map)); +#endif map->m_flags = 0; ext_debug("ext4_map_blocks(): inode %lu, flag %d, max_blocks %u," "logical block %lu\n", inode->i_ino, flags, map->m_len, @@ -531,6 +570,9 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, } else { BUG_ON(1); } +#ifdef ES_AGGRESSIVE_TEST + ext4_map_blocks_es_recheck(handle,inode, map, retval, &orig_map, flags); +#endif goto found; } -- 1.7.1