Waiting for uverbs dev file closure in the system forced shutdown [e.g
reboot -f] path locks up the reboot process forever preventing system
shutdown as application closure of this device file is very unlikely at
this time. This closure happens in orderly shutdown [e.g reboot] as
processes are sent SIGTERM.
Orabug:
24918039
Signed-off-by: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
Reviewed-by: Avinash Repaka <avinash.repaka@oracle.com>
if (atomic_dec_and_test(&uverbs_dev->refcount))
ib_uverbs_comp_dev(uverbs_dev);
- wait_for_completion(&uverbs_dev->comp);
+
+ if (system_state == SYSTEM_RUNNING)
+ wait_for_completion(&uverbs_dev->comp);
+
kobject_put(&uverbs_dev->kobj);
}