lkml.org 
[lkml]   [1999]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectget_empty_filp() is not SMP safe. [f_version problem]
Date
I noticed that get_empty_filp() is not smpsafe:
the line "f->f_version = ++event" can race.

Actually, it seems that f_version is completely broken:
* it's only read during read_dir.
* it's only set in get_empty_filp() and during file read/write operations,
ie. it seems that for directories, it is never updated.

I think it can be completely removed, because i_sem prevents parallel
accesses.

Additionally, I noticed several minor points:

* sys_pread()/sys_pwrite(), sys_readv()/sys_writev()
acquire the kernel lock, but they don't need it.
* [sparc64] has special versions of sys32_readv etc. in
sys_sparc32.c. They still contain the "old", i.e.
lock_kernel() synchonization. This should be changed
before 2.4
* mandantory file locks must be synchonized with pending
read/write calls.
* if f_version is removed, then sys_lseek() with default_lseek()
doesn't need the big kernel lock.

I've attached an [untested] patch which removes the superflous lock_kernel()
calls.

Btw, drivers/char/tty_io.c currently calls down(inode->i_sem) during
do_tty_write(). If you acquire i_sem in sys_write(), then you must delete
this line [should avoid one reboot :>)

--
Manfred
[unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.028 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site