Date: Fri, 24 May 2013 12:19:44 +1000 From: Lawrence Stewart <lstewart@freebsd.org> To: freebsd-current@freebsd.org Cc: Nigel Williams <njwilliams@swin.edu.au> Subject: Read-triggered corruption of swap backed MD devices Message-ID: <519ECE40.5020901@freebsd.org>
next in thread | raw e-mail | index | archive | help
Hi all, I tracked the cause of a colleague's nanobsd image creation problem to what appears to be some nasty behaviour with swap-backed MD devices. I've verified the behaviour exists on three separate systems running 10-CURRENT r250260, 9-STABLE r250824 and 9-STABLE r250925. The following minimal reproduction recipe (run as root) deterministically triggers the behaviour for me on the 3 systems I've tested: env MD_DEV=`mdconfig -an -t swap -s 1m -x 63 -y 16` sh -c '(fdisk -I md${MD_DEV} ; bsdlabel -w -B md${MD_DEV}s1 ; bsdlabel md${MD_DEV}s1 ; dd if=/dev/md${MD_DEV} of=/dev/null bs=64k ; bsdlabel md${MD_DEV}s1 ; mdconfig -d -u ${MD_DEV})' By changing the mdconfig "-t swap" argument to "-t malloc", the bsdlabel remains intact after the dd command completes. I've included command line recipe runs from my 10-CURRENT r250260 laptop with both "-t swap" and "-t malloc" at the end of this email for reference. Smells like a VM related problem to me, but ENOCLUE so I would appreciate some help. Cheers, Lawrence root@lstewart-laptop:~ # uname -a FreeBSD lstewart-laptop 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r250260: Wed May 22 15:57:40 EST 2013 root@lstewart-laptop:/usr/obj/usr/src/sys/GENERIC amd64 root@lstewart-laptop:~ # env MD_DEV=`mdconfig -an -t swap -s 1m -x 63 -y 16` sh -c '(fdisk -I md${MD_DEV} ; bsdlabel -w -B md${MD_DEV}s1 ; bsdlabel md${MD_DEV}s1 ; dd if=/dev/md${MD_DEV} of=/dev/null bs=64k ; bsdlabel md${MD_DEV}s1 ; mdconfig -d -u ${MD_DEV})' ******* Working on device /dev/md0 ******* fdisk: invalid fdisk partition table found # /dev/md0s1: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 1937 16 unused 0 0 c: 1953 0 unused 0 0 # "raw" part, don't edit 16+0 records in 16+0 records out 1048576 bytes transferred in 0.001728 secs (606794497 bytes/sec) bsdlabel: /dev/md0s1: no valid label found root@lstewart-laptop:~ # env MD_DEV=`mdconfig -an -t malloc -s 1m -x 63 -y 16` sh -c '(fdisk -I md${MD_DEV} ; bsdlabel -w -B md${MD_DEV}s1 ; bsdlabel md${MD_DEV}s1 ; dd if=/dev/md${MD_DEV} of=/dev/null bs=64k ; bsdlabel md${MD_DEV}s1 ; mdconfig -d -u ${MD_DEV})' ******* Working on device /dev/md0 ******* fdisk: invalid fdisk partition table found # /dev/md0s1: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 1937 16 unused 0 0 c: 1953 0 unused 0 0 # "raw" part, don't edit 16+0 records in 16+0 records out 1048576 bytes transferred in 0.001251 secs (838202118 bytes/sec) # /dev/md0s1: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 1937 16 unused 0 0 c: 1953 0 unused 0 0 # "raw" part, don't edit
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?519ECE40.5020901>