<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/scsi/device_handler, branch v6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-03-17T03:02:23Z</updated>
<entry>
<title>scsi: scsi_dh_alua: Fix memleak for 'qdata' in alua_activate()</title>
<updated>2023-03-17T03:02:23Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-03-15T06:21:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a13faca032acbf2699293587085293bdfaafc8ae'/>
<id>urn:sha1:a13faca032acbf2699293587085293bdfaafc8ae</id>
<content type='text'>
If alua_rtpg_queue() failed from alua_activate(), then 'qdata' is not
freed, which will cause following memleak:

unreferenced object 0xffff88810b2c6980 (size 32):
  comm "kworker/u16:2", pid 635322, jiffies 4355801099 (age 1216426.076s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    40 39 24 c1 ff ff ff ff 00 f8 ea 0a 81 88 ff ff  @9$.............
  backtrace:
    [&lt;0000000098f3a26d&gt;] alua_activate+0xb0/0x320
    [&lt;000000003b529641&gt;] scsi_dh_activate+0xb2/0x140
    [&lt;000000007b296db3&gt;] activate_path_work+0xc6/0xe0 [dm_multipath]
    [&lt;000000007adc9ace&gt;] process_one_work+0x3c5/0x730
    [&lt;00000000c457a985&gt;] worker_thread+0x93/0x650
    [&lt;00000000cb80e628&gt;] kthread+0x1ba/0x210
    [&lt;00000000a1e61077&gt;] ret_from_fork+0x22/0x30

Fix the problem by freeing 'qdata' in error path.

Fixes: 625fe857e4fa ("scsi: scsi_dh_alua: Check scsi_device_get() return value")
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Link: https://lore.kernel.org/r/20230315062154.668812-1-yukuai1@huaweicloud.com
Reviewed-by: Benjamin Block &lt;bblock@linux.ibm.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi</title>
<updated>2023-02-22T21:41:41Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-02-22T21:41:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8762069330316392331e693befd8a5b632833618'/>
<id>urn:sha1:8762069330316392331e693befd8a5b632833618</id>
<content type='text'>
Pull SCSI updates from James Bottomley:
 "Updates to the usual drivers (ufs, lpfc, qla2xxx, libsas).

  The major core change is a rework to remove the two helpers around
  scsi_execute_cmd and use it as the only submission interface along
  with other minor fixes and updates"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (142 commits)
  scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param()
  scsi: ufs: core: Fix device management cmd timeout flow
  scsi: aic94xx: Add missing check for dma_map_single()
  scsi: smartpqi: Replace one-element array with flexible-array member
  scsi: mpt3sas: Fix a memory leak
  scsi: qla2xxx: Remove the unused variable wwn
  scsi: ufs: core: Fix kernel-doc syntax
  scsi: ufs: core: Add hibernation callbacks
  scsi: snic: Fix memory leak with using debugfs_lookup()
  scsi: ufs: core: Limit DMA alignment check
  scsi: Documentation: Correct spelling
  scsi: Documentation: Correct spelling
  scsi: target: Documentation: Correct spelling
  scsi: aacraid: Allocate cmd_priv with scsicmd
  scsi: ufs: qcom: dt-bindings: Add SM8550 compatible string
  scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW version major 5
  scsi: ufs: qcom: fix platform_msi_domain_free_irqs() reference
  scsi: ufs: core: Enable DMA clustering
  scsi: ufs: exynos: Fix the maximum segment size
  scsi: ufs: exynos: Fix DMA alignment for PAGE_SIZE != 4096
  ...
</content>
</entry>
<entry>
<title>scsi: device_handler: alua: Remove a might_sleep() annotation</title>
<updated>2023-01-19T00:16:02Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2023-01-18T18:05:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0bfe63d075789456e9589457b29d6f9c279e3252'/>
<id>urn:sha1:0bfe63d075789456e9589457b29d6f9c279e3252</id>
<content type='text'>
The might_sleep() annotation in alua_rtpg_queue() is not correct since the
command completion code may call this function from atomic context.
Calling alua_rtpg_queue() from atomic context in the command completion
path is fine since request submitters must hold an sdev reference until
command execution has completed. This patch fixes the following kernel
complaint:

BUG: sleeping function called from invalid context at drivers/scsi/device_handler/scsi_dh_alua.c:992
Call Trace:
 dump_stack_lvl+0xac/0x100
 __might_resched+0x284/0x2c8
 alua_rtpg_queue+0x3c/0x98 [scsi_dh_alua]
 alua_check+0x122/0x250 [scsi_dh_alua]
 alua_check_sense+0x172/0x228 [scsi_dh_alua]
 scsi_check_sense+0x8a/0x2e0
 scsi_decide_disposition+0x286/0x298
 scsi_complete+0x6a/0x108
 blk_complete_reqs+0x6e/0x88
 __do_softirq+0x13e/0x6b8
 __irq_exit_rcu+0x14a/0x170
 irq_exit_rcu+0x22/0x50
 do_ext_irq+0x10a/0x1d0

Link: https://lore.kernel.org/r/20230118180557.1212577-1-bvanassche@acm.org
Reported-by: Steffen Maier &lt;maier@linux.ibm.com&gt;
Reviewed-by: Martin Wilck &lt;mwilck@suse.com&gt;
Tested-by: Steffen Maier &lt;maier@linux.ibm.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: scsi_dh: Convert to scsi_execute_cmd()</title>
<updated>2023-01-14T02:34:08Z</updated>
<author>
<name>Mike Christie</name>
<email>michael.christie@oracle.com</email>
</author>
<published>2022-12-29T19:01:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=31fc28c6b13eedb6da2c60414088c007432436d1'/>
<id>urn:sha1:31fc28c6b13eedb6da2c60414088c007432436d1</id>
<content type='text'>
scsi_execute() is going to be removed. Convert the scsi_dh users to
scsi_execute_cmd().

Signed-off-by: Mike Christie &lt;michael.christie@oracle.com&gt;
Reviewed-by: John Garry &lt;john.g.garry@oracle.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: device_handler: alua: Call scsi_device_put() from non-atomic context</title>
<updated>2022-11-26T00:35:16Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2022-11-17T18:36:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=50759b881e1d6879e7cef15c74bdea2e937338c9'/>
<id>urn:sha1:50759b881e1d6879e7cef15c74bdea2e937338c9</id>
<content type='text'>
Since commit f93ed747e2c7 ("scsi: core: Release SCSI devices
synchronously"), scsi_device_put() might sleep. Avoid calling it from
alua_rtpg_queue() with the pg_lock held. The lock only pretects h-&gt;pg,
anyway. To avoid the pg being freed under us, because of a race with
another thread, take a temporary reference. In alua_rtpg_queue(), verify
that the pg still belongs to the sdev being passed before actually queueing
the RTPG.

This patch fixes the following smatch warning:

drivers/scsi/device_handler/scsi_dh_alua.c:1013 alua_rtpg_queue() warn: sleeping in atomic context

alua_check_vpd() &lt;- disables preempt
-&gt; alua_rtpg_queue()
   -&gt; scsi_device_put()

Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Sachin Sant &lt;sachinp@linux.ibm.com&gt;
Cc: Benjamin Block &lt;bblock@linux.ibm.com&gt;
Suggested-by: Martin Wilck &lt;mwilck@suse.com&gt;
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://lore.kernel.org/r/20221117183626.2656196-3-bvanassche@acm.org
Tested-by: Sachin Sant &lt;sachinp@linux.ibm.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: device_handler: alua: Revert "Move a scsi_device_put() call out of alua_check_vpd()"</title>
<updated>2022-11-26T00:35:03Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2022-11-17T18:36:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a500c4cc06cd2830c692b571dd0a1c3585f23150'/>
<id>urn:sha1:a500c4cc06cd2830c692b571dd0a1c3585f23150</id>
<content type='text'>
There is a bug in commit 0b25e17e9018 ("scsi: alua: Move a
scsi_device_put() call out of alua_check_vpd()"): that patch may cause
alua_rtpg_queue() callers to call scsi_device_put() even if that function
should not be called. Revert that commit to prepare for a different
solution.

Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Cc: Sachin Sant &lt;sachinp@linux.ibm.com&gt;
Cc: Benjamin Block &lt;bblock@linux.ibm.com&gt;
Reported-by: Sachin Sant &lt;sachinp@linux.ibm.com&gt;
Reported-by: Benjamin Block &lt;bblock@linux.ibm.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://lore.kernel.org/r/20221117183626.2656196-2-bvanassche@acm.org
Tested-by: Sachin Sant &lt;sachinp@linux.ibm.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: alua: Move a scsi_device_put() call out of alua_rtpg_select_sdev()</title>
<updated>2022-11-08T03:34:39Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2022-10-31T22:47:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=379e2554e3d10e87c0c0a728ef538f3c26d82a98'/>
<id>urn:sha1:379e2554e3d10e87c0c0a728ef538f3c26d82a98</id>
<content type='text'>
Move a scsi_device_put() call from alua_rtpg_select_sdev() to its
callers. Fixes the following smatch complaint:

drivers/scsi/device_handler/scsi_dh_alua.c:853 alua_rtpg_select_sdev() warn: sleeping in atomic context

alua_rtpg_work() &lt;- disables preempt
-&gt; alua_rtpg_select_sdev()
   -&gt; scsi_device_put()

Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://lore.kernel.org/r/20221031224728.2607760-3-bvanassche@acm.org
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: alua: Move a scsi_device_put() call out of alua_check_vpd()</title>
<updated>2022-11-08T03:34:38Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2022-10-31T22:47:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0b25e17e9018a0ea68a9f0b4787672e8c68fa8d5'/>
<id>urn:sha1:0b25e17e9018a0ea68a9f0b4787672e8c68fa8d5</id>
<content type='text'>
Fix the following smatch warning:

drivers/scsi/device_handler/scsi_dh_alua.c:1013 alua_rtpg_queue() warn: sleeping in atomic context

alua_check_vpd() &lt;- disables preempt
-&gt; alua_rtpg_queue()
   -&gt; scsi_device_put()

Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://lore.kernel.org/r/20221031224728.2607760-2-bvanassche@acm.org
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi/device_handlers: Use the new blk_opf_t type</title>
<updated>2022-07-14T18:14:32Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2022-07-14T18:07:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c15cbe9a84b05462195102bcead0213eb068c595'/>
<id>urn:sha1:c15cbe9a84b05462195102bcead0213eb068c595</id>
<content type='text'>
Improve static type checking by using the new blk_opf_t type for variables
that represent request flags.

Cc: Hannes Reinecke &lt;hare@suse.com&gt;
Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://lore.kernel.org/r/20220714180729.1065367-43-bvanassche@acm.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>scsi: scsi_dh_alua: Properly handle the ALUA transitioning state</title>
<updated>2022-05-02T23:52:13Z</updated>
<author>
<name>Brian Bunker</name>
<email>brian@purestorage.com</email>
</author>
<published>2022-05-02T15:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6056a92ceb2a7705d61df7ec5370548e96aee258'/>
<id>urn:sha1:6056a92ceb2a7705d61df7ec5370548e96aee258</id>
<content type='text'>
The handling of the ALUA transitioning state is currently broken. When a
target goes into this state, it is expected that the target is allowed to
stay in this state for the implicit transition timeout without a path
failure. The handler has this logic, but it gets skipped currently.

When the target transitions, there is in-flight I/O from the initiator. The
first of these responses from the target will be a unit attention letting
the initiator know that the ALUA state has changed.  The remaining
in-flight I/Os, before the initiator finds out that the portal state has
changed, will return not ready, ALUA state is transitioning. The portal
state will change to SCSI_ACCESS_STATE_TRANSITIONING. This will lead to all
new I/O immediately failing the path unexpectedly. The path failure happens
in less than a second instead of the expected successes until the
transition timer is exceeded.

Allow I/Os to continue while the path is in the ALUA transitioning
state. The handler already takes care of a target that stays in the
transitioning state for too long by changing the state to ALUA state
standby once the transition timeout is exceeded at which point the path
will fail.

Link: https://lore.kernel.org/r/CAHZQxy+4sTPz9+pY3=7VJH+CLUJsDct81KtnR2be8ycN5mhqTg@mail.gmail.com
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Acked-by: Krishna Kant &lt;krishna.kant@purestorage.com&gt;
Acked-by: Seamus Connor &lt;sconnor@purestorage.com&gt;
Signed-off-by: Brian Bunker &lt;brian@purestorage.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
</feed>
