Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2009 10:23:55 -0600
From:      Robert Noland <rnoland@FreeBSD.org>
To:        Emil Smolenski <ambsd@raisa.eu.org>
Cc:        freebsd-fs@freebsd.org, freebsd-current@freebsd.org, Matt Reimer <mattjreimer@gmail.com>
Subject:   Re: Boot with ZFS on single disk: "ZFS: i/o error - all block copies unavailable" [was: Re: GPT boot with ZFS RAIDZ "ZFS: i/o error - all block copies unavailable"]
Message-ID:  <1258647835.2303.105.camel@balrog.2hip.net>
In-Reply-To: <op.u3m0dyn8qvde5b@am-laptop.local.org>
References:  <op.u3hw9wl0qvde5b@am-laptop.local.org> <1258390784.2303.42.camel@balrog.2hip.net> <op.u3h252qaqvde5b@bolt.zol> <op.u3j6m8w5qvde5b@bolt.zol> <1258497221.2303.66.camel@balrog.2hip.net> <op.u3kdq613qvde5b@bolt.zol> <1258552247.2303.75.camel@balrog.2hip.net> <op.u3llw0plqvde5b@am-laptop.local.org> <1258562628.2303.83.camel@balrog.2hip.net> <f383264b0911181548r3b9cce46i449e4e589148a62d@mail.gmail.com> <1258603057.2303.92.camel@balrog.2hip.net> <op.u3m0dyn8qvde5b@am-laptop.local.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-BDiV+OcYAkHUcmXfsTdc
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Thu, 2009-11-19 at 11:21 +0100, Emil Smolenski wrote:
> Matt Reimer wrote:
> > Robert's on to something. It looks like your LBAs are probably
> > overflowing 32 bits. This would affect all vdev regardless of type.
> > Try the attached patch.
> 
> Robert Noland wrote:
> >> 220000de400
> > This divided by 512 byte block size is 33 bits... At a glance, the patch
> > looks ok to me.  I'll do a more thorough review of this tomorrow.
> 
> Unfortunately it don't work. Error is the same as before:

Ok, I was concerned about the assembly code... So, I've been chatting
with jhb@ this morning.  Please try this patch that jhb@ came up with
instead of Matt's latest patch.

robert.
  
> ZFS: i/o error - all block copies unavailable
> ZFS: can't read MOS
> ZFS: unexpected object set type 0
> ZFS: unexpected object set type 0
> 
> FreeBSD/i386 boot
> Default: pgpool:/boot/kernel/kernel
> boot:
> ZFS: unexpected object set type 0
> 
> 
> This is 7.2-STABLE, amd64. My test procedure:
> 
> 1. I fully synchronized these zfsboot-related directories with -CURRENT:
> 
> src/sys/boot/i386/zfsboot
> src/sys/boot/zfs
> src/sys/cddl/boot/zfs
> 
> 2. I applied Matt Reimer's zfsboot.c.patch3 patch:
> 
> # cd /usr/src/sys/boot/
> # patch < /path/to/zfsboot.c.patch3
> 
> 3. Then I did:
> 
> # make clean; make cleandir
> # make obj ; make depend ; make
> # cd i386/loader
> # make install
> # cd /usr/src/sys/boot/i386/zfsboot
> # make install
> # sysctl kern.geom.debugflags=16
> # dd if=/boot/zfsboot of=/dev/da0 count=1
> # dd if=/boot/zfsboot of=/dev/da0 skip=1 seek=1024
> # reboot
> 
> 4. Result: error shown above.
> 
> Thanks!
> 
-- 
Robert Noland <rnoland@FreeBSD.org>
FreeBSD

--=-BDiV+OcYAkHUcmXfsTdc
Content-Disposition: attachment; filename="zfsboot_64.patch"
Content-Type: text/x-patch; name="zfsboot_64.patch"; charset="us-ascii"
Content-Transfer-Encoding: 7bit

--- //depot/user/jhb/boot/sys/boot/i386/zfsboot/zfsboot.c
+++ /home/jhb/work/p4/boot/sys/boot/i386/zfsboot/zfsboot.c
@@ -138,8 +138,8 @@
     unsigned unit;
     unsigned slice;
     unsigned part;
-    unsigned start;
     int init;
+    daddr_t start;
 };
 static char cmd[512];
 static char kname[1024];
@@ -163,7 +163,7 @@
 static void printf(const char *,...);
 static void putchar(int);
 static uint32_t memsize(void);
-static int drvread(struct dsk *, void *, unsigned, unsigned);
+static int drvread(struct dsk *, void *, daddr_t, unsigned);
 static int keyhit(unsigned);
 static int xputc(int);
 static int xgetc(int);
@@ -310,7 +310,8 @@
 vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes)
 {
 	char *p;
-	unsigned int lba, nb;
+	daddr_t lba;
+	unsigned int nb;
 	struct dsk *dsk = (struct dsk *) priv;
 
 	if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1)))
@@ -964,7 +965,7 @@
 #endif
 
 static int
-drvread(struct dsk *dsk, void *buf, unsigned lba, unsigned nblk)
+drvread(struct dsk *dsk, void *buf, daddr_t lba, unsigned nblk)
 {
 #ifdef GPT
     static unsigned c = 0x2d5c7c2f;
@@ -999,7 +1000,7 @@
     v86.es = VTOPSEG(buf);
     v86.eax = lba;
     v86.ebx = VTOPOFF(buf);
-    v86.ecx = lba >> 16;
+    v86.ecx = lba >> 32;
     v86.edx = nblk << 8 | dsk->drive;
     v86int();
     v86.ctl = V86_FLAGS;
--- //depot/user/jhb/boot/sys/boot/i386/zfsboot/zfsldr.S
+++ /home/jhb/work/p4/boot/sys/boot/i386/zfsboot/zfsldr.S
@@ -80,10 +80,10 @@
 
 		.org 0x25,0x90
 /*
- * Trampoline used by boot2 to call read to read data from the disk via
+ * Trampoline used by zfsboot to call read to read data from the disk via
  * the BIOS.  Call with:
  *
- * %cx:%ax	- long    - LBA to read in
+ * %ecx:%eax	- long    - LBA to read in
  * %es:(%bx)	- caddr_t - buffer to read data into
  * %dl		- byte    - drive to read from
  * %dh		- byte    - num sectors to read
@@ -94,10 +94,8 @@
 /*
  * Setup an EDD disk packet and pass it to read
  */
-xread.1:					# Starting
-		pushl $0x0			#  absolute
-		push %cx			#  block
-		push %ax			#  number
+xread.1:	pushl %ecx			# Starting absolute block
+		pushl %eax			#  block number
 		push %es			# Address of
 		push %bx			#  transfer buffer
 		xor %ax,%ax			# Number of
@@ -245,10 +243,11 @@
 /*
  * Trampoline used to call read from within boot1.
  */
-nread:		xor %ax,%ax			# Sector offset in partition
+nread:		xor %eax,%eax			# Sector offset in partition
 nread.1:	mov $MEM_BUF,%bx		# Transfer buffer
-		add 0x8(%si),%ax		# Get
-		mov 0xa(%si),%cx		#  LBA
+		xor %ecx,%ecx			# Get
+		addl 0x8(%si),%eax		#  LBA
+		adc $0,%ecx
 		push %cs			# Read from
 		callw xread.1	 		#  disk
 		jnc return			# If success, return

--=-BDiV+OcYAkHUcmXfsTdc--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1258647835.2303.105.camel>