[PATCH v4 18/22] sg: add some __must_hold macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux