https://bugzilla.novell.com/show_bug.cgi?id=840413 https://bugzilla.novell.com/show_bug.cgi?id=840413#c0 Summary: mke2fs with discard on MD Raid5 breaks RAID array Classification: openSUSE Product: openSUSE 12.3 Version: Final Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: P5 - None Component: Kernel AssignedTo: kernel-maintainers@forge.provo.novell.com ReportedBy: martin.wilck@ts.fujitsu.com QAContact: qa-bugs@suse.de Found By: --- Blocker: --- Created an attachment (id=557958) --> (http://bugzilla.novell.com/attachment.cgi?id=557958) script session demonstrating the problem User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 Create a MD RAID5 array and run mke2fs on it - breaks. I am running in a virtual machine on virtio "disks" (not sure if that makes a difference). $ uname -a Linux osc.mittagstun.de 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64 x86_64 GNU/Linux $ mdadm --version mdadm - v3.2.6 - 25th October 2012 $ losetup -a /dev/loop8: [64784]:42 (/var/tmp/mdtest8) /dev/loop9: [64784]:43 (/var/tmp/mdtest9) /dev/loop10: [64784]:32 (/var/tmp/mdtest10) /dev/loop11: [64784]:33 (/var/tmp/mdtest11) /dev/loop12: [64784]:34 (/var/tmp/mdtest12) $ mdadm -C /dev/md/r5 -l5 -n5 /dev/loop{8,9,10,11,12} --auto=yes $ cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] md127 : active raid5 loop12[5] loop11[3] loop10[2] loop9[1] loop8[0] 260096 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/5] [UUUUU] $ mke2fs -j /dev/md/r5 mke2fs 1.42.6 (21-Sep-2012) Discarding device blocks: failed - Input/output error Warning: could not erase sector 2: Attempt to write block to filesystem resulted in short write Allocating group tables: done Warning: could not read block 0: Attempt to read block from filesystem resulted in short read [...] Warning: could not erase sector 0: Attempt to write block to filesystem resulted in short write Writing inode tables: Could not write 5 blocks in inode table starting at 259: Attempt to write block to filesystem resulted in short write $ cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] md127 : active raid5 loop12[5](F) loop11[3](F) loop10[2](F) loop9[1](F) loop8[0](F) 260096 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/0] [_____] Reproducible: Always Steps to Reproduce: $ uname -a Linux osc.mittagstun.de 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64 x86_64 GNU/Linux $ mdadm --version mdadm - v3.2.6 - 25th October 2012 $ losetup -a /dev/loop8: [64784]:42 (/var/tmp/mdtest8) /dev/loop9: [64784]:43 (/var/tmp/mdtest9) /dev/loop10: [64784]:32 (/var/tmp/mdtest10) /dev/loop11: [64784]:33 (/var/tmp/mdtest11) /dev/loop12: [64784]:34 (/var/tmp/mdtest12) $ mdadm -C /dev/md/r5 -l5 -n5 /dev/loop{8,9,10,11,12} --auto=yes $ cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] md127 : active raid5 loop12[5] loop11[3] loop10[2] loop9[1] loop8[0] 260096 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/5] [UUUUU] $ mke2fs -j /dev/md/r5 mke2fs 1.42.6 (21-Sep-2012) Discarding device blocks: failed - Input/output error Warning: could not erase sector 2: Attempt to write block to filesystem resulted in short write Allocating group tables: done Warning: could not read block 0: Attempt to read block from filesystem resulted in short read [...] Warning: could not erase sector 0: Attempt to write block to filesystem resulted in short write Writing inode tables: Could not write 5 blocks in inode table starting at 259: Attempt to write block to filesystem resulted in short write $ cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] md127 : active raid5 loop12[5](F) loop11[3](F) loop10[2](F) loop9[1](F) loop8[0](F) 260096 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/0] [_____] Actual Results: The RAID array is broken, any IO on it results in errors. dmesg is full of messages like this: [ 670.401472] sector=1f880 i=0 (null) (null) (null) (null) 1 [ 670.401472] ------------[ cut here ]------------ [ 670.401473] WARNING: at /home/abuild/rpmbuild/BUILD/kernel-desktop-3.7.10/linux-3.7/drivers/md/raid5.c:352 get_active_stripe+0x656/0x750 [raid456]() [ 670.401473] Hardware name: KVM [ 670.401482] Modules linked in: raid456 async_raid6_recov async_pq raid6_pq async_xor xor async_memcpy async_tx loop bnep bluetooth rfkill fuse af_packet snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq snd_timer snd_seq_device snd floppy virtio_net soundcore i2c_piix4 microcode virtio_balloon serio_raw snd_page_alloc pcspkr button autofs4 processor thermal_sys cirrus ttm drm_kms_helper drm sysimgblt sysfillrect syscopyarea scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh virtio_pci ata_generic virtio_blk virtio virtio_ring ata_piix [ 670.401482] Pid: 3809, comm: mke2fs Tainted: G W 3.7.10-1.16-desktop #1 [ 670.401482] Call Trace: [ 670.401484] [<ffffffff81004818>] dump_trace+0x88/0x300 [ 670.401486] [<ffffffff8158af33>] dump_stack+0x69/0x6f [ 670.401488] [<ffffffff81045249>] warn_slowpath_common+0x79/0xc0 [ 670.401490] [<ffffffffa02af016>] get_active_stripe+0x656/0x750 [raid456] [ 670.401495] [<ffffffffa02b454c>] make_request+0x3bc/0x660 [raid456] [ 670.401500] [<ffffffff8143e84b>] md_make_request+0xfb/0x240 [ 670.401502] [<ffffffff8129e3d2>] generic_make_request+0xb2/0x100 [ 670.401504] [<ffffffff8129f021>] submit_bio+0x61/0x130 [ 670.401505] [<ffffffff812a58ef>] blkdev_issue_discard+0x17f/0x250 [ 670.401507] [<ffffffff812a65ec>] blkdev_ioctl+0x39c/0x7d0 [ 670.401509] [<ffffffff811a551c>] block_ioctl+0x3c/0x50 [ 670.401511] [<ffffffff811805bf>] do_vfs_ioctl+0x8f/0x530 [ 670.401512] [<ffffffff81180b00>] sys_ioctl+0xa0/0xc0 [ 670.401514] [<ffffffff8159ecbf>] tracesys+0xe1/0xe6 [ 670.401516] [<00007ff1ec021f27>] 0x7ff1ec021f26 [ 670.401517] ---[ end trace dc0f7e009f4936db ]--- Expected Results: No problem with mke2fs strace of mke2fs indicates that the problem is related to BLKDISCARD ioctls: ioctl(3, BLKDISCARD, {0, 0}) = 0 write(1, "Discarding device blocks: ", 26Discarding device blocks: ) = 26 write(1, " 1024/260096", 13 1024/260096) = 13 write(1, "\10\10\10\10\10\10\10\10\10\10\) = 13 ioctl(3, BLKDISCARD, {100000, 0}) = -1 EIO (Input/output error) write(1, " ", 13 ) = 13 write(1, "\10\10\10\10\10\10\10\10\10\10\) = 13 write(1, "failed - ", 9failed - ) = 9 write(1, "Input/output error", 18Input/output error) = 18 Indeed, mke2fs -j -E nodiscard runs without problems. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.