From 1f055436f3a2d64823ca45636d409a8715d871a3 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Thu, 18 Jul 2024 13:13:44 +1000 Subject: [PATCH] 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 Reviewed-by: Brian Behlendorf Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris Closes #16364 --- module/os/linux/zfs/zvol_os.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 129e3606bb..01692d5c85 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -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); @@ -794,10 +794,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(MSEC_TO_TICK(10)); goto retry; @@ -819,7 +819,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++; }