From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, jejb@linux.vnet.ibm.com,
hare@suse.de, bvanassche@acm.org, hch@infradead.org
Subject: [PATCH v4 18/22] sg: add some __must_hold macros
Date: Wed, 28 Aug 2019 22:26:55 -0400 [thread overview]
Message-ID: <20190829022659.23130-19-dgilbert@interlog.com> (raw)
In-Reply-To: <20190829022659.23130-1-dgilbert@interlog.com>
In the case of sg_wait_open_event() which calls mutex_unlock on
sdp->open_rel_lock and later calls mutex_lock on the same
lock; this macro is needed to stop sparse complaining. In
other cases it is a reminder to the coder (a precondition).
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
---
drivers/scsi/sg.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 904f3ac8add7..187e85b215d5 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -379,6 +379,7 @@ sg_check_file_access(struct file *filp, const char *caller)
static int
sg_wait_open_event(struct sg_device *sdp, bool o_excl)
+ __must_hold(&sdp->open_rel_lock)
{
int res = 0;
@@ -1506,6 +1507,7 @@ sg_get_dur(struct sg_request *srp, const enum sg_rq_state *sr_stp,
static void
sg_fill_request_element(struct sg_fd *sfp, struct sg_request *srp,
struct sg_req_info *rip)
+ __must_hold(&sfp->rq_list_lock)
{
spin_lock(&srp->req_lck);
rip->duration = sg_get_dur(srp, NULL, NULL);
@@ -1627,6 +1629,7 @@ sg_ctl_sg_io(struct file *filp, struct sg_device *sdp, struct sg_fd *sfp,
*/
static int
sg_set_reserved_sz(struct sg_fd *sfp, int want_rsv_sz)
+ __must_hold(&sfp->f_mutex)
{
bool use_new_srp = false;
int res = 0;
@@ -3547,6 +3550,7 @@ sg_remove_sfp(struct kref *kref)
static int
sg_idr_max_id(int id, void *p, void *data)
+ __must_hold(&sg_index_lock)
{
int *k = data;
@@ -3855,6 +3859,7 @@ sg_proc_seq_show_devstrs(struct seq_file *s, void *v)
/* Writes debug info for one sg_request in obp buffer */
static int
sg_proc_debug_sreq(struct sg_request *srp, int to, char *obp, int len)
+ __must_hold(&sfp->rq_list_lock)
{
bool is_v3v4, v4, is_dur;
int n = 0;
@@ -3890,6 +3895,7 @@ sg_proc_debug_sreq(struct sg_request *srp, int to, char *obp, int len)
/* Writes debug info for one sg fd (including its sg requests) in obp buffer */
static int
sg_proc_debug_fd(struct sg_fd *fp, char *obp, int len)
+ __must_hold(&sfp->rq_list_lock)
{
bool first_fl;
int n = 0;
@@ -3939,6 +3945,7 @@ sg_proc_debug_fd(struct sg_fd *fp, char *obp, int len)
/* Writes debug info for one sg device (including its sg fds) in obp buffer */
static int
sg_proc_debug_sdev(struct sg_device *sdp, char *obp, int len, int *fd_counterp)
+ __must_hold(&sdp->sfd_lock)
{
int n = 0;
int my_count = 0;
--
2.23.0
next prev parent reply other threads:[~2019-08-29 2:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 2:26 [PATCH v4 00/22] sg: add v4 interface Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 01/22] sg: move functions around Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 02/22] sg: remove typedefs, type+formatting cleanup Douglas Gilbert
2019-08-29 7:36 ` Johannes Thumshirn
2019-08-29 2:26 ` [PATCH v4 03/22] sg: sg_log and is_enabled Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 04/22] sg: rework sg_poll(), minor changes Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 05/22] sg: bitops in sg_device Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 06/22] sg: make open count an atomic Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 07/22] sg: move header to uapi section Douglas Gilbert
2019-08-29 11:15 ` kbuild test robot
2019-08-29 15:47 ` Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 08/22] sg: speed sg_poll and sg_get_num_waiting Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 09/22] sg: sg_allow_if_err_recovery and renames Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 10/22] sg: remove access_ok functions Douglas Gilbert
2019-09-09 14:55 ` Hannes Reinecke
2019-08-29 2:26 ` [PATCH v4 11/22] sg: replace rq array with lists Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 12/22] sg: sense buffer rework Douglas Gilbert
2019-09-09 15:01 ` Hannes Reinecke
2019-09-09 18:37 ` Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 13/22] sg: add sg v4 interface support Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 14/22] sg: rework debug info Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 15/22] sg: add 8 byte SCSI LUN to sg_scsi_id Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 16/22] sg: expand sg_comm_wr_t Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 17/22] sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls Douglas Gilbert
2019-08-29 2:26 ` Douglas Gilbert [this message]
2019-08-29 2:26 ` [PATCH v4 19/22] sg: move procfs objects to avoid forward decls Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 20/22] sg: first debugfs support Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 21/22] sg: warn v3 write system call users Douglas Gilbert
2019-08-29 2:26 ` [PATCH v4 22/22] sg: bump version to 4.0.03 Douglas Gilbert
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=20190829022659.23130-19-dgilbert@interlog.com \
--to=dgilbert@interlog.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.