Skip to content

Commit

Permalink
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/jejb/scsi

Pull SCSI fix from James Bottomley:
 "One final fix before 4.8.

  There was a memory leak triggered by turning scsi mq off due to the
  fact that we assume on host release that the already running hosts
  weren't mq based because that's the state of the global flag (even
  though they were).

  Fix it by tracking this on a per host host basis"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: Avoid that toggling use_blk_mq triggers a memory leak
  • Loading branch information
Linus Torvalds committed Oct 1, 2016
2 parents 2161a2a + 539294b commit f51fdff
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions drivers/scsi/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
else
shost->dma_boundary = 0xffffffff;

shost->use_blk_mq = scsi_use_blk_mq;

device_initialize(&shost->shost_gendev);
dev_set_name(&shost->shost_gendev, "host%d", shost->host_no);
shost->shost_gendev.bus = &scsi_bus_type;
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,6 @@ bool scsi_use_blk_mq = true;
bool scsi_use_blk_mq = false;
#endif
module_param_named(use_blk_mq, scsi_use_blk_mq, bool, S_IWUSR | S_IRUGO);
EXPORT_SYMBOL_GPL(scsi_use_blk_mq);

static int __init init_scsi(void)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/scsi_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern int scsi_init_hosts(void);
extern void scsi_exit_hosts(void);

/* scsi.c */
extern bool scsi_use_blk_mq;
extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
#ifdef CONFIG_SCSI_LOGGING
Expand Down
5 changes: 1 addition & 4 deletions include/scsi/scsi_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,9 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
shost->tmf_in_progress;
}

extern bool scsi_use_blk_mq;

static inline bool shost_use_blk_mq(struct Scsi_Host *shost)
{
return scsi_use_blk_mq;

return shost->use_blk_mq;
}

extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
Expand Down

0 comments on commit f51fdff

Please sign in to comment.