Skip to content

Add explicit DMU_DIRECTIO checks #17342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions module/zfs/dmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ dmu_read_uio_dnode(dnode_t *dn, zfs_uio_t *uio, uint64_t size,
dmu_buf_t **dbp;
int numbufs, i, err;

if (uio->uio_extflg & UIO_DIRECT)
if ((flags & DMU_DIRECTIO) && (uio->uio_extflg & UIO_DIRECT))
return (dmu_read_uio_direct(dn, uio, size, flags));
flags &= ~DMU_DIRECTIO;

Expand Down Expand Up @@ -1489,7 +1489,7 @@ dmu_write_uio_dnode(dnode_t *dn, zfs_uio_t *uio, uint64_t size, dmu_tx_t *tx,
* We only allow Direct I/O writes to happen if we are block
* sized aligned. Otherwise, we pass the write off to the ARC.
*/
if ((uio->uio_extflg & UIO_DIRECT) &&
if ((flags & DMU_DIRECTIO) && (uio->uio_extflg & UIO_DIRECT) &&
(write_size >= dn->dn_datablksz)) {
if (zfs_dio_aligned(zfs_uio_offset(uio), write_size,
dn->dn_datablksz)) {
Expand Down Expand Up @@ -1564,10 +1564,12 @@ dmu_write_uio_dnode(dnode_t *dn, zfs_uio_t *uio, uint64_t size, dmu_tx_t *tx,

dmu_buf_rele_array(dbp, numbufs, FTAG);

if ((uio->uio_extflg & UIO_DIRECT) && size > 0) {
if ((oflags & DMU_DIRECTIO) && (uio->uio_extflg & UIO_DIRECT) &&
err == 0 && size > 0) {
flags = oflags;
goto top;
}
IMPLY(err == 0, size == 0);

return (err);
}
Expand Down
Loading