2007-08-24 17:07:01

by Paul Clements

[permalink] [raw]
Subject: [PATCH 1/2] NBD: set uninitialized devices to size 0

This fixes errors with utilities (such as LVM's vgscan) that try to scan
all devices. Previously this would generate read errors when
uninitialized nbd devices were scanned:

# vgscan
Reading all physical volumes. This may take a while...
/dev/nbd0: read failed after 0 of 1024 at 0: Input/output error
/dev/nbd0: read failed after 0 of 1024 at 509804544: Input/output error
/dev/nbd0: read failed after 0 of 2048 at 0: Input/output error
/dev/nbd1: read failed after 0 of 1024 at 509804544: Input/output error
/dev/nbd1: read failed after 0 of 2048 at 0: Input/output error


From now on, uninitialized nbd devices will have size zero, which
prevents these errors.

Patch applies and was tested against 2.6.23-rc2-mm2.

Thanks,
Paul


Attachments:
nbd_size_zero.diff (1.04 kB)

2007-08-24 17:41:28

by Paul Clements

[permalink] [raw]
Subject: [PATCH 2/2] NBD: allow hung network I/O to be cancelled

This patch allows NBD I/O to be cancelled when a network outage occurs.
Previously, I/O would just hang, and if enough I/O was hung in nbd, the
system (at least user-level) would completely hang until a TCP timeout
(default, 15 minutes) occurred.

The patch introduces a new ioctl NBD_SET_TIMEOUT that allows a transmit
timeout value (in seconds) to be specified. Any network send that
exceeds the timeout will be cancelled and the nbd connection will be
shut down. I've tested with various timeout values and 6 seconds seems
to be a good choice for the timeout. If the NBD_SET_TIMEOUT ioctl is not
called, you get the old (I/O hang) behavior.

Patch applies and was tested against 2.6.23-rc2-mm2.

Thanks,
Paul


Attachments:
nbd_xmit_timeout_26.diff (7.14 kB)

2007-08-24 18:13:37

by Mike Snitzer

[permalink] [raw]
Subject: Re: [PATCH 2/2] NBD: allow hung network I/O to be cancelled

On 8/24/07, Paul Clements <[email protected]> wrote:
> This patch allows NBD I/O to be cancelled when a network outage occurs.
> Previously, I/O would just hang, and if enough I/O was hung in nbd, the
> system (at least user-level) would completely hang until a TCP timeout
> (default, 15 minutes) occurred.
>
> The patch introduces a new ioctl NBD_SET_TIMEOUT that allows a transmit
> timeout value (in seconds) to be specified. Any network send that
> exceeds the timeout will be cancelled and the nbd connection will be
> shut down. I've tested with various timeout values and 6 seconds seems
> to be a good choice for the timeout. If the NBD_SET_TIMEOUT ioctl is not
> called, you get the old (I/O hang) behavior.

Hi Paul,

Thanks for implementing this! Do you happen to have an associated
nbd-client patch for userspace? If not I'd be happy to coordinate
with you and Wouter on a patch.

regards,
Mike

2007-08-24 19:09:26

by Paul Clements

[permalink] [raw]
Subject: Re: [PATCH 2/2] NBD: allow hung network I/O to be cancelled

Mike Snitzer wrote:
> On 8/24/07, Paul Clements <[email protected]> wrote:
>> This patch allows NBD I/O to be cancelled when a network outage occurs.
>> Previously, I/O would just hang, and if enough I/O was hung in nbd, the
>> system (at least user-level) would completely hang until a TCP timeout
>> (default, 15 minutes) occurred.
>>
>> The patch introduces a new ioctl NBD_SET_TIMEOUT that allows a transmit
>> timeout value (in seconds) to be specified. Any network send that
>> exceeds the timeout will be cancelled and the nbd connection will be
>> shut down. I've tested with various timeout values and 6 seconds seems
>> to be a good choice for the timeout. If the NBD_SET_TIMEOUT ioctl is not
>> called, you get the old (I/O hang) behavior.
>
> Hi Paul,
>
> Thanks for implementing this! Do you happen to have an associated
> nbd-client patch for userspace? If not I'd be happy to coordinate
> with you and Wouter on a patch.

No, I don't. I just basically hardcoded my nbd-client to do a 6 second
timeout by default, but Wouter will probably want to do something a
little less hackish for the official nbd-client.

--
Paul

2007-08-24 23:49:54

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/2] NBD: set uninitialized devices to size 0

On Fri, 24 Aug 2007 13:06:39 -0400
Paul Clements <[email protected]> wrote:

> This fixes errors with utilities (such as LVM's vgscan) that try to scan
> all devices. Previously this would generate read errors when
> uninitialized nbd devices were scanned:

I somewhat randomly marked both these as 2.6.24 material. If you think
that was incorrect, please shout out.

2007-08-29 02:55:10

by Bill Davidsen

[permalink] [raw]
Subject: Re: [PATCH 1/2] NBD: set uninitialized devices to size 0

Andrew Morton wrote:
> On Fri, 24 Aug 2007 13:06:39 -0400
> Paul Clements <[email protected]> wrote:
>
>> This fixes errors with utilities (such as LVM's vgscan) that try to scan
>> all devices. Previously this would generate read errors when
>> uninitialized nbd devices were scanned:
>
> I somewhat randomly marked both these as 2.6.24 material. If you think
> that was incorrect, please shout out.

I have the feeling that I mentioned nbd issues several releases ago, but
never got to getting more info on reproducing them. I try not to submit
bugs I can't reproduce, oftem they're my fault :-(


--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot