Re: ext3 and raw devices

Stephen C. Tweedie
Tue, 23 Jul 2002 12:02:17 -0000

Hi,

On Sat, Jul 06, 2002 at 10:18:37AM +0000, Ian Leonard wrote:

> I doubt that this is actually an ext3 problem so I'm taking
> a bit of a liberty, but...
>
> We have several machines that have two ext3 partitions
> (/, /boot) and a large raw partition. Something happened that
> destroyed both the ext3 partitions on all machines.
>
> I appears that the app writing to the raw partition had
> a bug that caused it to write to negative block numbers
> and that this wrote all over the disk.

Shouldn't be able to happen --- negative offsets are rejected
elsewhere in the kernel before raw devices can get to see them.  The
lseek/llseek syscalls return EINVAL if you try to set the offset to be
negative for normal read/write syscalls, and the pread and pwrite
syscalls also check for negative offsets before allowing things to
proceed.

> But I would have
> thought that the writes would have been constrained
> but the raw device.

Yes, they should be.

--Stephen