Skip to contentSkip to conversation

get the kernel to warn about deprecated SCSI ioctls

PATCH In review James Bottomley 4 participants 8 messages Aug 19, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get the kernel to warn about deprecated SCSI ioctls

The non unique SCSI ioctls:

SCSI_IOCTL_SEND_COMMAND
SCSI_IOCTL_TEST_UNIT_READY
SCSI_IOCTL_BENCHMARK_COMMAND
SCSI_IOCTL_SYNC
SCSI_IOCTL_START_UNIT
SCSI_IOCTL_STOP_UNIT

Have been deprecated for a while now. We should make the kernel complain when a program actually uses one of them, so users have had adequate warning before they are removed.

James

===== drivers/scsi/scsi_ioctl.c 1.28 vs edited =====

drivers/scsi/scsi_ioctl.c +15 -0
@@ -391,6 +391,21 @@
 	if (!scsi_block_when_processing_errors(sdev))
 		return -ENODEV;
 
+	/* Check for deprecated ioctls ... all the ioctls which don't
+	 * follow the new unique numbering scheme are deprecated */
+	switch (cmd) {
+	case SCSI_IOCTL_SEND_COMMAND:
+	case SCSI_IOCTL_TEST_UNIT_READY:
+	case SCSI_IOCTL_BENCHMARK_COMMAND:
+	case SCSI_IOCTL_SYNC:
+	case SCSI_IOCTL_START_UNIT:
+	case SCSI_IOCTL_STOP_UNIT:
+		printk(KERN_WARNING "program %s is using a deprecated SCSI ioctl, please convert it to SG_IO\n", current->comm);
+		break;
+	default:
+		break;
+	}
+
 	switch (cmd) {
 	case SCSI_IOCTL_GET_IDLUN:
 		if (verify_area(VERIFY_WRITE, arg, sizeof(struct scsi_idlun)))
#1 lore raw
Quoted 9 lines · James Bottomley

The non unique SCSI ioctls:

SCSI_IOCTL_SEND_COMMAND
SCSI_IOCTL_TEST_UNIT_READY
SCSI_IOCTL_BENCHMARK_COMMAND
SCSI_IOCTL_SYNC
SCSI_IOCTL_START_UNIT
SCSI_IOCTL_STOP_UNIT

Quoted 3 lines

Have been deprecated for a while now. We should make the kernel complain when a program actually uses one of them, so users have had adequate warning before they are removed.

drivers/block/scsi_ioctl.c also implements SCSI_IOCTL_SEND_COMMAND, so you'll have to warn there aswell.

#3 lore raw
In reply to James Bottomley
Quoted 9 lines · James Bottomley

The non unique SCSI ioctls:

SCSI_IOCTL_SEND_COMMAND
SCSI_IOCTL_TEST_UNIT_READY
SCSI_IOCTL_BENCHMARK_COMMAND
SCSI_IOCTL_SYNC
SCSI_IOCTL_START_UNIT
SCSI_IOCTL_STOP_UNIT

Quoted 3 lines

Have been deprecated for a while now. We should make the kernel complain when a program actually uses one of them, so users have had adequate warning before they are removed.

any chance of deprecating the doorlock ioctls too?

Jeff

#4 lore raw
Quoted 10 lines · Jeff Garzik
Quoted 9 lines · James Bottomley

The non unique SCSI ioctls:

SCSI_IOCTL_SEND_COMMAND
SCSI_IOCTL_TEST_UNIT_READY
SCSI_IOCTL_BENCHMARK_COMMAND
SCSI_IOCTL_SYNC
SCSI_IOCTL_START_UNIT
SCSI_IOCTL_STOP_UNIT

Quoted 5 lines
Quoted 3 lines

Have been deprecated for a while now. We should make the kernel complain when a program actually uses one of them, so users have had adequate warning before they are removed.

any chance of deprecating the doorlock ioctls too?

The doorlock ones are unique, and are used by some of the CD tools.

We really need to know when an app locks the door rather than having to scan the commands in SG_IO.

James

#5 lore raw
Quoted 17 lines · James Bottomley
Quoted 15 lines · Jeff Garzik
Quoted 12 lines · James Bottomley

The non unique SCSI ioctls:

SCSI_IOCTL_SEND_COMMAND
SCSI_IOCTL_TEST_UNIT_READY
SCSI_IOCTL_BENCHMARK_COMMAND
SCSI_IOCTL_SYNC
SCSI_IOCTL_START_UNIT
SCSI_IOCTL_STOP_UNIT

Have been deprecated for a while now. We should make the kernel complain when a program actually uses one of them, so users have had adequate warning before they are removed.

Quoted 7 lines
Quoted 1 line

any chance of deprecating the doorlock ioctls too?

The doorlock ones are unique, and are used by some of the CD tools.

We really need to know when an app locks the door rather than having to scan the commands in SG_IO.

You need to scan the commands in SG_IO anyway, otherwise you do not know in all cases when an app locks the door :)

Jeff

#2 lore raw
In reply to Christoph Hellwig
Quoted 2 lines · Christoph Hellwig

drivers/block/scsi_ioctl.c also implements SCSI_IOCTL_SEND_COMMAND, so you'll have to warn there aswell.

Done.

No other places I've missed?

James

===== drivers/block/scsi_ioctl.c 1.53 vs edited =====

drivers/block/scsi_ioctl.c +1 -0
@@ -510,6 +510,7 @@
 		 * old junk scsi send command ioctl
 		 */
 		case SCSI_IOCTL_SEND_COMMAND:
+			printk(KERN_WARNING "program %s is using a deprecated SCSI ioctl, please convert it to SG_IO\n", current->comm);
 			err = -EINVAL;
 			if (!arg)
 				break;

===== drivers/scsi/scsi_ioctl.c 1.28 vs edited =====

drivers/scsi/scsi_ioctl.c +15 -0
@@ -391,6 +391,21 @@
 	if (!scsi_block_when_processing_errors(sdev))
 		return -ENODEV;
 
+	/* Check for deprecated ioctls ... all the ioctls which don't
+	 * follow the new unique numbering scheme are deprecated */
+	switch (cmd) {
+	case SCSI_IOCTL_SEND_COMMAND:
+	case SCSI_IOCTL_TEST_UNIT_READY:
+	case SCSI_IOCTL_BENCHMARK_COMMAND:
+	case SCSI_IOCTL_SYNC:
+	case SCSI_IOCTL_START_UNIT:
+	case SCSI_IOCTL_STOP_UNIT:
+		printk(KERN_WARNING "program %s is using a deprecated SCSI ioctl, please convert it to SG_IO\n", current->comm);
+		break;
+	default:
+		break;
+	}
+
 	switch (cmd) {
 	case SCSI_IOCTL_GET_IDLUN:
 		if (verify_area(VERIFY_WRITE, arg, sizeof(struct scsi_idlun)))
#6 lore raw
In reply to James Bottomley
Quoted 9 lines · James Bottomley

The non unique SCSI ioctls:

SCSI_IOCTL_SEND_COMMAND
SCSI_IOCTL_TEST_UNIT_READY
SCSI_IOCTL_BENCHMARK_COMMAND
SCSI_IOCTL_SYNC
SCSI_IOCTL_START_UNIT
SCSI_IOCTL_STOP_UNIT

Quoted 3 lines

Have been deprecated for a while now. We should make the kernel complain when a program actually uses one of them, so users have had adequate warning before they are removed.

James,
[Wearing my smartmontools maintainer hat] such a change is going to cause a lot of noise in the log from the smartd daemon. The code to use SG_IO ioctl in smartmontools is in CVS but won't be released for a month or so.

If they are not going to be dropped in the lk 2.6 series why not wait until the lk 2.7 development starts (or late lk 2.6 series)?

Doug Gilbert

#7 lore raw
Quoted 8 lines · Douglas Gilbert

[Wearing my smartmontools maintainer hat] such a change is going to cause a lot of noise in the log from the smartd daemon. The code to use SG_IO ioctl in smartmontools is in CVS but won't be released for a month or so.

If they are not going to be dropped in the lk 2.6 series why not wait until the lk 2.7 development starts (or late lk 2.6 series)?

The current issue is that some of them have no compat code, so they don't actually work 32 on 64.

If the noise becomes unbearable, we can rate limit it, but I'd like to get the message out.

James