mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
IB/srp: Semaphore to mutex conversion
Convert srp_host->target_mutex from a semaphore to a mutex. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
cbd2981a97
commit
8e9e5f4f5e
2 changed files with 9 additions and 10 deletions
|
@ -357,9 +357,9 @@ static void srp_remove_work(void *target_ptr)
|
||||||
target->state = SRP_TARGET_REMOVED;
|
target->state = SRP_TARGET_REMOVED;
|
||||||
spin_unlock_irq(target->scsi_host->host_lock);
|
spin_unlock_irq(target->scsi_host->host_lock);
|
||||||
|
|
||||||
down(&target->srp_host->target_mutex);
|
mutex_lock(&target->srp_host->target_mutex);
|
||||||
list_del(&target->list);
|
list_del(&target->list);
|
||||||
up(&target->srp_host->target_mutex);
|
mutex_unlock(&target->srp_host->target_mutex);
|
||||||
|
|
||||||
scsi_remove_host(target->scsi_host);
|
scsi_remove_host(target->scsi_host);
|
||||||
ib_destroy_cm_id(target->cm_id);
|
ib_destroy_cm_id(target->cm_id);
|
||||||
|
@ -1254,9 +1254,9 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
|
||||||
if (scsi_add_host(target->scsi_host, host->dev->dma_device))
|
if (scsi_add_host(target->scsi_host, host->dev->dma_device))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
down(&host->target_mutex);
|
mutex_lock(&host->target_mutex);
|
||||||
list_add_tail(&target->list, &host->target_list);
|
list_add_tail(&target->list, &host->target_list);
|
||||||
up(&host->target_mutex);
|
mutex_unlock(&host->target_mutex);
|
||||||
|
|
||||||
target->state = SRP_TARGET_LIVE;
|
target->state = SRP_TARGET_LIVE;
|
||||||
|
|
||||||
|
@ -1525,7 +1525,7 @@ static struct srp_host *srp_add_port(struct ib_device *device, u8 port)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&host->target_list);
|
INIT_LIST_HEAD(&host->target_list);
|
||||||
init_MUTEX(&host->target_mutex);
|
mutex_init(&host->target_mutex);
|
||||||
init_completion(&host->released);
|
init_completion(&host->released);
|
||||||
host->dev = device;
|
host->dev = device;
|
||||||
host->port = port;
|
host->port = port;
|
||||||
|
@ -1626,7 +1626,7 @@ static void srp_remove_one(struct ib_device *device)
|
||||||
* Mark all target ports as removed, so we stop queueing
|
* Mark all target ports as removed, so we stop queueing
|
||||||
* commands and don't try to reconnect.
|
* commands and don't try to reconnect.
|
||||||
*/
|
*/
|
||||||
down(&host->target_mutex);
|
mutex_lock(&host->target_mutex);
|
||||||
list_for_each_entry_safe(target, tmp_target,
|
list_for_each_entry_safe(target, tmp_target,
|
||||||
&host->target_list, list) {
|
&host->target_list, list) {
|
||||||
spin_lock_irqsave(target->scsi_host->host_lock, flags);
|
spin_lock_irqsave(target->scsi_host->host_lock, flags);
|
||||||
|
@ -1634,7 +1634,7 @@ static void srp_remove_one(struct ib_device *device)
|
||||||
target->state = SRP_TARGET_REMOVED;
|
target->state = SRP_TARGET_REMOVED;
|
||||||
spin_unlock_irqrestore(target->scsi_host->host_lock, flags);
|
spin_unlock_irqrestore(target->scsi_host->host_lock, flags);
|
||||||
}
|
}
|
||||||
up(&host->target_mutex);
|
mutex_unlock(&host->target_mutex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait for any reconnection tasks that may have
|
* Wait for any reconnection tasks that may have
|
||||||
|
|
|
@ -37,8 +37,7 @@
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <asm/semaphore.h>
|
|
||||||
|
|
||||||
#include <scsi/scsi_host.h>
|
#include <scsi/scsi_host.h>
|
||||||
#include <scsi/scsi_cmnd.h>
|
#include <scsi/scsi_cmnd.h>
|
||||||
|
@ -85,7 +84,7 @@ struct srp_host {
|
||||||
struct ib_mr *mr;
|
struct ib_mr *mr;
|
||||||
struct class_device class_dev;
|
struct class_device class_dev;
|
||||||
struct list_head target_list;
|
struct list_head target_list;
|
||||||
struct semaphore target_mutex;
|
struct mutex target_mutex;
|
||||||
struct completion released;
|
struct completion released;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue