Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jan 2016 01:06:37 +0000 (UTC)
From:      Steven Hartland <smh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r294059 - head/sys/boot/common
Message-ID:  <201601150106.u0F16bN2017199@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: smh
Date: Fri Jan 15 01:06:37 2016
New Revision: 294059
URL: https://svnweb.freebsd.org/changeset/base/294059

Log:
  Ensure boot fsread correctly probes all partitions
  
  The boot code fsread was caching the result of meta data request and
  reusing it even for calls with inode = 0, which is used to partitions
  trigger a probe.
  
  The result was that success was incorrectly returned for all partition
  probes after the first valid success, even for partitions which are not
  UFS.
  
  MFC after:	2 weeks
  X-MFC-With:	r293268
  Sponsored by:	Multiplay

Modified:
  head/sys/boot/common/ufsread.c

Modified: head/sys/boot/common/ufsread.c
==============================================================================
--- head/sys/boot/common/ufsread.c	Fri Jan 15 00:55:36 2016	(r294058)
+++ head/sys/boot/common/ufsread.c	Fri Jan 15 01:06:37 2016	(r294059)
@@ -187,8 +187,15 @@ fsread(ufs_ino_t inode, void *buf, size_
 
 	blkbuf = dmadat->blkbuf;
 	indbuf = dmadat->indbuf;
-	if (!dsk_meta) {
+
+	/*
+	 * Force probe if inode is zero to ensure we have a valid fs, otherwise
+	 * when probing multiple paritions, reads from subsequent parititions
+	 * will incorrectly succeed.
+	 */
+	if (!dsk_meta || inode == 0) {
 		inomap = 0;
+		dsk_meta = 0;
 		for (n = 0; sblock_try[n] != -1; n++) {
 			if (dskread(dmadat->sbbuf, sblock_try[n] / DEV_BSIZE,
 			    SBLOCKSIZE / DEV_BSIZE))



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