Re: sys_write() racy for multi-threaded append?
From: David M. Lloyd
Date: Tue Mar 13 2007 - 10:02:26 EST
On Tue, 2007-03-13 at 02:24 +0000, Alan Cox wrote:
> > purports to handle short writes but has never been exercised is
> > arguably worse than code that simply bombs on short write. So if I
> > can't shim in an induce-short-writes-randomly-on-purpose mechanism
> > during development, I don't want short writes in production, period.
>
> Easy enough to do and gcov plus dejagnu or similar tools will let you
> coverage analyse the resulting test set and replay it.
You don't even need special tools: just change your code that says:
foo = write(fd, mybuf, mycount);
to say (for example):
foo = write(fd, mybuf, mycount / randomly_either_1_or_2);
Why would this need kernel support? The average developer doesn't
really need to verify that the *kernel* works. They just need to test
their own code paths - and in this case, they can see that foo is less
than mycount (sometimes). The code paths don't care that it was not the
kernel that caused it.
- DML
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/