[OpenAFS-devel] OpenAFS, Linux and truncate_inode_pages()
chas williams - CONTRACTOR
chas@cmf.nrl.navy.mil
Fri, 24 Feb 2006 14:29:53 -0500
In message <43FAEA88.40506@pclella.cern.ch>,Rainer Toebbicke writes:
>In Linux kernel 2.6 the comments for truncate_inode_pages() say you
>need to hold the i_sem lock before to call this, in kernel 2.4 there
>is no mention but tracing back things a bit you find that de facto the
>i_sem is always "downed" when truncate_inode_pages() is called.
while the comment does say this, its not completely clear to me that
this is always true -- for instance, i dont think i_sem is held
during delete_inode (although this is for obvious reasons i guess).
>As long as there are sufficient AFS locks it might be ok to ignore the
>i_sem lock for AFS inodes as nobody else is likely to mess around with
>them, in the afs_linux_read case however all AFS locks which come
>immediately to my mind (global lock, vcache lock) are dropped and
>leave truncate_inode_pages() exposed as far as I can see.
practically everything in afs happens under AFS_GLOCK. this does
tend to provide the same protection as i_sem. for correctness,
afs should probably take i_sem as appropriate.
>(the background: I can show that for sufficiently large N and
>concurrency the script "for i (1..N) { cp file.i file.i+1; cmp file.i
>file.i+1 || die}" fails).
how about something we could use to duplicate the problem?