linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/5] POSIX Locking fixes. Take 2...
@ 2004-06-30  0:29 Trond Myklebust
  0 siblings, 0 replies; only message in thread
From: Trond Myklebust @ 2004-06-30  0:29 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Andrew Morton

NFSv4 server: Fix up nfs4state.c to support the file_lock_operations.

 nfs4state.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff -u --recursive --new-file --show-c-function linux-2.6.7-02-fix_locks2/fs/nfsd/nfs4state.c linux-2.6.7-03-fix_nfsd/fs/nfsd/nfs4state.c
--- linux-2.6.7-02-fix_locks2/fs/nfsd/nfs4state.c	2004-06-29 17:27:53.000000000 -0400
+++ linux-2.6.7-03-fix_nfsd/fs/nfsd/nfs4state.c	2004-06-29 17:45:42.000000000 -0400
@@ -2180,6 +2180,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
 		goto out;
 	}
 
+	locks_init_lock(&file_lock);
 	switch (lock->lk_type) {
 		case NFS4_READ_LT:
 		case NFS4_READW_LT:
@@ -2197,9 +2198,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
 	file_lock.fl_pid = lockownerid_hashval(lock->lk_stateowner->so_id);
 	file_lock.fl_file = filp;
 	file_lock.fl_flags = FL_POSIX;
-	file_lock.fl_notify = NULL;
-	file_lock.fl_insert = NULL;
-	file_lock.fl_remove = NULL;
 
 	file_lock.fl_start = lock->lk_offset;
 	if ((lock->lk_length == ~(u64)0) || 
@@ -2215,6 +2213,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
 	*/
 
 	status = posix_lock_file(filp, &file_lock);
+	if (file_lock.fl_ops && file_lock.fl_ops->fl_release_private)
+		file_lock.fl_ops->fl_release_private(&file_lock);
 	dprintk("NFSD: nfsd4_lock: posix_test_lock passed. posix_lock_file status %d\n",status);
 	switch (-status) {
 	case 0: /* success! */
@@ -2296,6 +2296,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru
 	}
 
 	inode = current_fh->fh_dentry->d_inode;
+	locks_init_lock(&file_lock);
 	switch (lockt->lt_type) {
 		case NFS4_READ_LT:
 		case NFS4_READW_LT:
@@ -2381,14 +2382,12 @@ nfsd4_locku(struct svc_rqst *rqstp, stru
 
 	filp = &stp->st_vfs_file;
 	BUG_ON(!filp);
+	locks_init_lock(&file_lock);
 	file_lock.fl_type = F_UNLCK;
 	file_lock.fl_owner = (fl_owner_t) locku->lu_stateowner;
 	file_lock.fl_pid = lockownerid_hashval(locku->lu_stateowner->so_id);
 	file_lock.fl_file = filp;
 	file_lock.fl_flags = FL_POSIX; 
-	file_lock.fl_notify = NULL;
-	file_lock.fl_insert = NULL;
-	file_lock.fl_remove = NULL;
 	file_lock.fl_start = locku->lu_offset;
 
 	if ((locku->lu_length == ~(u64)0) || LOFF_OVERFLOW(locku->lu_offset, locku->lu_length))
@@ -2401,6 +2400,8 @@ nfsd4_locku(struct svc_rqst *rqstp, stru
 	*  Try to unlock the file in the VFS.
 	*/
 	status = posix_lock_file(filp, &file_lock); 
+	if (file_lock.fl_ops && file_lock.fl_ops->fl_release_private)
+		file_lock.fl_ops->fl_release_private(&file_lock);
 	if (status) {
 		printk("NFSD: nfs4_locku: posix_lock_file failed!\n");
 		goto out_nfserr;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-30  0:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-30  0:29 [PATCH 3/5] POSIX Locking fixes. Take 2 Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).