isert-scst: Fix a race condition that was introduced accidentally in r7184

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7186 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2017-05-16 02:04:47 +00:00
parent b2b15e1d55
commit 81f80e1708

View File

@@ -62,11 +62,14 @@ void isert_portal_list_remove(struct isert_portal *portal)
void isert_decrease_portal_cnt(void)
{
int portal_cnt;
spin_lock(&isert_glob.portal_lock);
WARN_ON_ONCE(isert_glob.portal_cnt <= 0);
portal_cnt = --isert_glob.portal_cnt;
spin_unlock(&isert_glob.portal_lock);
if (--isert_glob.portal_cnt == 0)
if (portal_cnt == 0)
wake_up_all(&isert_glob.portal_wq);
}