Red Hat Bugzilla – Bug 189975
Enable NLM to use f_op->lock interface
Last modified: 2007-11-30 17:07:31 EST
Description of problem:
The struct file_operations (include/linux/fs.h) has "lock"
int (*lock) (struct file *, int, struct file_lock *);
and system call interfaces (sys_fcntl and sys_flock) have
been calling this interface to invoke filesystem specific
lock functions. Unfortunately, NLM and NFS v4 code, using
posix_lock_file() VFS call, do not follow this (i.e., they
do not invoke f_op->lock in the code patch at all).
This may not be an issue for local filesystem such as ext3
(that doesn't define its own "lock" method) but it is a
nontrivial function flaw for cluster filesystem such as GFS.
The implication here is that GFS can't do file locking
across different nodes if accessed from NFS export.
Version-Release number of selected component (if applicable):
All NLM and NFS v4 code within RHEL versions, including
Each time and every time
Steps to Reproduce:
1. Export GFS share via NFS
2. Lock the file via fcntl() from different NFS clients
The lock calls completes.
For exclusive locks such as F_WRLCK, only one call
should go thru.
Note that the result is correct if the file is locked via
local access (i.e., invoking fcntl() directly from different
GFS nodes). In simple words, the VFS layer behaves correctly
but not NLM and NFS v4 code.
Created attachment 128249 [details]
Test patch for this issue - changes posix_lock_file() in fs/locks.c.
I have a typo in the "Steps to Reproduce":
"2. Lock the file via fcntl() from different NFS clients" should be:
2. Lock the (same) GFS file via fcntl() to different NFS servers.
IBM opened an identical bugzilla (196318) - since it has an IT ticket
attached to IT, I'll cancel mine.
*** This bug has been marked as a duplicate of 196318 ***