aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/ioctl.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-05-19 09:02:59 +0200
committerChristoph Hellwig <hch@lst.de>2021-06-03 10:29:25 +0300
commitf423c85cd392241f1521887b1396038cd1e4c68e (patch)
tree623607f6496b093f19144aa3b02326af421fdf70 /drivers/nvme/host/ioctl.c
parentnvme-fabrics: remove extra braces (diff)
downloadlinux-dev-f423c85cd392241f1521887b1396038cd1e4c68e.tar.xz
linux-dev-f423c85cd392241f1521887b1396038cd1e4c68e.zip
nvme: open code nvme_put_ns_from_disk in nvme_ns_head_chr_ioctl
nvme_ns_head_chr_ioctl is always used on multipath nodes, so just call srcu_read_unlock and consolidate the two unlock paths. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'drivers/nvme/host/ioctl.c')
-rw-r--r--drivers/nvme/host/ioctl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index 9557ead02de1..0341767ff2e7 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -419,21 +419,19 @@ long nvme_ns_head_chr_ioctl(struct file *file, unsigned int cmd,
container_of(cdev, struct nvme_ns_head, cdev);
void __user *argp = (void __user *)arg;
struct nvme_ns *ns;
- int srcu_idx, ret;
+ int srcu_idx, ret = -EWOULDBLOCK;
srcu_idx = srcu_read_lock(&head->srcu);
ns = nvme_find_path(head);
- if (!ns) {
- srcu_read_unlock(&head->srcu, srcu_idx);
- return -EWOULDBLOCK;
- }
+ if (!ns)
+ goto out_unlock;
if (is_ctrl_ioctl(cmd))
return nvme_ns_head_ctrl_ioctl(ns, cmd, argp, head, srcu_idx);
ret = nvme_ns_ioctl(ns, cmd, argp);
- nvme_put_ns_from_disk(head, srcu_idx);
-
+out_unlock:
+ srcu_read_unlock(&head->srcu, srcu_idx);
return ret;
}
#endif /* CONFIG_NVME_MULTIPATH */