Re: 2.3.7: generic_write_page(): O_APPEND & inode->i_size not SMP safe

Manfred Spraul (masp0008@stud.uni-sb.de)
Tue, 22 Jun 1999 12:46:39 +0200 (CST)


I cc'ed Alexander, because I think this is mostly a
VFS SMP problem.

Ingo wrote:
> > >2) setting inode->i_size is not SMP safe.
>
> Your fix looks good
I'm not sure:
think about 2 processes with O_APPEND:
they still write to the same address, if this is a log file,
then 1 log record will be lost.

> note that Alexander Viro is
> working on SMP-threading the VFS, which will change those places that
> update filep fields.]

I think that the file pointer and the actual write operation
must be coherent (i.e. if two threads write data with the same filp,
then they must write to different addresses; and if a write operation
is aborted in the middle, then we must handle that gracefully
[no data leak with uninitialized memory, can we advance
the file pointer even if the data bytes were never
written?]).

Note that with O_APPEND, inode->i_size replaces the file pointer
for write operation, so cannot implement a lazy inode->i_size
update (i.e. writing and updating i_size when we obtain
the kernel lock).

I'll wait for the patch from Alexander.

--
	Manfred

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/