Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-26 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> It's probably best to just check for dxfer_len <= 2^28 to be valid JT> as Doug suggested: I can verify that patch on top of git head (as of a few hours ago) does function properly. It didn't apply directly on top of 4.12 but even

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-26 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> It's probably best to just check for dxfer_len <= 2^28 to be valid JT> as Doug suggested: I can verify that patch on top of git head (as of a few hours ago) does function properly. It didn't apply directly on top of 4.12 but even I can handle fixing

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-26 Thread Johannes Thumshirn
On Tue, Jul 25, 2017 at 01:25:07PM -0500, Jason L Tibbitts III wrote: > > "JT" == Johannes Thumshirn writes: > ioctl(3, SG_IO, {interface_id='S', dxfer_direction=SG_DXFER_TO_DEV, > cmd_len=12, cmdp="\xa5\x00\x00\x00\x00\x01\x03\xe9\x00\x00\x00\x00", > mx_sb_len=20,

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-26 Thread Johannes Thumshirn
On Tue, Jul 25, 2017 at 01:25:07PM -0500, Jason L Tibbitts III wrote: > > "JT" == Johannes Thumshirn writes: > ioctl(3, SG_IO, {interface_id='S', dxfer_direction=SG_DXFER_TO_DEV, > cmd_len=12, cmdp="\xa5\x00\x00\x00\x00\x01\x03\xe9\x00\x00\x00\x00", > mx_sb_len=20, iovec_count=0,

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-26 Thread Johannes Thumshirn
On Tue, Jul 25, 2017 at 03:09:00PM -0400, Douglas Gilbert wrote: > _TO_ is toward the device (i.e. WRITE) and what T10 call "data-out". > _FROM_ is from the device (e.g. INQUIRY) and what T10 call "data-in". > > _TO_FROM_ is basically _FROM_ (and has nothing to do with bidi). > _TO_FROM_ is very

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-26 Thread Johannes Thumshirn
On Tue, Jul 25, 2017 at 03:09:00PM -0400, Douglas Gilbert wrote: > _TO_ is toward the device (i.e. WRITE) and what T10 call "data-out". > _FROM_ is from the device (e.g. INQUIRY) and what T10 call "data-in". > > _TO_FROM_ is basically _FROM_ (and has nothing to do with bidi). > _TO_FROM_ is very

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-25 Thread Douglas Gilbert
On 2017-07-19 04:36 AM, Johannes Thumshirn wrote: On Wed, Jul 19, 2017 at 03:13:34AM -0500, Jason L Tibbitts III wrote: [ 46.304530] sg_is_valid_dxfer: dxfer_direction: -2, dxfer_len: 0 Ahh now I see the -2 (SG_DXFER_TO_DEV) is the crucial point here. It is 0 in your case. This would "fix"

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-25 Thread Douglas Gilbert
On 2017-07-19 04:36 AM, Johannes Thumshirn wrote: On Wed, Jul 19, 2017 at 03:13:34AM -0500, Jason L Tibbitts III wrote: [ 46.304530] sg_is_valid_dxfer: dxfer_direction: -2, dxfer_len: 0 Ahh now I see the -2 (SG_DXFER_TO_DEV) is the crucial point here. It is 0 in your case. This would "fix"

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-25 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> Yes please (on top of the snippet I've sent you last). OK, I'm at 4.12 with 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 cherry picked, plus the fix patch and the debug patch you've sent previously. To make sure we're on the same

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-25 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> Yes please (on top of the snippet I've sent you last). OK, I'm at 4.12 with 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 cherry picked, plus the fix patch and the debug patch you've sent previously. To make sure we're on the same page, I'll include the

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-25 Thread Johannes Thumshirn
On Fri, Jul 21, 2017 at 02:23:16PM -0500, Jason L Tibbitts III wrote: > I can also apply the debugging patch and try again if that would give > you more useful information. Yes please (on top of the snippet I've sent you last). Thanks a lot, Johannes -- Johannes Thumshirn

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-25 Thread Johannes Thumshirn
On Fri, Jul 21, 2017 at 02:23:16PM -0500, Jason L Tibbitts III wrote: > I can also apply the debugging patch and try again if that would give > you more useful information. Yes please (on top of the snippet I've sent you last). Thanks a lot, Johannes -- Johannes Thumshirn

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-21 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> Jason, can you try the above? If it works and Doug doesn't respond, JT> I'm inclined yo submit this band aid. Unfortunately it doesn't appear to work for me. Maybe I'm building the wrong thing, though. I checked out 4.12, cherry

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-21 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> Jason, can you try the above? If it works and Doug doesn't respond, JT> I'm inclined yo submit this band aid. Unfortunately it doesn't appear to work for me. Maybe I'm building the wrong thing, though. I checked out 4.12, cherry picked

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-21 Thread Johannes Thumshirn
Doug, On Wed, Jul 19, 2017 at 10:36:54AM +0200, Johannes Thumshirn wrote: > On Wed, Jul 19, 2017 at 03:13:34AM -0500, Jason L Tibbitts III wrote: > > [ 46.304530] sg_is_valid_dxfer: dxfer_direction: -2, dxfer_len: 0 > > Ahh now I see the -2 (SG_DXFER_TO_DEV) is the crucial point here. It is 0

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-21 Thread Johannes Thumshirn
Doug, On Wed, Jul 19, 2017 at 10:36:54AM +0200, Johannes Thumshirn wrote: > On Wed, Jul 19, 2017 at 03:13:34AM -0500, Jason L Tibbitts III wrote: > > [ 46.304530] sg_is_valid_dxfer: dxfer_direction: -2, dxfer_len: 0 > > Ahh now I see the -2 (SG_DXFER_TO_DEV) is the crucial point here. It is 0

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-19 Thread Johannes Thumshirn
On Wed, Jul 19, 2017 at 03:13:34AM -0500, Jason L Tibbitts III wrote: > [ 46.304530] sg_is_valid_dxfer: dxfer_direction: -2, dxfer_len: 0 Ahh now I see the -2 (SG_DXFER_TO_DEV) is the crucial point here. It is 0 in your case. This would "fix" it but I'm not generally sure it is _the_ solution:

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-19 Thread Johannes Thumshirn
On Wed, Jul 19, 2017 at 03:13:34AM -0500, Jason L Tibbitts III wrote: > [ 46.304530] sg_is_valid_dxfer: dxfer_direction: -2, dxfer_len: 0 Ahh now I see the -2 (SG_DXFER_TO_DEV) is the crucial point here. It is 0 in your case. This would "fix" it but I'm not generally sure it is _the_ solution:

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-19 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> Can you please apply this debugging patch, so I can see what's going JT> on. Sure, no problem. I generally run "mtx -f /dev/sg7 status" first just to make sure the library is there; this has always worked as expected. With the

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-19 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> Can you please apply this debugging patch, so I can see what's going JT> on. Sure, no problem. I generally run "mtx -f /dev/sg7 status" first just to make sure the library is there; this has always worked as expected. With the debug patch applied,

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-19 Thread Johannes Thumshirn
On Tue, Jul 18, 2017 at 12:33:59PM -0500, Jason L Tibbitts III wrote: > I have verified that building a clean v4.12 with > 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 cherry picked on top still > shows the problem: > > [root@backup2 ~]# mtx -f /dev/sg7 next 0 > Unloading drive 0 into Storage Element

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-19 Thread Johannes Thumshirn
On Tue, Jul 18, 2017 at 12:33:59PM -0500, Jason L Tibbitts III wrote: > I have verified that building a clean v4.12 with > 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 cherry picked on top still > shows the problem: > > [root@backup2 ~]# mtx -f /dev/sg7 next 0 > Unloading drive 0 into Storage Element

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-18 Thread Jason L Tibbitts III
I have verified that building a clean v4.12 with 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 cherry picked on top still shows the problem: [root@backup2 ~]# mtx -f /dev/sg7 next 0 Unloading drive 0 into Storage Element 45...mtx: Request Sense: Long Report=yes mtx: Request Sense: Valid Residual=no

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-18 Thread Jason L Tibbitts III
I have verified that building a clean v4.12 with 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 cherry picked on top still shows the problem: [root@backup2 ~]# mtx -f /dev/sg7 next 0 Unloading drive 0 into Storage Element 45...mtx: Request Sense: Long Report=yes mtx: Request Sense: Valid Residual=no

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-18 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> This is fixed with: commit 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 Hmm, well, I just pulled and built mainline, which does appear to contain that patch (though it wasn't there when I first started investigating this last week)

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-18 Thread Jason L Tibbitts III
> "JT" == Johannes Thumshirn writes: JT> This is fixed with: commit 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 Hmm, well, I just pulled and built mainline, which does appear to contain that patch (though it wasn't there when I first started investigating this last week) and the problem is

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-18 Thread Johannes Thumshirn
On Mon, Jul 17, 2017 at 07:44:50PM -0500, Jason L Tibbitts III wrote: > and confirmed that clean unpatched 4.12 shows the problem, while > reverting just that patch fixes the issue. Unfortunately I don't know > enough to actually fix this, but I can easily test patches. This is fixed with:

Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-18 Thread Johannes Thumshirn
On Mon, Jul 17, 2017 at 07:44:50PM -0500, Jason L Tibbitts III wrote: > and confirmed that clean unpatched 4.12 shows the problem, while > reverting just that patch fixes the issue. Unfortunately I don't know > enough to actually fix this, but I can easily test patches. This is fixed with:

[REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-17 Thread Jason L Tibbitts III
After updating my tape backup server to 4.12 I found that mtx had issues controlling the tape library. Good behavior: [root@backup2 ~]# mtx -f /dev/sg7 next 0 Unloading drive 0 into Storage Element 4...done Loading media from Storage Element 5 into drive 0...done Bad behavior: [root@backup2

[REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control

2017-07-17 Thread Jason L Tibbitts III
After updating my tape backup server to 4.12 I found that mtx had issues controlling the tape library. Good behavior: [root@backup2 ~]# mtx -f /dev/sg7 next 0 Unloading drive 0 into Storage Element 4...done Loading media from Storage Element 5 into drive 0...done Bad behavior: [root@backup2