Commit 41592e2f authored by Linus Torvalds's avatar Linus Torvalds

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
parents 4adca1cb dc4515ea
...@@ -986,9 +986,9 @@ int scsi_device_get(struct scsi_device *sdev) ...@@ -986,9 +986,9 @@ int scsi_device_get(struct scsi_device *sdev)
return -ENXIO; return -ENXIO;
if (!get_device(&sdev->sdev_gendev)) if (!get_device(&sdev->sdev_gendev))
return -ENXIO; return -ENXIO;
/* We can fail this if we're doing SCSI operations /* We can fail try_module_get if we're doing SCSI operations
* from module exit (like cache flush) */ * from module exit (like cache flush) */
try_module_get(sdev->host->hostt->module); __module_get(sdev->host->hostt->module);
return 0; return 0;
} }
...@@ -1004,14 +1004,7 @@ EXPORT_SYMBOL(scsi_device_get); ...@@ -1004,14 +1004,7 @@ EXPORT_SYMBOL(scsi_device_get);
*/ */
void scsi_device_put(struct scsi_device *sdev) void scsi_device_put(struct scsi_device *sdev)
{ {
#ifdef CONFIG_MODULE_UNLOAD module_put(sdev->host->hostt->module);
struct module *module = sdev->host->hostt->module;
/* The module refcount will be zero if scsi_device_get()
* was called from a module removal routine */
if (module && module_refcount(module) != 0)
module_put(module);
#endif
put_device(&sdev->sdev_gendev); put_device(&sdev->sdev_gendev);
} }
EXPORT_SYMBOL(scsi_device_put); EXPORT_SYMBOL(scsi_device_put);
......
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