Whamcloud - gitweb
LU-14178 ldlm: return error from ldlm_namespace_new() 51/40851/3
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 3 Dec 2020 09:40:35 +0000 (02:40 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 21:06:10 +0000 (21:06 +0000)
commite9c3b89bdacdb90332e386ae5ddff03cd8e977df
tree7c8f9fe5742ba5d916a0a8bf9c2d10e7c22e76e7
parent9d2776f02b67354b58e9ff93bd7fe5b5495ee288
LU-14178 ldlm: return error from ldlm_namespace_new()

Return the underlying error in ldlm_namespace_new() from
ldlm_namespace_sysfs_register() to the caller instead of NULL.
Otherwise, the callers convert the NULL to -ENOMEM and this
is incorrectly reported as an allocation error to the user.

  sysfs: cannot create duplicate filename
     '/fs/lustre/ldlm/namespaces/lustre-OST0002-osc-ffff89f33be70000'
  mount.lustre: mount mgs:/lfs at /lfs failed: Cannot allocate memory

Change ldlm_namespace_new() to return errors via PTR_ERR() and
change the callers to use IS_ERR().

Fix associated CERROR() messages to follow proper code style.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I7d590c7242399549b32b1c4189e46ff8748c8096
Reviewed-on: https://review.whamcloud.com/40851
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_resource.c
lustre/mdt/mdt_handler.c
lustre/mgs/mgs_handler.c
lustre/obdecho/echo.c
lustre/ofd/ofd_dev.c