Re: file offset corruption on 32-bit machines?
From: Bryan Henderson
Date: Fri Apr 11 2008 - 17:29:36 EST
>What is the difference between doing:
>
>threadA: seek(positionA)
>threadB: seel(positionB)
>threadA: write
>threadB: write
>
>versus
>
>threadA: seek(posisionA) but only set half the 64bits
>threadB: seek(positionB) set all 64bits
>threadA: complete seek operation setting the other half of the bits
>threadA: write
>threadB: write
>
>either way you end up writing to the wrong file location
Only if you make an assumption about what this program considers the right
location. One difference is that in the first case, data gets written
only at a place to which the program seeked, while in the second, it gets
written to a totally illogical place. Another is that in the first, the
data gets written as specified in standards and in the second, it doesn't.
I can imagine a program that would be satisfied with the first and not
the second, and for such a program, I cannot use the word "incorrect" or
"broken" or say the programmer doesn't understand shared resources.
--
Bryan Henderson IBM Almaden Research Center
San Jose CA Filesystems
--
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/