Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2019-08-18 21:02:14 -07:00
4 changed files with 18 additions and 0 deletions

View File

@@ -2892,6 +2892,9 @@ struct scst_device {
*/
struct percpu_ref refcnt;
/* Triggered when refcnt drops to zero. */
struct completion *remove_completion;
struct work_struct free_work;
/*

View File

@@ -4218,7 +4218,10 @@ static void scst_free_device(struct work_struct *work)
static void scst_release_device(struct percpu_ref *ref)
{
struct scst_device *dev = container_of(ref, typeof(*dev), refcnt);
struct completion *c = dev->remove_completion;
if (c)
complete(c);
schedule_work(&dev->free_work);
}

View File

@@ -1179,6 +1179,7 @@ static void scst_unregister_device(struct scsi_device *scsidp)
{
struct scst_device *dev;
struct scst_acg_dev *acg_dev, *aa;
DECLARE_COMPLETION_ONSTACK(c);
TRACE_ENTRY();
@@ -1207,6 +1208,8 @@ static void scst_unregister_device(struct scsi_device *scsidp)
scst_acg_del_lun(acg_dev->acg, acg_dev->lun, true);
}
dev->remove_completion = &c;
mutex_unlock(&scst_mutex);
scst_dev_sysfs_del(dev);
@@ -1218,6 +1221,8 @@ static void scst_unregister_device(struct scsi_device *scsidp)
percpu_ref_kill(&dev->refcnt);
percpu_ref_put(&dev->refcnt);
wait_for_completion(&c);
out:
TRACE_EXIT();
return;
@@ -1441,6 +1446,7 @@ void scst_unregister_virtual_device(int id,
{
struct scst_device *d, *dev = NULL;
struct scst_acg_dev *acg_dev, *aa;
DECLARE_COMPLETION_ONSTACK(c);
TRACE_ENTRY();
@@ -1473,6 +1479,8 @@ void scst_unregister_virtual_device(int id,
scst_acg_del_lun(acg_dev->acg, acg_dev->lun, true);
}
dev->remove_completion = &c;
mutex_unlock(&scst_mutex);
scst_dev_sysfs_del(dev);
@@ -1486,6 +1494,8 @@ void scst_unregister_virtual_device(int id,
percpu_ref_kill(&dev->refcnt);
percpu_ref_put(&dev->refcnt);
wait_for_completion(&c);
out:
TRACE_EXIT();
return;

View File

@@ -1972,6 +1972,8 @@ static ssize_t __scst_acg_cpu_mask_show(struct scst_acg *acg, char *buf)
#endif
if (!cpumask_equal(&acg->acg_cpu_mask, &default_cpu_mask))
res += sprintf(&buf[res], "\n%s\n", SCST_SYSFS_KEY_MARK);
else
res += sprintf(&buf[res], "\n");
return res;
}