linux/zvol_os: fix SET_ERROR with negative return codes

SET_ERROR is our facility for tracking errors internally. The negation
is to match the what the kernel expects from us. Thus, the negation
should happen outside of the SET_ERROR.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16364
This commit is contained in:
Rob Norris 2024-07-18 13:13:44 +10:00 committed by Brian Behlendorf
parent 9b9a3934ad
commit 88aab1d2d0
1 changed files with 4 additions and 4 deletions

View File

@ -730,7 +730,7 @@ retry:
#endif
if (zv == NULL) {
rw_exit(&zvol_state_lock);
return (SET_ERROR(-ENXIO));
return (-SET_ERROR(ENXIO));
}
mutex_enter(&zv->zv_state_lock);
@ -795,10 +795,10 @@ retry:
#ifdef HAVE_BLKDEV_GET_ERESTARTSYS
schedule();
return (SET_ERROR(-ERESTARTSYS));
return (-SET_ERROR(ERESTARTSYS));
#else
if ((gethrtime() - start) > timeout)
return (SET_ERROR(-ERESTARTSYS));
return (-SET_ERROR(ERESTARTSYS));
schedule_timeout_interruptible(
MSEC_TO_TICK(10));
@ -821,7 +821,7 @@ retry:
if (zv->zv_open_count == 0)
zvol_last_close(zv);
error = SET_ERROR(-EROFS);
error = -SET_ERROR(EROFS);
} else {
zv->zv_open_count++;
}