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
0172ee525b
commit
1f055436f3
|
@ -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);
|
||||||
|
@ -794,10 +794,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(MSEC_TO_TICK(10));
|
schedule_timeout(MSEC_TO_TICK(10));
|
||||||
goto retry;
|
goto retry;
|
||||||
|
@ -819,7 +819,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