lkml.org 
[lkml]   [2004]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] problem of cont_prepare_write()
Anton Altaparmakov <aia21@cam.ac.uk> wrote:
>
> Would it be ok to modify i_size from prepare_write?

I think so - I seem to recall seeing that done somewhere else...

One thing to watch out for is when to bring the page uptodate. If the page
is uptodate then the read() code just won't try to lock it at all. If you
increase i_size AND set PG_uptodate too early you could open a window which
allows read() to peek at uninitialised data.

But if you set the page uptodate only when its contents really are sane
then things should work OK.

If you end up doing

memset(page, 0, N);
SetPageUptodate(page);

then I think you'll need an smb_wmb() in between so the read() code sees the
above two writes in the correct order.
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.109 / U:0.128 seconds]
©2003-2014 Jasper Spaans. Advertise on this site