patch-pre2.0.3 linux/fs/locks.c

Next file: linux/fs/ufs/ufs_inode.c
Previous file: linux/fs/file_table.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.2/linux/fs/locks.c linux/fs/locks.c
@@ -75,8 +75,14 @@
  *  Fixed deadlock condition for pathological code that mixes calls to
  *  flock() and fcntl().
  *  Andy Walker (andy@lysaker.kvaerner.no), April 29, 1996.
+ *
+ *	BUG: MUST DISALLOW MANDATORY LOCK ON NFS/SMB/NCP FILE SYSTEM 
+ *	TO MATCH SYS5.4 SEMANTICS.
+ *
  */
 
+#include <linux/config.h>
+
 #include <linux/malloc.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -336,6 +342,7 @@
 
 int locks_mandatory_locked(struct inode *inode)
 {
+#ifdef CONFIG_LOCK_MANDATORY
 	struct file_lock *fl;
 
 	/* Search the lock list for this inode for any POSIX locks.
@@ -344,6 +351,7 @@
 		if ((fl->fl_flags & F_POSIX) && (fl->fl_owner != current))
 			return (-EAGAIN);
 	}
+#endif	
 	return (0);
 }
 
@@ -353,16 +361,19 @@
 	/* Candidates for mandatory locking have the setgid bit set
 	 * but no group execute bit -  an otherwise meaningless combination.
 	 */
+#ifdef CONFIG_LOCK_MANDATORY	 
 	if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
 		return (locks_mandatory_area(read_write, inode, filp, offset,
 					     count));
+#endif					     
 	return (0);
 }
-	
+
 int locks_mandatory_area(int read_write, struct inode *inode,
 			 struct file *filp, unsigned int offset,
 			 unsigned int count)
 {
+#ifdef CONFIG_LOCK_MANDATORY	
 	struct file_lock *fl;
 
 repeat:
@@ -401,6 +412,7 @@
 			goto repeat;
 		}
 	}
+#endif
 	return (0);
 }
 
@@ -936,8 +948,8 @@
 		p += sprintf(p, "FLOCK  ADVISORY  ");
 	}
 	p += sprintf(p, "%s ", (fl->fl_type == F_RDLCK) ? "READ " : "WRITE");
-	p += sprintf(p, "%d %04x:%ld %ld %ld ",
-		     fl->fl_owner->pid, fl->fl_file->f_inode->i_dev,
+	p += sprintf(p, "%d %s:%ld %ld %ld ",
+		     fl->fl_owner->pid, kdevname(fl->fl_file->f_inode->i_dev),
 		     fl->fl_file->f_inode->i_ino, fl->fl_start,
 		     fl->fl_end);
 	p += sprintf(p, "%08lx %08lx %08lx %08lx %08lx\n%d:%s",

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