Commit f2d928f9 authored by Quentin Bouget's avatar Quentin Bouget Committed by Greg Kroah-Hartman

staging: lustre: lnet: potential deadlock in lnet

Fixes potential deadlock in LNetMDAttach
Signed-off-by: default avatarQuentin Bouget <quentin.bouget.ocre@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8249
Reviewed-on: http://review.whamcloud.com/20676Reviewed-by: default avatarDoug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarHenri Doreau <henri.doreau@cea.fr>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a1194ad6
...@@ -292,11 +292,12 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, ...@@ -292,11 +292,12 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd,
return -ENOMEM; return -ENOMEM;
rc = lnet_md_build(md, &umd, unlink); rc = lnet_md_build(md, &umd, unlink);
if (rc)
goto out_free;
cpt = lnet_cpt_of_cookie(meh.cookie); cpt = lnet_cpt_of_cookie(meh.cookie);
lnet_res_lock(cpt); lnet_res_lock(cpt);
if (rc)
goto failed;
me = lnet_handle2me(&meh); me = lnet_handle2me(&meh);
if (!me) if (!me)
...@@ -307,7 +308,7 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, ...@@ -307,7 +308,7 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd,
rc = lnet_md_link(md, umd.eq_handle, cpt); rc = lnet_md_link(md, umd.eq_handle, cpt);
if (rc) if (rc)
goto failed; goto out_unlock;
/* /*
* attach this MD to portal of ME and check if it matches any * attach this MD to portal of ME and check if it matches any
...@@ -324,10 +325,10 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, ...@@ -324,10 +325,10 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd,
return 0; return 0;
failed: out_unlock:
lnet_md_free(md);
lnet_res_unlock(cpt); lnet_res_unlock(cpt);
out_free:
lnet_md_free(md);
return rc; return rc;
} }
EXPORT_SYMBOL(LNetMDAttach); EXPORT_SYMBOL(LNetMDAttach);
...@@ -370,24 +371,25 @@ LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle) ...@@ -370,24 +371,25 @@ LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle)
return -ENOMEM; return -ENOMEM;
rc = lnet_md_build(md, &umd, unlink); rc = lnet_md_build(md, &umd, unlink);
if (rc)
goto out_free;
cpt = lnet_res_lock_current(); cpt = lnet_res_lock_current();
if (rc)
goto failed;
rc = lnet_md_link(md, umd.eq_handle, cpt); rc = lnet_md_link(md, umd.eq_handle, cpt);
if (rc) if (rc)
goto failed; goto out_unlock;
lnet_md2handle(handle, md); lnet_md2handle(handle, md);
lnet_res_unlock(cpt); lnet_res_unlock(cpt);
return 0; return 0;
failed: out_unlock:
lnet_res_unlock(cpt);
out_free:
lnet_md_free(md); lnet_md_free(md);
lnet_res_unlock(cpt);
return rc; return rc;
} }
EXPORT_SYMBOL(LNetMDBind); EXPORT_SYMBOL(LNetMDBind);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment