patch-2.2.18 linux/fs/locks.c
Next file: linux/fs/namei.c
Previous file: linux/fs/lockd/xdr4.c
Back to the patch index
Back to the overall index
- Lines: 73
- Date:
Tue Nov 28 16:42:03 2000
- Orig file:
v2.2.17/fs/locks.c
- Orig date:
Fri Apr 21 12:46:44 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/fs/locks.c linux/fs/locks.c
@@ -339,7 +339,7 @@
goto out;
error = -EINVAL;
- if (!filp->f_dentry || !filp->f_dentry->d_inode)
+ if (!filp->f_dentry || !filp->f_dentry->d_inode || !filp->f_op)
goto out_putf;
if (!posix_make_lock(filp, &file_lock, &flock))
@@ -409,19 +409,17 @@
goto out_putf;
if (!(inode = dentry->d_inode))
goto out_putf;
+ if (!filp->f_op)
+ goto out_putf;
/* Don't allow mandatory locks on files that may be memory mapped
* and shared.
*/
if (IS_MANDLOCK(inode) &&
(inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID &&
- inode->i_mmap) {
- struct vm_area_struct *vma = inode->i_mmap;
+ inode->i_mmap_shared) {
error = -EAGAIN;
- do {
- if (vma->vm_flags & VM_MAYSHARE)
- goto out_putf;
- } while ((vma = vma->vm_next_share) != NULL);
+ goto out_putf;
}
error = -EINVAL;
@@ -493,7 +491,9 @@
while ((fl = *before) != NULL) {
if ((fl->fl_flags & FL_POSIX) && fl->fl_owner == owner) {
int (*lock)(struct file *, int, struct file_lock *);
- lock = filp->f_op->lock;
+ lock = NULL;
+ if(filp->f_op)
+ lock = filp->f_op->lock;
if (lock) {
file_lock = *fl;
file_lock.fl_type = F_UNLCK;
@@ -1134,6 +1134,8 @@
new->fl_start = fl->fl_start;
new->fl_end = fl->fl_end;
new->fl_notify = fl->fl_notify;
+ new->fl_insert = fl->fl_insert;
+ new->fl_remove = fl->fl_remove;
new->fl_u = fl->fl_u;
}
return new;
@@ -1152,6 +1154,9 @@
fl->fl_next = *pos; /* insert into file's list */
*pos = fl;
+ if (fl->fl_insert)
+ fl->fl_insert(fl);
+
return;
}
@@ -1179,6 +1184,9 @@
prevfl->fl_nextlink = nextfl;
else
file_lock_table = nextfl;
+
+ if (thisfl->fl_remove)
+ thisfl->fl_remove(thisfl);
locks_wake_up_blocks(thisfl, wait);
locks_free_lock(thisfl);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)