Whamcloud - gitweb
LU-14802 nodemap: return proper error code 26/45626/9
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 19 Nov 2021 21:51:09 +0000 (14:51 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 31 Jan 2022 01:43:52 +0000 (01:43 +0000)
commit7d6cddff24de2f79e539eae462554dc21e674511
treeb92b3979dac6d77d131fd17fde3649abb2f9d626
parentfbbc1258a057ff718dd9ba41dc32faf2aadc3a90
LU-14802 nodemap: return proper error code

In nodemap_add_range_helper() it was always returning -ENOMEM when
there was an error inserting a new range into the existing nodemap.

    nodemap_add_range_helper()) cannot insert nodemap range: rc = -17
    mgs_iocontrol_nodemap()) MGS: OBD_IOC_NODEMAP command: rc = -12

This was confusing because the error returned by range_insert() was
typically -EEXIST (i.e. the entry being inserted already was in the
nodemap).  Do not print an error to the console in this common case.

Return the actual error to the caller so that this is more clear
to the end user.  Have l_ioctl() always set errno on error, in
addition to returning the error, since many callers depend on this.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I2c80a11dfdf9e6e1c9a8235b8f74f5bcea68c08e
Reviewed-on: https://review.whamcloud.com/45626
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Etienne AUJAMES <eaujames@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/util/l_ioctl.c
lustre/mgs/mgs_handler.c
lustre/ptlrpc/nodemap_handler.c
lustre/utils/liblustreapi.c
lustre/utils/obd.c