2009-01-29 00:51:06

by bugme-daemon

[permalink] [raw]
Subject: [Bug 12568] New: BUG: filefrag errors on non-journal ext4 filesystem

http://bugzilla.kernel.org/show_bug.cgi?id=12568

Summary: BUG: filefrag errors on non-journal ext4 filesystem
Product: File System
Version: 2.5
KernelVersion: 2.6.29-rc1
Platform: All
OS/Version: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: ext4
AssignedTo: [email protected]
ReportedBy: [email protected]


Latest working kernel version: unknown
Earliest failing kernel version: 2.6.29-rc1
Distribution: CentOS 5.2 (x86_64)
Hardware Environment: MY20R/B-4(CPU: Intel(R) Core(TM) 2 Duo E4400, MEM: 2560MB
Software Environment: e2fsprogs-1.41.3

Problem Description:
2.6.29-rc1 + the most recent ext4 patch queue

When mounting ext4 filesystem without a journal, BUG_ON panic occurs by
executing filefrag command.
The following error messages show in the system logs:

Jan 27 15:56:53 bsdB08126 kernel: kernel BUG at fs/ext4/inode.c:2825!
Jan 27 15:56:53 bsdB08126 kernel: invalid opcode: 0000 [0000001] SMP
Jan 27 15:56:53 bsdB08126 kernel: last sysfs file: /sys/class/drm/card0/dev
Jan 27 15:56:53 bsdB08126 kernel: CPU 0
Jan 27 15:56:53 bsdB08126 kernel: Modules linked in: i915 drm i2c_algo_bit
autofs4 hidp rfcomm l2cap bluetooth sunrpc iptable_filter ip_tables ip6t_REJECT
xt_tcpudp ip6table_filter ip6_tables x_tables dm_mirror dm_region_hash dm_log
dm_multipath dm_mod sbs sbshc battery acpi_memhotplug ac ipv6 lp
snd_hda_codec_realtek snd_hda_intel sg snd_hda_codec snd_seq_dummy snd_seq_oss
snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss snd_pcm
serio_raw sr_mod rtc_cmos cdrom parport_pc snd_timer rtc_core parport rtc_lib
snd button i2c_i801 e1000e soundcore pcspkr snd_page_alloc i2c_core ata_piix
libata sd_mod scsi_mod uhci_hcd ohci_hcd ehci_hcd [last unloaded: microcode]
Jan 27 15:56:53 bsdB08126 kernel: Pid: 3902, comm: filefrag Not tainted
2.6.29-rc1 0000012
Jan 27 15:56:53 bsdB08126 kernel: RIP: 0010:[<ffffffff803043a9>]
[<ffffffff803043a9>] ext4_bmap+0x5a/0xc8
Jan 27 15:56:53 bsdB08126 kernel: RSP: 0018:ffff880064857ea8 EFLAGS: 00010202
Jan 27 15:56:53 bsdB08126 kernel: RAX: 0000000000000000 RBX: ffff88006380d490
RCX: 0000000000000015
Jan 27 15:56:53 bsdB08126 kernel: RDX: 0000000000000000 RSI: 0000000000000000
RDI: ffff88006380d5a8
Jan 27 15:56:53 bsdB08126 kernel: RBP: ffff88006380d5a0 R08: ffff880064857e68
R09: 0000000000000000
Jan 27 15:56:53 bsdB08126 kernel: R10: 74616d726f662073 R11: ffff8800905d6380
R12: 00000000000063ff
Jan 27 15:56:53 bsdB08126 kernel: R13: 00000000000063ff R14: 0000000000000003
R15: 0000000000000000
Jan 27 15:56:53 bsdB08126 kernel: FS: 00007f4b8eb586e0(0000)
GS:ffffffff8086c080(0000) knlGS:0000000000000000
Jan 27 15:56:53 bsdB08126 kernel: CS: 0010 DS: 0000 ES: 0000 CR0:
000000008005003b
Jan 27 15:56:53 bsdB08126 kernel: CR2: 00000031b8e62b80 CR3: 0000000062015000
CR4: 00000000000006e0
Jan 27 15:56:53 bsdB08126 kernel: DR0: 0000000000000000 DR1: 0000000000000000
DR2: 0000000000000000
Jan 27 15:56:54 bsdB08126 kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0
DR7: 0000000000000400
Jan 27 15:56:54 bsdB08126 kernel: Process filefrag (pid: 3902, threadinfo
ffff880064856000, task ffff88007386e970)
Jan 27 15:56:54 bsdB08126 kernel: Stack:
Jan 27 15:56:54 bsdB08126 kernel: 0000000000000001 ffff88006380d5a0
00007fff96b70fb4 00000000000063ff
Jan 27 15:56:55 bsdB08126 kernel: 0000000000000000 ffffffff802aa43f
0000000000000000 0000000000000000
Jan 27 15:56:55 bsdB08126 kernel: 0000000000000000 0000000000000000
0000000000000000 ffffffff804e9068
Jan 27 15:56:56 bsdB08126 kernel: Call Trace:
Jan 27 15:56:56 bsdB08126 kernel: [<ffffffff802aa43f>] ?
do_vfs_ioctl+0x2bf/0x4a3
Jan 27 15:56:56 bsdB08126 kernel: [<ffffffff804e9068>] ?
do_page_fault+0x3a8/0x72f
Jan 27 15:56:57 bsdB08126 kernel: [<ffffffff802aa674>] ? sys_ioctl+0x51/0x70
Jan 27 15:56:58 bsdB08126 kernel: [<ffffffff8020bedb>] ?
system_call_fastpath+0x16/0x1b
Jan 27 15:56:58 bsdB08126 kernel: Code: 08 74 08 48 89 ef e8 28 fe f6 ff 48 8b
83 f8 00 00 00 48 8b 80 90 02 00 00 48 8b 80 90 41 00 00 48 85 c0 75 0f f6 43
a0 01 74 04 <0f> 0b eb fe 48 85 c0 74 42 8b 43 a0 a8 01 74 3b 83 e0 fe 89 43
Jan 27 15:56:58 bsdB08126 kernel: RIP [<ffffffff803043a9>] ext4_bmap+0x5a/0xc8
Jan 27 15:56:58 bsdB08126 kernel: RSP <ffff880064857ea8>
Jan 27 15:56:58 bsdB08126 kernel: ---[ end trace 60cf7e0d66d2b1ce ]---

Whenever __ext4_journalled_writepage() or ext4_journalled_write_end() is
called, EXT4_STATE_JDATA is set in i_state in spite of non-journal ext4.
That's weird.

Steps to reproduce:
1. mke2fs -O extents /dev/sdaX
2. mount -t ext4 /dev/sdaX /mnt/mpX
3. dd if=/dev/urandom of=/mnt/mpX/file bs=1K count=102400
4. filefrag /mnt/mpX/file


--
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


2009-01-30 05:01:27

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [Bug 12568] New: BUG: filefrag errors on non-journal ext4 filesystem

Here's the patch to fix this issue.

- Ted

>From b9ec63f78b425c0e16cc95605b5d4ff2dc228b97 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Fri, 30 Jan 2009 00:00:24 -0500
Subject: [PATCH] ext4: Remove bogus BUG() check in ext4_bmap()

The code to support journal-less ext4 operation added a BUG to
ext4_bmap() which fired if there was no journal and the
EXT4_STATE_JDATA bit was set in the i_state field. This caused
running the filefrag program (which uses the FIMBAP ioctl) to trigger
a BUG().

The EXT4_STATE_JDATA bit is only used for ext4_bmap(), and it's
harmless for the bit to be set. We could add a check in
__ext4_journalled_writepage() and ext4_journalled_write_end() to only
set the EXT4_STATE_JDATA bit if the journal is present, but that adds
an extra test and jump instruction. It's easier to simply remove the
BUG check.

http://bugzilla.kernel.org/show_bug.cgi?id=12568

Signed-off-by: "Theodore Ts'o" <[email protected]>
Cc: [email protected]
---
fs/ext4/inode.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index b4386da..03ba20b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2821,9 +2821,6 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
filemap_write_and_wait(mapping);
}

- BUG_ON(!EXT4_JOURNAL(inode) &&
- EXT4_I(inode)->i_state & EXT4_STATE_JDATA);

2009-01-30 05:02:31

by bugme-daemon

[permalink] [raw]
Subject: [Bug 12568] BUG: filefrag errors on non-journal ext4 filesystem

http://bugzilla.kernel.org/show_bug.cgi?id=12568





------- Comment #1 from [email protected] 2009-01-29 21:02 -------
Here's the patch to fix this issue.

- Ted

>From b9ec63f78b425c0e16cc95605b5d4ff2dc228b97 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Fri, 30 Jan 2009 00:00:24 -0500
Subject: [PATCH] ext4: Remove bogus BUG() check in ext4_bmap()

The code to support journal-less ext4 operation added a BUG to
ext4_bmap() which fired if there was no journal and the
EXT4_STATE_JDATA bit was set in the i_state field. This caused
running the filefrag program (which uses the FIMBAP ioctl) to trigger
a BUG().

The EXT4_STATE_JDATA bit is only used for ext4_bmap(), and it's
harmless for the bit to be set. We could add a check in
__ext4_journalled_writepage() and ext4_journalled_write_end() to only
set the EXT4_STATE_JDATA bit if the journal is present, but that adds
an extra test and jump instruction. It's easier to simply remove the
BUG check.

http://bugzilla.kernel.org/show_bug.cgi?id=12568

Signed-off-by: "Theodore Ts'o" <[email protected]>
Cc: [email protected]
---
fs/ext4/inode.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index b4386da..03ba20b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2821,9 +2821,6 @@ static sector_t ext4_bmap(struct address_space *mapping,
sector_t block)
filemap_write_and_wait(mapping);
}

- BUG_ON(!EXT4_JOURNAL(inode) &&
- EXT4_I(inode)->i_state & EXT4_STATE_JDATA);

2009-01-30 07:43:37

by bugme-daemon

[permalink] [raw]
Subject: [Bug 12568] BUG: filefrag errors on non-journal ext4 filesystem

http://bugzilla.kernel.org/show_bug.cgi?id=12568


[email protected] changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |CODE_FIX




------- Comment #2 from [email protected] 2009-01-29 23:43 -------
The patch fixes this issue for me.
Thanks for your help.


--
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

2009-02-03 19:17:42

by bugme-daemon

[permalink] [raw]
Subject: [Bug 12568] BUG: filefrag errors on non-journal ext4 filesystem

http://bugzilla.kernel.org/show_bug.cgi?id=12568


[email protected] changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED




--
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.