<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/scsi/scsi_sysfs.c, branch linux-3.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-03-16T02:18:32Z</updated>
<entry>
<title>scsi: avoid a permanent stop of the scsi device's request queue</title>
<updated>2017-03-16T02:18:32Z</updated>
<author>
<name>Wei Fang</name>
</author>
<published>2016-12-13T01:25:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b6dea3028237a589bb7180563b13e08f5b4f4798'/>
<id>urn:sha1:b6dea3028237a589bb7180563b13e08f5b4f4798</id>
<content type='text'>
commit d2a145252c52792bc59e4767b486b26c430af4bb upstream.

A race between scanning and fc_remote_port_delete() may result in a
permanent stop if the device gets blocked before scsi_sysfs_add_sdev()
and unblocked after.  The reason is that blocking a device sets both the
SDEV_BLOCKED state and the QUEUE_FLAG_STOPPED.  However,
scsi_sysfs_add_sdev() unconditionally sets SDEV_RUNNING which causes the
device to be ignored by scsi_target_unblock() and thus never have its
QUEUE_FLAG_STOPPED cleared leading to a device which is apparently
running but has a stopped queue.

We actually have two places where SDEV_RUNNING is set: once in
scsi_add_lun() which respects the blocked flag and once in
scsi_sysfs_add_sdev() which doesn't.  Since the second set is entirely
spurious, simply remove it to fix the problem.

Reported-by: Zengxi Chen &lt;chenzengxi@huawei.com&gt;
Signed-off-by: Wei Fang &lt;fangwei1@huawei.com&gt;
Reviewed-by: Ewan D. Milne &lt;emilne@redhat.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>scsi_sysfs: Fix queue_ramp_up_period return code</title>
<updated>2015-11-27T12:48:24Z</updated>
<author>
<name>Peter Oberparleiter</name>
</author>
<published>2015-10-27T09:49:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=74d26be3e560b7d8b2abca3dcb5430e9893d1767'/>
<id>urn:sha1:74d26be3e560b7d8b2abca3dcb5430e9893d1767</id>
<content type='text'>
commit 863e02d0e173bb9d8cea6861be22820b25c076cc upstream.

Writing a number to /sys/bus/scsi/devices/&lt;sdev&gt;/queue_ramp_up_period
returns the value of that number instead of the number of bytes written.
This behavior can confuse programs expecting POSIX write() semantics.
Fix this by returning the number of bytes written instead.

Signed-off-by: Peter Oberparleiter &lt;oberpar@linux.vnet.ibm.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Matthew R. Ochs &lt;mrochs@linux.vnet.ibm.com&gt;
Reviewed-by: Ewan D. Milne &lt;emilne@redhat.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>scsi: restart list search after unlock in scsi_remove_target</title>
<updated>2015-11-27T12:48:23Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2015-10-19T14:35:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67022ef102acafab56301d3e87ba7c4a3ee1b406'/>
<id>urn:sha1:67022ef102acafab56301d3e87ba7c4a3ee1b406</id>
<content type='text'>
commit 40998193560dab6c3ce8d25f4fa58a23e252ef38 upstream.

When dropping a lock while iterating a list we must restart the search
as other threads could have manipulated the list under us.  Without this
we can get stuck in an endless loop.  This bug was introduced by

commit bc3f02a795d3b4faa99d37390174be2a75d091bd
Author: Dan Williams &lt;djbw@fb.com&gt;
Date:   Tue Aug 28 22:12:10 2012 -0700

    [SCSI] scsi_remove_target: fix softlockup regression on hot remove

Which was itself trying to fix a reported soft lockup issue

http://thread.gmane.org/gmane.linux.kernel/1348679

However, we believe even with this revert of the original patch, the soft
lockup problem has been fixed by

commit f2495e228fce9f9cec84367547813cbb0d6db15a
Author: James Bottomley &lt;JBottomley@Parallels.com&gt;
Date:   Tue Jan 21 07:01:41 2014 -0800

    [SCSI] dual scan thread bug fix

Thanks go to Dan Williams &lt;dan.j.williams@intel.com&gt; for tracking all this
prior history down.

Reported-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Tested-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Fixes: bc3f02a795d3b4faa99d37390174be2a75d091bd
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>fix our current target reap infrastructure</title>
<updated>2014-07-11T12:33:56Z</updated>
<author>
<name>James Bottomley</name>
</author>
<published>2014-01-21T15:00:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=181086c6cc8a186f26bbb87872e48bb7973fdc28'/>
<id>urn:sha1:181086c6cc8a186f26bbb87872e48bb7973fdc28</id>
<content type='text'>
commit e63ed0d7a98014fdfc2cfeb3f6dada313dcabb59 upstream.

This patch eliminates the reap_ref and replaces it with a proper kref.
On last put of this kref, the target is removed from visibility in
sysfs.  The final call to scsi_target_reap() for the device is done from
__scsi_remove_device() and only if the device was made visible.  This
ensures that the target disappears as soon as the last device is gone
rather than waiting until final release of the device (which is often
too long).

Reviewed-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Tested-by: Sarah Sharp &lt;sarah.a.sharp@linux.intel.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>Stop accepting SCSI requests before removing a device</title>
<updated>2014-07-11T12:33:55Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2012-06-29T15:36:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b5a10549d528827aa331c1d95a6170032718babe'/>
<id>urn:sha1:b5a10549d528827aa331c1d95a6170032718babe</id>
<content type='text'>
commit b485462aca7df4e32bcf7efb6f84a69e8b640243 upstream.

Avoid that the code for requeueing SCSI requests triggers a
crash by making sure that that code isn't scheduled anymore
after a device has been removed.

Also, source code inspection of __scsi_remove_device() revealed
a race condition in this function: no new SCSI requests must be
accepted for a SCSI device after device removal started.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Reviewed-by: Mike Christie &lt;michaelc@cs.wisc.edu&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>prevent stack buffer overflow in host_reset</title>
<updated>2013-01-03T03:33:21Z</updated>
<author>
<name>Sasha Levin</name>
</author>
<published>2012-11-15T20:51:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=567fd40fe65a51594d7745827226f93d9a40ec6f'/>
<id>urn:sha1:567fd40fe65a51594d7745827226f93d9a40ec6f</id>
<content type='text'>
commit 072f19b4bea31cdd482d79f805413f2f9ac9e233 upstream.

store_host_reset() has tried to re-invent the wheel to compare sysfs strings.
Unfortunately it did so poorly and never bothered to check the input from
userspace before overwriting stack with it, so something simple as:

echo "WoopsieWoopsie" &gt;
/sys/devices/pseudo_0/adapter0/host0/scsi_host/host0/host_reset

would result in:

[  316.310101] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff81f5bac7
[  316.310101]
[  316.320051] Pid: 6655, comm: sh Tainted: G        W    3.7.0-rc5-next-20121114-sasha-00016-g5c9d68d-dirty #129
[  316.320051] Call Trace:
[  316.340058] pps pps0: PPS event at 1352918752.620355751
[  316.340062] pps pps0: capture assert seq #303
[  316.320051]  [&lt;ffffffff83b3856b&gt;] panic+0xcd/0x1f4
[  316.320051]  [&lt;ffffffff81f5bac7&gt;] ? store_host_reset+0xd7/0x100
[  316.320051]  [&lt;ffffffff8110b996&gt;] __stack_chk_fail+0x16/0x20
[  316.320051]  [&lt;ffffffff81f5bac7&gt;] store_host_reset+0xd7/0x100
[  316.320051]  [&lt;ffffffff81e55bb3&gt;] dev_attr_store+0x13/0x30
[  316.320051]  [&lt;ffffffff812f7db1&gt;] sysfs_write_file+0x101/0x170
[  316.320051]  [&lt;ffffffff8127acc8&gt;] vfs_write+0xb8/0x180
[  316.320051]  [&lt;ffffffff8127ae80&gt;] sys_write+0x50/0xa0
[  316.320051]  [&lt;ffffffff83c03418&gt;] tracesys+0xe1/0xe6

Fix this by uninventing whatever was going on there and just use sysfs_streq.

Bug introduced by 29443691 ("[SCSI] scsi: Added support for adapter and
firmware reset").

[jejb: added necessary const to prevent compile warnings]
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>scsi_remove_target: fix softlockup regression on hot remove</title>
<updated>2012-10-17T02:48:50Z</updated>
<author>
<name>Dan Williams</name>
</author>
<published>2012-08-29T05:12:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=85764e725e7dc6374aece7e6859c48c14c14a4fa'/>
<id>urn:sha1:85764e725e7dc6374aece7e6859c48c14c14a4fa</id>
<content type='text'>
commit bc3f02a795d3b4faa99d37390174be2a75d091bd upstream.

John reports:
 BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
 [..]
 Call Trace:
  [&lt;ffffffff8141782a&gt;] scsi_remove_target+0xda/0x1f0
  [&lt;ffffffff81421de5&gt;] sas_rphy_remove+0x55/0x60
  [&lt;ffffffff81421e01&gt;] sas_rphy_delete+0x11/0x20
  [&lt;ffffffff81421e35&gt;] sas_port_delete+0x25/0x160
  [&lt;ffffffff814549a3&gt;] mptsas_del_end_device+0x183/0x270

...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".

Don't restart lookup of more stargets in the multi-target case, just
arrange to traverse the list once, on the assumption that new targets
are always added at the end.  There is no guarantee that the target will
change state in scsi_target_reap() so we can end up spinning if we
restart.

Acked-by: Jack Wang &lt;jack_wang@usish.com&gt;
LKML-Reference: &lt;CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com&gt;
Reported-by: John Drescher &lt;drescherjm@gmail.com&gt;
Tested-by: John Drescher &lt;drescherjm@gmail.com&gt;
Signed-off-by: Dan Williams &lt;djbw@fb.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>fix hot unplug vs async scan race</title>
<updated>2012-08-02T13:37:55Z</updated>
<author>
<name>Dan Williams</name>
</author>
<published>2012-06-22T06:47:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f60c4d00f7e25849c1e743cf66fde70bdac63dae'/>
<id>urn:sha1:f60c4d00f7e25849c1e743cf66fde70bdac63dae</id>
<content type='text'>
commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.

The following crash results from cases where the end_device has been
removed before scsi_sysfs_add_sdev has had a chance to run.

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
 IP: [&lt;ffffffff8115e100&gt;] sysfs_create_dir+0x32/0xb6
 ...
 Call Trace:
  [&lt;ffffffff8125e4a8&gt;] kobject_add_internal+0x120/0x1e3
  [&lt;ffffffff81075149&gt;] ? trace_hardirqs_on+0xd/0xf
  [&lt;ffffffff8125e641&gt;] kobject_add_varg+0x41/0x50
  [&lt;ffffffff8125e70b&gt;] kobject_add+0x64/0x66
  [&lt;ffffffff8131122b&gt;] device_add+0x12d/0x63a
  [&lt;ffffffff814b65ea&gt;] ? _raw_spin_unlock_irqrestore+0x47/0x56
  [&lt;ffffffff8107de15&gt;] ? module_refcount+0x89/0xa0
  [&lt;ffffffff8132f348&gt;] scsi_sysfs_add_sdev+0x4e/0x28a
  [&lt;ffffffff8132dcbb&gt;] do_scan_async+0x9c/0x145

...teach scsi_sysfs_add_devices() to check for deleted devices() before
trying to add them, and teach scsi_remove_target() how to remove targets
that have not been added via device_add().

Reported-by: Dariusz Majchrzak &lt;dariusz.majchrzak@intel.com&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>Fix device removal NULL pointer dereference</title>
<updated>2012-08-02T13:37:54Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2012-06-29T15:33:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c63d964e3f093b858a6f06875a68bc4206f71ba'/>
<id>urn:sha1:9c63d964e3f093b858a6f06875a68bc4206f71ba</id>
<content type='text'>
commit 67bd94130015c507011af37858989b199c52e1de upstream.

Use blk_queue_dead() to test whether the queue is dead instead
of !sdev. Since scsi_prep_fn() may be invoked concurrently with
__scsi_remove_device(), keep the queuedata (sdev) pointer in
__scsi_remove_device(). This patch fixes a kernel oops that
can be triggered by USB device removal. See also
http://www.spinics.net/lists/linux-scsi/msg56254.html.

Other changes included in this patch:
- Swap the blk_cleanup_queue() and kfree() calls in
  scsi_host_dev_release() to make that code easier to grasp.
- Remove the queue dead check from scsi_run_queue() since the
  queue state can change anyway at any point in that function
  where the queue lock is not held.
- Remove the queue dead check from the start of scsi_request_fn()
  since it is redundant with the scsi_device_online() check.

Reported-by: Jun'ichi Nomura &lt;j-nomura@ce.jp.nec.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Reviewed-by: Mike Christie &lt;michaelc@cs.wisc.edu&gt;
Reviewed-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>[SCSI] scsi: Added support for adapter and firmware reset</title>
<updated>2011-08-27T14:36:46Z</updated>
<author>
<name>Vikas Chaudhary</name>
</author>
<published>2011-08-12T09:51:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2944369144548432f3a5ffce7a2926bfb4ce4f0a'/>
<id>urn:sha1:2944369144548432f3a5ffce7a2926bfb4ce4f0a</id>
<content type='text'>
Added new sysfs attr 'host_reset' in scsi_sysfs.c to
perform adapter or firmware reset as suggested by
Mike Christie here:
http://marc.info/?l=linux-scsi&amp;m=127359347111167&amp;w=2

user/application can write "adapter" or "firmware" on
this attr and it will call newly added function hook
in scsi_host_template to call LDD adapter or firmware
reset implementation.

Signed-off-by: Vikas Chaudhary &lt;vikas.chaudhary@qlogic.com&gt;
Reviewed-by: Mike Christie &lt;michaelc@cs.wisc.edu&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
</content>
</entry>
</feed>
