staging: lustre: obd: cleanup client import if client_obd_setup fails
authorSwapnil Pimpale <spimpale@ddn.com>
Thu, 28 Apr 2016 01:37:14 +0000 (21:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Apr 2016 04:53:18 +0000 (21:53 -0700)
client_obd_setup() allocates an obd_import which should be cleaned up
if there is any failure afterwards in callers of client_obd_setup().
This patch fixes the bug in osc_setup(), mgc_setup(), mdc_setup() and
lwp_setup(). The fix is to call obd_cleanup_client_import() before
calling client_obd_cleanup() in case of an error.

Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3810
Reviewed-on: http://review.whamcloud.com/7561
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c

index 32486b21711467a2d9bd20d835d3f83420802684..47911361e236566f95280e2afdfd15d629d13f1c 100644 (file)
@@ -438,6 +438,7 @@ int client_obd_cleanup(struct obd_device *obddev)
        ldlm_namespace_free_post(obddev->obd_namespace);
        obddev->obd_namespace = NULL;
 
+       obd_cleanup_client_import(obddev);
        LASSERT(!obddev->u.cli.cl_import);
 
        ldlm_put_ref();