Skip to content

Commit 41592e2

Browse files
committed
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull one more module fix from Rusty Russell: "SCSI was using module_refcount() to figure out when the module was unloading: this broke with new atomic refcounting. The code is still suspicious, but this solves the WARN_ON()" * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: scsi: always increment reference count
2 parents 4adca1c + dc4515e commit 41592e2

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/scsi/scsi.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -986,9 +986,9 @@ int scsi_device_get(struct scsi_device *sdev)
986986
return -ENXIO;
987987
if (!get_device(&sdev->sdev_gendev))
988988
return -ENXIO;
989-
/* We can fail this if we're doing SCSI operations
989+
/* We can fail try_module_get if we're doing SCSI operations
990990
* from module exit (like cache flush) */
991-
try_module_get(sdev->host->hostt->module);
991+
__module_get(sdev->host->hostt->module);
992992

993993
return 0;
994994
}
@@ -1004,14 +1004,7 @@ EXPORT_SYMBOL(scsi_device_get);
10041004
*/
10051005
void scsi_device_put(struct scsi_device *sdev)
10061006
{
1007-
#ifdef CONFIG_MODULE_UNLOAD
1008-
struct module *module = sdev->host->hostt->module;
1009-
1010-
/* The module refcount will be zero if scsi_device_get()
1011-
* was called from a module removal routine */
1012-
if (module && module_refcount(module) != 0)
1013-
module_put(module);
1014-
#endif
1007+
module_put(sdev->host->hostt->module);
10151008
put_device(&sdev->sdev_gendev);
10161009
}
10171010
EXPORT_SYMBOL(scsi_device_put);

0 commit comments

Comments
 (0)