union ctl_io *io;
struct uio xuio;
struct iovec *xiovec;
- int flags;
- int error, i;
+ size_t s;
+ int error, flags, i;
DPRINTF("entered\n");
VOP_UNLOCK(be_lun->vn, 0);
SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0);
+ if (error == 0 && xuio.uio_resid > 0) {
+ /*
+ * If we red less then requested (EOF), then
+ * we should clean the rest of the buffer.
+ */
+ s = beio->io_len - xuio.uio_resid;
+ for (i = 0; i < beio->num_segs; i++) {
+ if (s >= beio->sg_segs[i].len) {
+ s -= beio->sg_segs[i].len;
+ continue;
+ }
+ bzero((uint8_t *)beio->sg_segs[i].addr + s,
+ beio->sg_segs[i].len - s);
+ s = 0;
+ }
+ }
} else {
struct mount *mountpoint;
int lock_flags;