diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2022-04-21 19:57:24 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2022-04-21 19:57:24 +0000 |
| commit | 914dc91d12198352b7878a88d30e2a6373a936e1 (patch) | |
| tree | c8d1717c62bbac51ceeaa3ef0197996bccbc38eb /stand | |
| parent | 92e40a9b9241313b3d16543819ccd8d642bb11a5 (diff) | |
Diffstat (limited to 'stand')
| -rw-r--r-- | stand/libsa/zfs/zfsimpl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index ceaeeb2e77f3..2240eb765c41 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -2350,6 +2350,19 @@ dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, } /* + * 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. */ |
