mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
stand: zfs: handle holes at the tail end correctly
This mirrors dmu_read_impl(), zeroing out the tail end of the buffer and clipping the read to what's contained by the block that exists. This fixes an issue that arose during the 13.1 release process; in 13.1-RC1 and later, setting up GELI+ZFS will result in a failure to boot. The culprit is this, which causes us to fail to load geom_eli.ko as there's a residual portion after the single datablk that should be zeroed out. PR: 263407 Reviewed by: tsoome MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D35019
This commit is contained in:
parent
92e40a9b92
commit
914dc91d12
@ -2349,6 +2349,19 @@ dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset,
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle odd block sizes, mirrors dmu_read_impl(). Data can't exist
|
||||
* past the first block, so we'll clip the read to the portion of the
|
||||
* buffer within bsize and zero out the remainder.
|
||||
*/
|
||||
if (dnode->dn_maxblkid == 0) {
|
||||
size_t newbuflen;
|
||||
|
||||
newbuflen = offset > bsize ? 0 : MIN(buflen, bsize - offset);
|
||||
bzero((char *)buf + newbuflen, buflen - newbuflen);
|
||||
buflen = newbuflen;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: bsize may not be a power of two here so we need to do an
|
||||
* actual divide rather than a bitshift.
|
||||
|
Loading…
Reference in New Issue
Block a user