Skip to content

Commit ee35624

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: libfc: Add lockdep annotations
Convert the free text locking notes into proper lockdep annotations. Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d5038a1 commit ee35624

File tree

3 files changed

+99
-140
lines changed

3 files changed

+99
-140
lines changed

drivers/scsi/libfc/fc_disc.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,14 @@ static void fc_disc_restart(struct fc_disc *);
5959
/**
6060
* fc_disc_stop_rports() - Delete all the remote ports associated with the lport
6161
* @disc: The discovery job to stop remote ports on
62-
*
63-
* Locking Note: This function expects that the lport mutex is locked before
64-
* calling it.
6562
*/
6663
static void fc_disc_stop_rports(struct fc_disc *disc)
6764
{
6865
struct fc_lport *lport;
6966
struct fc_rport_priv *rdata;
7067

7168
lport = fc_disc_lport(disc);
69+
lockdep_assert_held(&lport->lp_mutex);
7270

7371
rcu_read_lock();
7472
list_for_each_entry_rcu(rdata, &disc->rports, peers) {
@@ -84,9 +82,6 @@ static void fc_disc_stop_rports(struct fc_disc *disc)
8482
* fc_disc_recv_rscn_req() - Handle Registered State Change Notification (RSCN)
8583
* @disc: The discovery object to which the RSCN applies
8684
* @fp: The RSCN frame
87-
*
88-
* Locking Note: This function expects that the disc_mutex is locked
89-
* before it is called.
9085
*/
9186
static void fc_disc_recv_rscn_req(struct fc_disc *disc, struct fc_frame *fp)
9287
{
@@ -101,6 +96,8 @@ static void fc_disc_recv_rscn_req(struct fc_disc *disc, struct fc_frame *fp)
10196
LIST_HEAD(disc_ports);
10297
struct fc_disc_port *dp, *next;
10398

99+
lockdep_assert_held(&disc->disc_mutex);
100+
104101
lport = fc_disc_lport(disc);
105102

106103
FC_DISC_DBG(disc, "Received an RSCN event\n");
@@ -220,12 +217,11 @@ static void fc_disc_recv_req(struct fc_lport *lport, struct fc_frame *fp)
220217
/**
221218
* fc_disc_restart() - Restart discovery
222219
* @disc: The discovery object to be restarted
223-
*
224-
* Locking Note: This function expects that the disc mutex
225-
* is already locked.
226220
*/
227221
static void fc_disc_restart(struct fc_disc *disc)
228222
{
223+
lockdep_assert_held(&disc->disc_mutex);
224+
229225
if (!disc->disc_callback)
230226
return;
231227

@@ -271,16 +267,13 @@ static void fc_disc_start(void (*disc_callback)(struct fc_lport *,
271267
* fc_disc_done() - Discovery has been completed
272268
* @disc: The discovery context
273269
* @event: The discovery completion status
274-
*
275-
* Locking Note: This function expects that the disc mutex is locked before
276-
* it is called. The discovery callback is then made with the lock released,
277-
* and the lock is re-taken before returning from this function
278270
*/
279271
static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
280272
{
281273
struct fc_lport *lport = fc_disc_lport(disc);
282274
struct fc_rport_priv *rdata;
283275

276+
lockdep_assert_held(&disc->disc_mutex);
284277
FC_DISC_DBG(disc, "Discovery complete\n");
285278

286279
disc->pending = 0;
@@ -360,15 +353,14 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp)
360353
/**
361354
* fc_disc_gpn_ft_req() - Send Get Port Names by FC-4 type (GPN_FT) request
362355
* @lport: The discovery context
363-
*
364-
* Locking Note: This function expects that the disc_mutex is locked
365-
* before it is called.
366356
*/
367357
static void fc_disc_gpn_ft_req(struct fc_disc *disc)
368358
{
369359
struct fc_frame *fp;
370360
struct fc_lport *lport = fc_disc_lport(disc);
371361

362+
lockdep_assert_held(&disc->disc_mutex);
363+
372364
WARN_ON(!fc_lport_test_ready(lport));
373365

374366
disc->pending = 1;
@@ -658,15 +650,14 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
658650
* @lport: The local port to initiate discovery on
659651
* @rdata: remote port private data
660652
*
661-
* Locking Note: This function expects that the disc_mutex is locked
662-
* before it is called.
663653
* On failure, an error code is returned.
664654
*/
665655
static int fc_disc_gpn_id_req(struct fc_lport *lport,
666656
struct fc_rport_priv *rdata)
667657
{
668658
struct fc_frame *fp;
669659

660+
lockdep_assert_held(&lport->disc.disc_mutex);
670661
fp = fc_frame_alloc(lport, sizeof(struct fc_ct_hdr) +
671662
sizeof(struct fc_ns_fid));
672663
if (!fp)
@@ -683,14 +674,13 @@ static int fc_disc_gpn_id_req(struct fc_lport *lport,
683674
* fc_disc_single() - Discover the directory information for a single target
684675
* @lport: The local port the remote port is associated with
685676
* @dp: The port to rediscover
686-
*
687-
* Locking Note: This function expects that the disc_mutex is locked
688-
* before it is called.
689677
*/
690678
static int fc_disc_single(struct fc_lport *lport, struct fc_disc_port *dp)
691679
{
692680
struct fc_rport_priv *rdata;
693681

682+
lockdep_assert_held(&lport->disc.disc_mutex);
683+
694684
rdata = fc_rport_create(lport, dp->port_id);
695685
if (!rdata)
696686
return -ENOMEM;

0 commit comments

Comments
 (0)