remote filesystem locking ; problem in the VFS ????

Michel LESPINASSE (walken@foxfiber.com)
Mon, 7 Jul 1997 18:14:01 -0400 (EDT)


Hi,

I recently realized that the ncpfs implementation in Linux does not
support remote filesystem locking. I mean that if two applications
running on a linux box try to lock the same remote file, they wont
be able to both lock it at the same time, which is ok, but some
application running on different boxes will be able to take the lock at
the same time, which is not okay. In other words, the ncpfs client under
Linux currently does not inform the netware server that it considers he
has taken the lock.

I tried to look and see how i could implement this in the linux ncpfs
client, and came to the following conclusion. please correct me if i'm
wrong.....

In the current situation, the different locking protocols (posix and
flock) are implemented in the VFS layer. There isnt any
filesystem-specific function that is called when an user process makes a
call to flock or to fcntl for locking. So, it is currently impossible to
implement remote locking in the ncp filesystem. If we wanted to do so, we
would have to add a new function in the interface between the FS and VFS
layers, and logically this function should belong to the inode_operations
structure (and not file_operations). The functions flock_lock_file and
posix_lock_file in fs/locks.c should be modified to call this new
interface function, if its not set to NULL.

Am I right up to here ? and, what should be the prototype of this new
interface function ? I'm thinking about something in the lines of

int (*lock) (struct inode *i,int l);

where l would be the locking mode (read lock, write lock, or unlock), and
the result will be 0 or 1 for lock failure or lock success. Is this
interface general enough to decently support all of the
remote-locking-capable filesystems ?

I still dont have a lot of kernel hacking experience, so I really would
like to hear your suggestions about this. Is there some specific issues
that I need to consider ? Is there some problems with my current analysis ?

Thanks in advance for your input.

Michel "Walken" LESPINASSE - Student at Ecole Centrale Paris (France)
www Email : walken@via.ecp.fr
(o o) VideoLan project : http://videolan.via.ecp.fr/
------oOO--(_)--OOo-------------------------------------------------------
During this summer, please contact me at walken@foxfiber.com instead...