diff options
author | James Smart <jsmart2021@gmail.com> | 2017-05-05 19:13:15 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-05-20 12:11:34 -0400 |
commit | 85e6a6adf8de7f992e01d2c3c59d9875d658b276 (patch) | |
tree | 976bd6605e25f8f874837b5803b31aa4333cb566 | |
parent | 4123109050a869a8871e58a50f28f383d41e49ad (diff) |
nvme-fc: require target or discovery role for fc-nvme targets
In order to create an association, the remoteport must be
serving either a target role or a discovery role.
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/nvme/host/fc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 70e689bf1cad..912d457150d5 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
@@ -2720,6 +2720,12 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, | |||
2720 | unsigned long flags; | 2720 | unsigned long flags; |
2721 | int ret, idx; | 2721 | int ret, idx; |
2722 | 2722 | ||
2723 | if (!(rport->remoteport.port_role & | ||
2724 | (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) { | ||
2725 | ret = -EBADR; | ||
2726 | goto out_fail; | ||
2727 | } | ||
2728 | |||
2723 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | 2729 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); |
2724 | if (!ctrl) { | 2730 | if (!ctrl) { |
2725 | ret = -ENOMEM; | 2731 | ret = -ENOMEM; |