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:
parent
9b9a3934ad
commit
88aab1d2d0
|
@ -730,7 +730,7 @@ retry:
|
||||||
#endif
|
#endif
|
||||||
if (zv == NULL) {
|
if (zv == NULL) {
|
||||||
rw_exit(&zvol_state_lock);
|
rw_exit(&zvol_state_lock);
|
||||||
return (SET_ERROR(-ENXIO));
|
return (-SET_ERROR(ENXIO));
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_enter(&zv->zv_state_lock);
|
mutex_enter(&zv->zv_state_lock);
|
||||||
|
@ -795,10 +795,10 @@ retry:
|
||||||
|
|
||||||
#ifdef HAVE_BLKDEV_GET_ERESTARTSYS
|
#ifdef HAVE_BLKDEV_GET_ERESTARTSYS
|
||||||
schedule();
|
schedule();
|
||||||
return (SET_ERROR(-ERESTARTSYS));
|
return (-SET_ERROR(ERESTARTSYS));
|
||||||
#else
|
#else
|
||||||
if ((gethrtime() - start) > timeout)
|
if ((gethrtime() - start) > timeout)
|
||||||
return (SET_ERROR(-ERESTARTSYS));
|
return (-SET_ERROR(ERESTARTSYS));
|
||||||
|
|
||||||
schedule_timeout_interruptible(
|
schedule_timeout_interruptible(
|
||||||
MSEC_TO_TICK(10));
|
MSEC_TO_TICK(10));
|
||||||
|
@ -821,7 +821,7 @@ retry:
|
||||||
if (zv->zv_open_count == 0)
|
if (zv->zv_open_count == 0)
|
||||||
zvol_last_close(zv);
|
zvol_last_close(zv);
|
||||||
|
|
||||||
error = SET_ERROR(-EROFS);
|
error = -SET_ERROR(EROFS);
|
||||||
} else {
|
} else {
|
||||||
zv->zv_open_count++;
|
zv->zv_open_count++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue