Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Andrew Morton
Kay Sievers <[EMAIL PROTECTED]> wrote:
>
> On Fri, Feb 18, 2005 at 11:02:32AM -0800, Andrew Morton wrote:
> > Kay Sievers <[EMAIL PROTECTED]> wrote:
> > >
> > >  > - there are numerous other places where an I/O error can be detected:
> > >  >   grep the tree for b_end_io and bio_end_io.
> > > 
> > >  You mean the mmap and direct-io stuff?
> > 
> > direct-io, certainly.  Also reiserfs, xfs, ntfs, ext3, jfs and possibly md
> > have their own I/O completion handlers.
> 
> Hmm, ok. Any idea how to propagate errors like this in a saner way? Some of
> these places don't even log errors and spreading uevents all over the place
> doesn't sounds like the best idea.
> 

I guess you should add some new generic function
handle_block_io_error(bdev, rw, sector) in ll_rw_blk.c and do whatever you
need to do inside that.  Move the ratelimited printk there, too.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Kay Sievers
On Fri, Feb 18, 2005 at 11:02:32AM -0800, Andrew Morton wrote:
> Kay Sievers <[EMAIL PROTECTED]> wrote:
> >
> >  > - there are numerous other places where an I/O error can be detected:
> >  >   grep the tree for b_end_io and bio_end_io.
> > 
> >  You mean the mmap and direct-io stuff?
> 
> direct-io, certainly.  Also reiserfs, xfs, ntfs, ext3, jfs and possibly md
> have their own I/O completion handlers.

Hmm, ok. Any idea how to propagate errors like this in a saner way? Some of
these places don't even log errors and spreading uevents all over the place
doesn't sounds like the best idea.

Thanks,
Kay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Andrew Morton
Kay Sievers <[EMAIL PROTECTED]> wrote:
>
>  > - there are numerous other places where an I/O error can be detected:
>  >   grep the tree for b_end_io and bio_end_io.
> 
>  You mean the mmap and direct-io stuff?

direct-io, certainly.  Also reiserfs, xfs, ntfs, ext3, jfs and possibly md
have their own I/O completion handlers.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Kay Sievers
On Fri, Feb 18, 2005 at 01:46:21AM -0800, Andrew Morton wrote:
> Kay Sievers <[EMAIL PROTECTED]> wrote:
> >
> > For HAL we want to get notified about I/O errors of block devices.
> >  This is especially useful for devices we are unable to poll and
> >  therefore can't know if something goes wrong here.

> - buffer_io_error() is called from interrupt context, and
>   kobject_uevent() does multiple GFP_KERNEL allocations.  You'll need to
>   use kobject_uevent_atomic().

Fixed.

> - the prink_ratelimit() fix in end_buffer_async_read() should be a
>   separate patch, really.  I'll fix that up.

Removed that part.

> - there are numerous other places where an I/O error can be detected:
>   grep the tree for b_end_io and bio_end_io.

You mean the mmap and direct-io stuff?

Thanks,
Kay

-
For HAL we want to get notified about I/O errors of block devices.
This is especially useful for devices we are unable to poll and
therefore can't know if something goes wrong here.

Signed-off-by: David Zeuthen <[EMAIL PROTECTED]>
Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>

= fs/buffer.c 1.270 vs edited =
--- 1.270/fs/buffer.c   2005-01-21 06:02:13 +01:00
+++ edited/fs/buffer.c  2005-02-18 13:00:18 +01:00
@@ -105,6 +105,7 @@ static void buffer_io_error(struct buffe
printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
bdevname(bh->b_bdev, b),
(unsigned long long)bh->b_blocknr);
+   kobject_uevent_atomic(>b_bdev->bd_disk->kobj, KOBJ_IO_ERROR, NULL);
 }
 
 /*
= include/linux/kobject_uevent.h 1.6 vs edited =
--- 1.6/include/linux/kobject_uevent.h  2004-11-08 20:43:30 +01:00
+++ edited/include/linux/kobject_uevent.h   2005-02-18 12:59:18 +01:00
@@ -29,6 +29,7 @@ enum kobject_action {
KOBJ_UMOUNT = (__force kobject_action_t) 0x05,  /* umount event 
for block devices */
KOBJ_OFFLINE= (__force kobject_action_t) 0x06,  /* offline 
event for hotplug devices */
KOBJ_ONLINE = (__force kobject_action_t) 0x07,  /* online event 
for hotplug devices */
+   KOBJ_IO_ERROR   = (__force kobject_action_t) 0x08,  /* I/O error 
for devices */
 };
 
 
= lib/kobject_uevent.c 1.18 vs edited =
--- 1.18/lib/kobject_uevent.c   2005-01-08 06:44:13 +01:00
+++ edited/lib/kobject_uevent.c 2005-02-18 12:59:18 +01:00
@@ -44,6 +44,8 @@ static char *action_to_string(enum kobje
return "offline";
case KOBJ_ONLINE:
return "online";
+   case KOBJ_IO_ERROR:
+   return "io_error";
default:
return NULL;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Andrew Morton
Kay Sievers <[EMAIL PROTECTED]> wrote:
>
> For HAL we want to get notified about I/O errors of block devices.
>  This is especially useful for devices we are unable to poll and
>  therefore can't know if something goes wrong here.
> 
>  Signed-off-by: David Zeuthen <[EMAIL PROTECTED]>
>  Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>
> 
>  = fs/buffer.c 1.270 vs edited =
>  --- 1.270/fs/buffer.c2005-01-21 06:02:13 +01:00
>  +++ edited/fs/buffer.c   2005-02-17 22:56:05 +01:00
>  @@ -105,6 +105,7 @@ static void buffer_io_error(struct buffe
>   printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
>   bdevname(bh->b_bdev, b),
>   (unsigned long long)bh->b_blocknr);
>  +kobject_uevent(>b_bdev->bd_disk->kobj, KOBJ_IO_ERROR, NULL);
>   }

- buffer_io_error() is called from interrupt context, and
  kobject_uevent() does multiple GFP_KERNEL allocations.  You'll need to
  use kobject_uevent_atomic().

- the prink_ratelimit() fix in end_buffer_async_read() should be a
  separate patch, really.  I'll fix that up.

- there are numerous other places where an I/O error can be detected:
  grep the tree for b_end_io and bio_end_io.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] add I/O error uevent for block devices

2005-02-18 Thread Kay Sievers
For HAL we want to get notified about I/O errors of block devices.
This is especially useful for devices we are unable to poll and
therefore can't know if something goes wrong here.

Signed-off-by: David Zeuthen <[EMAIL PROTECTED]>
Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>

= fs/buffer.c 1.270 vs edited =
--- 1.270/fs/buffer.c   2005-01-21 06:02:13 +01:00
+++ edited/fs/buffer.c  2005-02-17 22:56:05 +01:00
@@ -105,6 +105,7 @@ static void buffer_io_error(struct buffe
printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
bdevname(bh->b_bdev, b),
(unsigned long long)bh->b_blocknr);
+   kobject_uevent(>b_bdev->bd_disk->kobj, KOBJ_IO_ERROR, NULL);
 }
 
 /*
@@ -550,7 +551,8 @@ static void end_buffer_async_read(struct
set_buffer_uptodate(bh);
} else {
clear_buffer_uptodate(bh);
-   buffer_io_error(bh);
+   if (printk_ratelimit())
+   buffer_io_error(bh);
SetPageError(page);
}
 
= include/linux/kobject_uevent.h 1.6 vs edited =
--- 1.6/include/linux/kobject_uevent.h  2004-11-08 20:43:30 +01:00
+++ edited/include/linux/kobject_uevent.h   2005-02-17 23:10:05 +01:00
@@ -29,6 +29,7 @@ enum kobject_action {
KOBJ_UMOUNT = (__force kobject_action_t) 0x05,  /* umount event 
for block devices */
KOBJ_OFFLINE= (__force kobject_action_t) 0x06,  /* offline 
event for hotplug devices */
KOBJ_ONLINE = (__force kobject_action_t) 0x07,  /* online event 
for hotplug devices */
+   KOBJ_IO_ERROR   = (__force kobject_action_t) 0x08,  /* I/O error 
for devices */
 };
 
 
= lib/kobject_uevent.c 1.18 vs edited =
--- 1.18/lib/kobject_uevent.c   2005-01-08 06:44:13 +01:00
+++ edited/lib/kobject_uevent.c 2005-02-17 22:52:03 +01:00
@@ -44,6 +44,8 @@ static char *action_to_string(enum kobje
return "offline";
case KOBJ_ONLINE:
return "online";
+   case KOBJ_IO_ERROR:
+   return "io_error";
default:
return NULL;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] add I/O error uevent for block devices

2005-02-18 Thread Kay Sievers
For HAL we want to get notified about I/O errors of block devices.
This is especially useful for devices we are unable to poll and
therefore can't know if something goes wrong here.

Signed-off-by: David Zeuthen [EMAIL PROTECTED]
Signed-off-by: Kay Sievers [EMAIL PROTECTED]

= fs/buffer.c 1.270 vs edited =
--- 1.270/fs/buffer.c   2005-01-21 06:02:13 +01:00
+++ edited/fs/buffer.c  2005-02-17 22:56:05 +01:00
@@ -105,6 +105,7 @@ static void buffer_io_error(struct buffe
printk(KERN_ERR Buffer I/O error on device %s, logical block %Lu\n,
bdevname(bh-b_bdev, b),
(unsigned long long)bh-b_blocknr);
+   kobject_uevent(bh-b_bdev-bd_disk-kobj, KOBJ_IO_ERROR, NULL);
 }
 
 /*
@@ -550,7 +551,8 @@ static void end_buffer_async_read(struct
set_buffer_uptodate(bh);
} else {
clear_buffer_uptodate(bh);
-   buffer_io_error(bh);
+   if (printk_ratelimit())
+   buffer_io_error(bh);
SetPageError(page);
}
 
= include/linux/kobject_uevent.h 1.6 vs edited =
--- 1.6/include/linux/kobject_uevent.h  2004-11-08 20:43:30 +01:00
+++ edited/include/linux/kobject_uevent.h   2005-02-17 23:10:05 +01:00
@@ -29,6 +29,7 @@ enum kobject_action {
KOBJ_UMOUNT = (__force kobject_action_t) 0x05,  /* umount event 
for block devices */
KOBJ_OFFLINE= (__force kobject_action_t) 0x06,  /* offline 
event for hotplug devices */
KOBJ_ONLINE = (__force kobject_action_t) 0x07,  /* online event 
for hotplug devices */
+   KOBJ_IO_ERROR   = (__force kobject_action_t) 0x08,  /* I/O error 
for devices */
 };
 
 
= lib/kobject_uevent.c 1.18 vs edited =
--- 1.18/lib/kobject_uevent.c   2005-01-08 06:44:13 +01:00
+++ edited/lib/kobject_uevent.c 2005-02-17 22:52:03 +01:00
@@ -44,6 +44,8 @@ static char *action_to_string(enum kobje
return offline;
case KOBJ_ONLINE:
return online;
+   case KOBJ_IO_ERROR:
+   return io_error;
default:
return NULL;
}

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Andrew Morton
Kay Sievers [EMAIL PROTECTED] wrote:

 For HAL we want to get notified about I/O errors of block devices.
  This is especially useful for devices we are unable to poll and
  therefore can't know if something goes wrong here.
 
  Signed-off-by: David Zeuthen [EMAIL PROTECTED]
  Signed-off-by: Kay Sievers [EMAIL PROTECTED]
 
  = fs/buffer.c 1.270 vs edited =
  --- 1.270/fs/buffer.c2005-01-21 06:02:13 +01:00
  +++ edited/fs/buffer.c   2005-02-17 22:56:05 +01:00
  @@ -105,6 +105,7 @@ static void buffer_io_error(struct buffe
   printk(KERN_ERR Buffer I/O error on device %s, logical block %Lu\n,
   bdevname(bh-b_bdev, b),
   (unsigned long long)bh-b_blocknr);
  +kobject_uevent(bh-b_bdev-bd_disk-kobj, KOBJ_IO_ERROR, NULL);
   }

- buffer_io_error() is called from interrupt context, and
  kobject_uevent() does multiple GFP_KERNEL allocations.  You'll need to
  use kobject_uevent_atomic().

- the prink_ratelimit() fix in end_buffer_async_read() should be a
  separate patch, really.  I'll fix that up.

- there are numerous other places where an I/O error can be detected:
  grep the tree for b_end_io and bio_end_io.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Kay Sievers
On Fri, Feb 18, 2005 at 01:46:21AM -0800, Andrew Morton wrote:
 Kay Sievers [EMAIL PROTECTED] wrote:
 
  For HAL we want to get notified about I/O errors of block devices.
   This is especially useful for devices we are unable to poll and
   therefore can't know if something goes wrong here.

 - buffer_io_error() is called from interrupt context, and
   kobject_uevent() does multiple GFP_KERNEL allocations.  You'll need to
   use kobject_uevent_atomic().

Fixed.

 - the prink_ratelimit() fix in end_buffer_async_read() should be a
   separate patch, really.  I'll fix that up.

Removed that part.

 - there are numerous other places where an I/O error can be detected:
   grep the tree for b_end_io and bio_end_io.

You mean the mmap and direct-io stuff?

Thanks,
Kay

-
For HAL we want to get notified about I/O errors of block devices.
This is especially useful for devices we are unable to poll and
therefore can't know if something goes wrong here.

Signed-off-by: David Zeuthen [EMAIL PROTECTED]
Signed-off-by: Kay Sievers [EMAIL PROTECTED]

= fs/buffer.c 1.270 vs edited =
--- 1.270/fs/buffer.c   2005-01-21 06:02:13 +01:00
+++ edited/fs/buffer.c  2005-02-18 13:00:18 +01:00
@@ -105,6 +105,7 @@ static void buffer_io_error(struct buffe
printk(KERN_ERR Buffer I/O error on device %s, logical block %Lu\n,
bdevname(bh-b_bdev, b),
(unsigned long long)bh-b_blocknr);
+   kobject_uevent_atomic(bh-b_bdev-bd_disk-kobj, KOBJ_IO_ERROR, NULL);
 }
 
 /*
= include/linux/kobject_uevent.h 1.6 vs edited =
--- 1.6/include/linux/kobject_uevent.h  2004-11-08 20:43:30 +01:00
+++ edited/include/linux/kobject_uevent.h   2005-02-18 12:59:18 +01:00
@@ -29,6 +29,7 @@ enum kobject_action {
KOBJ_UMOUNT = (__force kobject_action_t) 0x05,  /* umount event 
for block devices */
KOBJ_OFFLINE= (__force kobject_action_t) 0x06,  /* offline 
event for hotplug devices */
KOBJ_ONLINE = (__force kobject_action_t) 0x07,  /* online event 
for hotplug devices */
+   KOBJ_IO_ERROR   = (__force kobject_action_t) 0x08,  /* I/O error 
for devices */
 };
 
 
= lib/kobject_uevent.c 1.18 vs edited =
--- 1.18/lib/kobject_uevent.c   2005-01-08 06:44:13 +01:00
+++ edited/lib/kobject_uevent.c 2005-02-18 12:59:18 +01:00
@@ -44,6 +44,8 @@ static char *action_to_string(enum kobje
return offline;
case KOBJ_ONLINE:
return online;
+   case KOBJ_IO_ERROR:
+   return io_error;
default:
return NULL;
}

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Andrew Morton
Kay Sievers [EMAIL PROTECTED] wrote:

   - there are numerous other places where an I/O error can be detected:
 grep the tree for b_end_io and bio_end_io.
 
  You mean the mmap and direct-io stuff?

direct-io, certainly.  Also reiserfs, xfs, ntfs, ext3, jfs and possibly md
have their own I/O completion handlers.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Kay Sievers
On Fri, Feb 18, 2005 at 11:02:32AM -0800, Andrew Morton wrote:
 Kay Sievers [EMAIL PROTECTED] wrote:
 
- there are numerous other places where an I/O error can be detected:
  grep the tree for b_end_io and bio_end_io.
  
   You mean the mmap and direct-io stuff?
 
 direct-io, certainly.  Also reiserfs, xfs, ntfs, ext3, jfs and possibly md
 have their own I/O completion handlers.

Hmm, ok. Any idea how to propagate errors like this in a saner way? Some of
these places don't even log errors and spreading uevents all over the place
doesn't sounds like the best idea.

Thanks,
Kay
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] add I/O error uevent for block devices

2005-02-18 Thread Andrew Morton
Kay Sievers [EMAIL PROTECTED] wrote:

 On Fri, Feb 18, 2005 at 11:02:32AM -0800, Andrew Morton wrote:
  Kay Sievers [EMAIL PROTECTED] wrote:
  
 - there are numerous other places where an I/O error can be detected:
   grep the tree for b_end_io and bio_end_io.
   
You mean the mmap and direct-io stuff?
  
  direct-io, certainly.  Also reiserfs, xfs, ntfs, ext3, jfs and possibly md
  have their own I/O completion handlers.
 
 Hmm, ok. Any idea how to propagate errors like this in a saner way? Some of
 these places don't even log errors and spreading uevents all over the place
 doesn't sounds like the best idea.
 

I guess you should add some new generic function
handle_block_io_error(bdev, rw, sector) in ll_rw_blk.c and do whatever you
need to do inside that.  Move the ratelimited printk there, too.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/