patch-1.3.86 linux/fs/namei.c

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

diff -u --recursive --new-file v1.3.85/linux/fs/namei.c linux/fs/namei.c
@@ -385,6 +385,13 @@
 		iput(dir);
 		return error;
 	}
+	/* SunOS, Solaris 2.x and HPUX all deny open() on
+	 * an existing file with mandatory locks.
+	 */
+	if ((error = locks_verify_locked(inode)) != 0) {
+		iput(inode);
+		return error;
+	}
 	error = follow_link(dir,inode,flag,mode,&inode);
 	if (error)
 		return error;
@@ -430,6 +437,17 @@
 			iput(inode);
 			return error;
 		}
+#if 0
+		/*
+		 * In my opinion the mandatory lock check should really be
+		 * here. Only O_TRUNC calls can modify the file contents -
+		 * but none of the commercial OS'es seem to do it this way.
+		 */
+		if ((error = locks_verify_locked(inode)) != 0) {
+			iput(inode);
+			return error;
+		}
+#endif
 		if (inode->i_sb && inode->i_sb->dq_op)
 			inode->i_sb->dq_op->initialize(inode, -1);
 			

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this