Messages in this thread | | | From | "Manfred Spraul" <> | Subject | get_empty_filp() is not SMP safe. [f_version problem] | Date | Thu, 12 Aug 1999 16:34:48 +0200 |
| |
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] | |