From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>
Cc: Minwoo Im <minwoo.im.dev@gmail.com>, linux-nvme@lists.infradead.org
Subject: [PATCH 1/7] nvme: open code nvme_put_ns_from_disk in nvme_ns_head_chr_ioctl
Date: Thu, 20 May 2021 07:44:20 +0200 [thread overview]
Message-ID: <20210520054426.567241-2-hch@lst.de> (raw)
In-Reply-To: <20210520054426.567241-1-hch@lst.de>
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>
---
drivers/nvme/host/ioctl.c | 12 +++++-------
1 file 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 */
--
2.30.2
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-05-20 5:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-20 5:44 misc nvme ioctl cleanups Christoph Hellwig
2021-05-20 5:44 ` Christoph Hellwig [this message]
2021-05-20 5:44 ` [PATCH 2/7] nvne: open code nvme_{get, put}_ns_from_disk in nvme_ns_head_ioctl Christoph Hellwig
2021-05-20 5:44 ` [PATCH 3/7] nvme: open code nvme_put_ns_from_disk in nvme_ns_head_ctrl_ioctl Christoph Hellwig
2021-05-20 5:44 ` [PATCH 4/7] nvme: add a sparse annotation to nvme_ns_head_ctrl_ioctl Christoph Hellwig
2021-05-20 5:44 ` [PATCH 5/7] nvme: move the CSI sanity check into nvme_ns_report_zones Christoph Hellwig
2021-05-20 5:44 ` [PATCH 6/7] nvme: split nvme_report_zones Christoph Hellwig
2021-05-20 5:44 ` [PATCH 7/7] nvme: remove nvme_{get,put}_ns_from_disk Christoph Hellwig
2021-05-20 15:38 ` misc nvme ioctl cleanups Keith Busch
2021-05-20 22:36 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210520054426.567241-2-hch@lst.de \
--to=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=minwoo.im.dev@gmail.com \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox