Re: nfs MAP_SHARED corruption fix

Marcelo Tosatti (marcelo@conectiva.com.br)
Wed, 9 May 2001 19:38:01 -0300 (BRT)


On Thu, 10 May 2001, Andrea Arcangeli wrote:

> On Wed, May 09, 2001 at 07:02:16PM -0300, Marcelo Tosatti wrote:
> > Why don't you clean I_DIRTY_PAGES ?
>
> we don't have visibilty on the inode_lock from there, we could make a
> function in fs/inode.c or export the inode_lock to do that, but the flag
> will be collected when the inode is released anyways, and it's only an
> hint to make the common case fast (the common case is when nobody ever
> did a MAP_SHARED on the inode). Other places msync/fsync doesn't even
> check for such bit but they fdatasync/fdatawait unconditionally.

Actually msync/fsync _can't_ rely on this bit because there is no
guarantee that data is fully synced on disk even if the bit is cleared.
(__sync_one (fs/inode.c) clears the bit _before_ starting the writeout,
and thats it).

You have the same problem with your code, so I guess its better to just
remove the I_DIRTY_PAGES check.

> And on the same lines also sys_fsync and sys_msync could clear the
> I_DIRTY_PAGES but they don't for semplcity (it will be cleared by
> kupdate later).
>
> So in short we can clear it but it's not required and it won't make much
> difference. If you really care you can clear it before calling fdatasync
> though.

Well, forget about that. :)

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