Skip to contentSkip to conversation

Enable SCTERC in the kernel?

DISCUSSION Dag Nygren 5 participants 8 messages Oct 25, 2013 MD RAID

lore
Share & tools
lore

Dag Nygren

author
#0 lore raw

Hi all!

Just run into the standard problem by not having SCTERC enabled for my drives due to a spelling mistake in my rc.local script setting the parameters and started wondering:

- What if the md module automatically set this during assembly of the RAID? - In the kernel module itself. It could always set it, if the set failed we could spit out a kernel warning that the used drive might not be the best as a RAID device. Would there be any ill effects from this?
- And ditto for the device time-out.

This would definitely make md work a lot better for people. I have a strange feeling that most don't know the parameter needs setting...

Best
Dag

#1 lore raw
Quoted 14 lines · On Fri, 25 Oct 2013 11:51 +0300 Dag Nygren <[email protected]> wrote:

Hi all!

Just run into the standard problem by not having SCTERC enabled for my drives due to a spelling mistake in my rc.local script setting the parameters and started wondering:

- What if the md module automatically set this during assembly of the RAID? - In the kernel module itself. It could always set it, if the set failed we could spit out a kernel warning that the used drive might not be the best as a RAID device. Would there be any ill effects from this?
- And ditto for the device time-out.

Quoted 2 lines

This would definitely make md work a lot better for people. I have a strange feeling that most don't know the parameter needs setting...

I don't think it is appropriate for the kernel to automatically set such things. However it might be appropriate for mdadm to do it when assembling or creating the array.

I'm happy to review and possibly accept patches.

NeilBrown

#4 lore raw
In reply to Dag Nygren
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dag" == Dag Nygren <[email protected]> writes:

Dag> - What if the md module automatically set this during assembly Dag> of the RAID?

There are a couple of challenges here. libata lives under SCSI and there is no official translation between SCTERC for ATA to the SCSI Read Write Error Recovery mode page. But I can work around that.

A harder issue is to ensure that we don't cause regressions by requesting the SRWER mode from devices that blow up when they receive an unexpected SCSI command (yes, USB device vendors, I'm looking at you).

Anyway. I agree that this might be worthwhile. I'll put it on my list...

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
author
#5 lore raw
Quoted 9 lines · On Friday 25 October 2013 06:47:31 Martin K. Petersen wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dag" == Dag Nygren <[email protected]> writes:

Dag> - What if the md module automatically set this during assembly Dag> of the RAID?

There are a couple of challenges here. libata lives under SCSI and there is no official translation between SCTERC for ATA to the SCSI Read Write Error Recovery mode page. But I can work around that.

Quoted 5 lines

A harder issue is to ensure that we don't cause regressions by requesting the SRWER mode from devices that blow up when they receive an unexpected SCSI command (yes, USB device vendors, I'm looking at you).

Anyway. I agree that this might be worthwhile. I'll put it on my list...

Appreciate that! Would have saved me a lot of work - And I thought I knew what to do ;-)

Anyway Neil had the opinion that mdadm could do it outside the kernel and he might be right there. As long as there is no other way to assemble tha raid but use mdadm.

I do have smoe programming experience myself and could take a look at mdadm but would probably need some guidance. For example would is be OK to use an exec(smartctl...) which would make it a very easy programming exercise or do we then create an unwanted dependency on smartctl.

Best
Dag

#6 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dag" == Dag Nygren <[email protected]> writes:

Dag> Anyway Neil had the opinion that mdadm could do it outside the Dag> kernel

My concern is wrt. making sure that there are no unfortunate discrepancies between our block device read/write request timeouts and any error recovery timeouts values set in device firmware.

MD kicking disks is just a symptom that there's a generic issue in this area.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
author
#7 lore raw
Quoted 11 lines · On Friday 25 October 2013 07:27:19 Martin K. Petersen wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dag" == Dag Nygren <[email protected]> writes:

Dag> Anyway Neil had the opinion that mdadm could do it outside the Dag> kernel

My concern is wrt. making sure that there are no unfortunate discrepancies between our block device read/write request timeouts and any error recovery timeouts values set in device firmware.

MD kicking disks is just a symptom that there's a generic issue in this area.

Yep.

That is why this "feature" also should set the timeout to an appropriate value at the same time. "Just another line of code" ;-)

Best
Dag

#2 lore raw
In reply to NeilBrown
Quoted 16 lines · NeilBrown
Quoted 14 lines · On Fri, 25 Oct 2013 11:51 +0300 Dag Nygren <[email protected]> wrote:

Hi all!

Just run into the standard problem by not having SCTERC enabled for my drives due to a spelling mistake in my rc.local script setting the parameters and started wondering:

- What if the md module automatically set this during assembly of the RAID? - In the kernel module itself. It could always set it, if the set failed we could spit out a kernel warning that the used drive might not be the best as a RAID device. Would there be any ill effects from this?
- And ditto for the device time-out.

Quoted 2 lines
Quoted 2 lines

This would definitely make md work a lot better for people. I have a strange feeling that most don't know the parameter needs setting...

No strange feeling at all. Most of my posts to this list are helping people bitten by it.

Quoted 5 lines

I don't think it is appropriate for the kernel to automatically set such things. However it might be appropriate for mdadm to do it when assembling or creating the array.

I'm happy to review and possibly accept patches.

This is a wonderful idea, as it could possibly help people stuck on older kernels. I'll take a look at doing this myself.

Phil

#3 lore raw
In reply to NeilBrown
Quoted 16 lines · NeilBrown
Quoted 14 lines · On Fri, 25 Oct 2013 11:51 +0300 Dag Nygren <[email protected]> wrote:

Hi all!

Just run into the standard problem by not having SCTERC enabled for my drives due to a spelling mistake in my rc.local script setting the parameters and started wondering:

- What if the md module automatically set this during assembly of the RAID? - In the kernel module itself. It could always set it, if the set failed we could spit out a kernel warning that the used drive might not be the best as a RAID device. Would there be any ill effects from this?
- And ditto for the device time-out.

Quoted 6 lines
Quoted 2 lines

This would definitely make md work a lot better for people. I have a strange feeling that most don't know the parameter needs setting...

I don't think it is appropriate for the kernel to automatically set such things. However it might be appropriate for mdadm to do it when assembling or creating the array.

Actually, IMHO, "mdadm" should trigger an exernal
event, which, consequently, runs a script.

This is already in place, somehow, using "udev".

From a post, on this mailing list, of Sam Bingner:

I have written a simple udev rule calling a bash script to set the timeouts on all connected devices. I would like to a) provide this to anybody who feels they may need it and b) know if anybody sees any potential issues with this.
It seems to work fine for me over a couple reboots...

contents of udev rule:
ACTION=="add", SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", RUN+="/usr/local/bin/settimeout"

contents of /usr/local/bin/settimeout:
#!/bin/bash

[ "${ACTION}" == "add" ] && {
        /usr/sbin/smartctl -l scterc,70,70 ${DEVNAME} || echo 180 > /sys/${DEVPATH}/device/timeout
}

I guess, what is missing, is to connect the HDDs
with a specific "mdadm" event, instead of running
for each HDD.
I'm not sure if this is already possible, since
some "udev" rules for "md" are already existing.

bye,

pg

Quoted 3 lines

I'm happy to review and possibly accept patches.

NeilBrown

Signature · 1 line
piergiorgio