mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
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 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
#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 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
|
||||
#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 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
if (zv->zv_open_count == 0)
|
||||
zvol_last_close(zv);
|
||||
|
||||
error = SET_ERROR(-EROFS);
|
||||
error = -SET_ERROR(EROFS);
|
||||
} else {
|
||||
zv->zv_open_count++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user