All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jsmart2021@gmail.com
Cc: linux-pm@vger.kernel.org
Subject: [bug report] scsi: elx: efct: LIO backend interface routines
Date: Tue, 31 Aug 2021 14:26:24 +0300	[thread overview]
Message-ID: <20210831112624.GA24558@kili> (raw)

Hello James Smart,

The patch 692e5d73a811: "scsi: elx: efct: LIO backend interface
routines" from Jun 1, 2021, leads to the following
Smatch static checker warning:

	drivers/base/power/sysfs.c:833 dpm_sysfs_remove()
	warn: sleeping in atomic context

drivers/base/power/sysfs.c
    829 void dpm_sysfs_remove(struct device *dev)
    830 {
    831         if (device_pm_not_required(dev))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
If this is true then the warning is a false positive.

    832                 return;
--> 833         sysfs_unmerge_group(&dev->kobj, &pm_qos_latency_tolerance_attr_group);

It's the down_read() in kernfs_find_and_get_ns() that sleeps.

    834         dev_pm_qos_constraints_destroy(dev);
    835         rpm_sysfs_remove(dev);
    836         sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group);
    837         sysfs_remove_group(&dev->kobj, &pm_attr_group);
    838 }

The call tree is:

efct_lio_npiv_drop_nport() <- disables preempt
-> fc_vport_terminate()
   -> device_del()
      -> dpm_sysfs_remove()

drivers/scsi/elx/efct/efct_lio.c
   875  efct_lio_npiv_drop_nport(struct se_wwn *wwn)
   876  {
   877          struct efct_lio_vport *lio_vport =
   878                  container_of(wwn, struct efct_lio_vport, vport_wwn);
   879          struct efct_lio_vport_list_t *vport, *next_vport;
   880          struct efct *efct = lio_vport->efct;
   881          unsigned long flags = 0;
   882  
   883          spin_lock_irqsave(&efct->tgt_efct.efct_lio_lock, flags);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Holding a lock.

   884  
   885          if (lio_vport->fc_vport)
   886                  fc_vport_terminate(lio_vport->fc_vport);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sleeps on the success path unless device_pm_not_required() is true in
dpm_sysfs_remove().

   887  
   888          list_for_each_entry_safe(vport, next_vport, &efct->tgt_efct.vport_list,
   889                                   list_entry) {
   890                  if (vport->lio_vport == lio_vport) {
   891                          list_del(&vport->list_entry);
   892                          kfree(vport->lio_vport);
   893                          kfree(vport);
   894                          break;
   895                  }
   896          }
   897          spin_unlock_irqrestore(&efct->tgt_efct.efct_lio_lock, flags);
   898  }

regards,
dan carpenter

             reply	other threads:[~2021-08-31 11:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 11:26 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-06-18  5:28 [bug report] scsi: elx: efct: LIO backend interface routines Dan Carpenter

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=20210831112624.GA24558@kili \
    --to=dan.carpenter@oracle.com \
    --cc=jsmart2021@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    /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.