RDMA/rnbd: Fix compilation error when CONFIG_MODULES is disabled
authorDanil Kipnis <danil.kipnis@cloud.ionos.com>
Thu, 21 May 2020 18:59:09 +0000 (20:59 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 22 May 2020 18:50:22 +0000 (15:50 -0300)
commitcdb685cb9158fa67f6f4584ea39279ed7ae39253
treed2acae747ebb20ddc93aa5eabb32df75a36a42a4
parent63a3345c2d42a9b29e1ce2d3a4043689b3995cea
RDMA/rnbd: Fix compilation error when CONFIG_MODULES is disabled

module_is_live function is only defined when CONFIG_MODULES is enabled.
Use try_module_get instead to check whether the module is being removed.

When module unload and manuall unmapping is happening in parallel, we can
try removing the symlink twice: rnbd_client_exit
vs. rnbd_clt_unmap_dev_store.

This is probably not the best way to deal with this race in general, but
for now this fixes the compilation issue when CONFIG_MODULES is disabled
and has no functional impact. Regression tests passed.

Fixes: 1eb54f8f5dd8 ("block/rnbd: client: sysfs interface functions")
Link: https://lore.kernel.org/r/20200521185909.457245-1-danil.kipnis@cloud.ionos.com
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Suggested-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Danil Kipnis <danil.kipnis@cloud.ionos.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/block/rnbd/rnbd-clt-sysfs.c