Re: question about fsync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 25, 2010 at 11:10:15PM +0100, Filipe David Manana wrote:
> Theodore, thanks for your answer.
> 
> A similar question:
> 
> I have 2 threads. Both open the same file, but each using its own
> (different) file descriptor.
> 
> If one thread writes data past the eof (appends data), will the other
> one be able to read it with pread call (an offset past the eof it
> found when it opened the file)?
> 
> I  would just like to know if it's something safe to do on Linux and
> all Posix compliant platforms (and eventually Windows). (I tested this
> with non C code and it worked)

Race conditions aside, yes.

However, note that large writes are not necessarily guaranteed to be
atomic.  Yes, the other thread will be able to read it with a pread
call, but if there is a race between the write() and pread(), it's
possible that pread will only read part of what has been written so
far by the write system call.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux