diff mbox

[4/5] scsi: Return ENODATA on medium error

Message ID 51D14813.6070803@ce.jp.nec.com (mailing list archive)
State Deferred, archived
Headers show

Commit Message

Junichi Nomura July 1, 2013, 9:12 a.m. UTC
On 07/01/13 17:12, Hannes Reinecke wrote:
> When a medium error is detected the SCSI stack should return
> ENODATA to the upper layers.

Hi Hannes,

since you change the error code from -EREMOTEIO to -ENODATA/-ENOSPC,
upper layers that checks -EREMOTEIO have to be updated as well.

Something like below for dm-multipath.
It seems btrfs checking -EREMOTEIO, too.

Comments

Hannes Reinecke July 1, 2013, 9:51 a.m. UTC | #1
On 07/01/2013 11:12 AM, Jun'ichi Nomura wrote:
> On 07/01/13 17:12, Hannes Reinecke wrote:
>> When a medium error is detected the SCSI stack should return
>> ENODATA to the upper layers.
> 
> Hi Hannes,
> 
> since you change the error code from -EREMOTEIO to -ENODATA/-ENOSPC,
> upper layers that checks -EREMOTEIO have to be updated as well.
> 
> Something like below for dm-multipath.
> It seems btrfs checking -EREMOTEIO, too.
> 
Good point.

Will be updating the patchset.

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index bdf26f5..15bf881 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1261,6 +1261,21 @@  static void activate_path(struct work_struct *work)
 				pg_init_done, pgpath);
 }
 
+static int maybe_path_failure(int error)
+{
+	switch(error) {
+	case -EOPNOTSUPP:
+	case -EREMOTEIO:
+	case -EILSEQ:
+	case -ENOSPC:
+	case -ENODATA:
+		return 0;
+	}
+
+	/* Anything else could be a path failure */
+	return 1;
+}
+
 /*
  * end_io handling
  */
@@ -1284,7 +1299,7 @@  static int do_end_io(struct multipath *m, struct request *clone,
 	if (!error && !clone->errors)
 		return 0;	/* I/O complete */
 
-	if (error == -EOPNOTSUPP || error == -EREMOTEIO || error == -EILSEQ)
+	if (!maybe_path_failure(error))
 		return error;
 
 	if (mpio->pgpath)