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
This commit is contained in:
Steven Hartland 2016-01-15 01:06:37 +00:00
parent dc9ba0270b
commit 108d68faae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=294059

View file

@ -187,8 +187,15 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte)
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))