patch-2.2.13 linux/fs/nfs/file.c

Next file: linux/fs/nfs/inode.c
Previous file: linux/fs/nfs/dir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.12/linux/fs/nfs/file.c linux/fs/nfs/file.c
@@ -198,7 +198,7 @@
 nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
 	struct inode * inode = filp->f_dentry->d_inode;
-	int	status;
+	int	status = 0;
 
 	dprintk("NFS: nfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%ld:%ld)\n",
 			inode->i_dev, inode->i_ino,
@@ -213,8 +213,11 @@
 		return -ENOLCK;
 
 	/* Fake OK code if mounted without NLM support */
-	if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)
-		return 0;
+	if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM) {
+		if (cmd == F_GETLK)
+			status = LOCK_USE_CLNT;
+		goto out_ok;
+	}
 
 	/*
 	 * No BSD flocks over NFS allowed.
@@ -236,11 +239,14 @@
 
 	if ((status = nlmclnt_proc(inode, cmd, fl)) < 0)
 		return status;
+	else
+		status = 0;
 
 	/*
 	 * Make sure we re-validate anything we've got cached.
 	 * This makes locking act as a cache coherency point.
 	 */
+ out_ok:
 	NFS_CACHEINV(inode);
-	return 0;
+	return status;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)