Re: [PATCH 1/2] scsi: st: Remove use of device->was_reset

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

 




On 11/16/24 10:35, Kai Mäkisara (Kolumbus) wrote:
On 15. Nov 2024, at 19.45, Kai Mäkisara (Kolumbus) <kai.makisara@xxxxxxxxxxx> wrote:

...

I still think that UNIT ATTENTIONs (UAs) reach the high level device without
problems. The problem is that the device attached to the target first issuing
a SCSI command after reset gets the UA. As long as this is st device,
there are no problems. But, if it is the sg device attached to the same target,
the tape device misses it. > ...

And there are cases where the device reset does not originate from the
same computer.

Does anyone have any suggestions?

Besides Power on/Reset, the same problem applies to the New Media case.

It seems to me this would apply for any Unit Attention. A hardware device can set a unit attention when ever acted upon by a third party. It is difficult to test this type of event w/out a multi-initiator bus... some kind of configuration that connects multiple host to the same SCSI target/lun device. Large tape library configurations can do this. I don't have a test bed like this.

One solution might be the following: the midlevel maintains counters for
the Power on/Reset and the Media change UNIT ATTENTIONs. The ULDs
can read these counters (using wrappers). If the ULD find for a device that
the counter value has changed, then the event corresponding to the counter
has occurred. The problem of clearing event flags is avoided,

I'm not sure I understand what problem you are trying to solve... are you trying to get the mid layer to report Unit Attentions to all ULDs that are attached? That is, you want the mid layer to report the UA to all ULDs, not just the last/latest ULD?

A drawback comes from the counter wrap-arounds. If, e.g., four-bit counters
are used and there are 16 Power on/Resets between the checks by the ULD,
the event is missed when the counter is used.

I don't think that would be a problem. As long as the latest and highest priority UA is reported, older, lower priority UAs can be overwritten. For example, a New Media UA followed by a POR UA - the Power On reset should take precedence.

The ULDs should also check
the sense data they do receive. It is possible/probable that the event is
recognized based on the sense data even if the counter check misses it.)

Yes, definitely. ULDs should check the sense data.

This solution is easy to implement. I have a test implementation running and
it seems to be working.

I've tested these patches that you've posted here with my locally attached LTO-5 tape drive.  Everything seems to fine...

You can find the test results at:

https://bugzilla.kernel.org/show_bug.cgi?id=219419#c20

Note that I've added my own instrumentation patch on top of your series as it helps with the debug logging.

linux(tape_test) > git logl -7
177c3f710de4 (HEAD -> tape_test) scsi: st: instrument the pos_unknown code [ John Meneghini / jmeneghi@xxxxxxxxxx ]
7373d7d717a0 scsi: st: Restore some drive settings after reset [ John Meneghini / Kai.Makisara@xxxxxxxxxxx ]
25be4d26ef58 scsi: st: Remove use of device->was_reset [ John Meneghini / Kai.Makisara@xxxxxxxxxxx ]
c5e0a7687c6b scsi: st: New session only when Unit Attention for new tape [ John Meneghini / Kai.Makisara@xxxxxxxxxxx ]
1ab8b314a34b scsi: st: Add MTIOCGET and MTLOAD to ioctls allowed after device reset [John Meneghini / Kai.Makisara@xxxxxxxxxxx]
0013312311da scsi: st: Don't modify unknown block number in MTIOCGET [ John Meneghini / Kai.Makisara@xxxxxxxxxxx ]
2d5404caa8c7 (tag: v6.12-rc7, branch_v6.12-rc7) Linux 6.12-rc7 [ Linus Torvalds / torvalds@xxxxxxxxxxxxxxxxxxxx ]


Other solutions that have come into my mind are much more complicated
than the counters. Here are examples:
- the UNIT ATTENTIONs would be sent to all ULDs attached to the device
   when they issue the next SCSI command
- the ULDs would have possibility to register a callback for UNIT ATTENTIONs

This is actually what the SCSI device is supposed to do. If you have a truly SCSI compliant tape device, designed to support multi-initiator access, unit attentions are supposed to be maintained on an I_T by I_T basis. So a device reset from one I_T will set a UA on all I_Ts, and clearing one I_T will clear only that I_T nexus UA. But I'm sure that some of the older, legacy, tape devices don't do this.

Let me know if I can help by testing any further patches.

/John





[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