diff options
Diffstat (limited to 'openvz-sources/022.078-r2/9000_diff-ms-locks-after-close.patch')
-rw-r--r-- | openvz-sources/022.078-r2/9000_diff-ms-locks-after-close.patch | 187 |
1 files changed, 0 insertions, 187 deletions
diff --git a/openvz-sources/022.078-r2/9000_diff-ms-locks-after-close.patch b/openvz-sources/022.078-r2/9000_diff-ms-locks-after-close.patch deleted file mode 100644 index 02c3ef6..0000000 --- a/openvz-sources/022.078-r2/9000_diff-ms-locks-after-close.patch +++ /dev/null @@ -1,187 +0,0 @@ ---- ./include/linux/fs.h.org 2005-06-07 13:54:14.000000000 -0400 -+++ ./include/linux/fs.h 2005-06-07 14:54:00.000000000 -0400 -@@ -688,11 +673,13 @@ extern struct list_head file_lock_list; - #include <linux/fcntl.h> - - extern int fcntl_getlk(struct file *, struct flock __user *); --extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *); -+extern int fcntl_setlk(unsigned int, struct file *, unsigned int, -+ struct flock __user *); - - #if BITS_PER_LONG == 32 - extern int fcntl_getlk64(struct file *, struct flock64 __user *); --extern int fcntl_setlk64(struct file *, unsigned int, struct flock64 __user *); -+extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, -+ struct flock64 __user *); - #endif - - extern void send_sigio(struct fown_struct *fown, int fd, int band); ---- ./fs/locks.c.org 2004-10-18 17:55:24.000000000 -0400 -+++ ./fs/locks.c 2005-06-07 14:54:00.000000000 -0400 -@@ -1475,7 +1475,8 @@ out: - /* Apply the lock described by l to an open file descriptor. - * This implements both the F_SETLK and F_SETLKW commands of fcntl(). - */ --int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock __user *l) -+int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, -+ struct flock __user *l) - { - struct file_lock *file_lock = locks_alloc_lock(0); - struct flock flock; -@@ -1504,6 +1505,7 @@ int fcntl_setlk(struct file *filp, unsig - goto out; - } - -+again: - error = flock_to_posix_lock(filp, file_lock, &flock); - if (error) - goto out; -@@ -1532,26 +1534,34 @@ int fcntl_setlk(struct file *filp, unsig - if (error) - goto out; - -- if (filp->f_op && filp->f_op->lock != NULL) { -+ if (filp->f_op && filp->f_op->lock != NULL) - error = filp->f_op->lock(filp, cmd, file_lock); -- if (error < 0) -- goto out; -- } -- -- for (;;) { -- error = __posix_lock_file(inode, file_lock); -- if ((error != -EAGAIN) || (cmd == F_SETLK)) -+ else { -+ for (;;) { -+ error = __posix_lock_file(inode, file_lock); -+ if ((error != -EAGAIN) || (cmd == F_SETLK)) -+ break; -+ error = wait_event_interruptible(file_lock->fl_wait, -+ !file_lock->fl_next); -+ if (!error) -+ continue; -+ -+ locks_delete_block(file_lock); - break; -- error = wait_event_interruptible(file_lock->fl_wait, -- !file_lock->fl_next); -- if (!error) -- continue; -+ } -+ } - -- locks_delete_block(file_lock); -- break; -+ /* -+ * Attempt to detect a close/fcntl race and recover by -+ * releasing the lock that was just acquired. -+ */ -+ if (!error && -+ cmd != F_UNLCK && fcheck(fd) != filp && flock.l_type != F_UNLCK) { -+ flock.l_type = F_UNLCK; -+ goto again; - } - -- out: -+out: - locks_free_lock(file_lock); - return error; - } -@@ -1609,7 +1620,8 @@ out: - /* Apply the lock described by l to an open file descriptor. - * This implements both the F_SETLK and F_SETLKW commands of fcntl(). - */ --int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l) -+int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, -+ struct flock64 __user *l) - { - struct file_lock *file_lock = locks_alloc_lock(1); - struct flock64 flock; -@@ -1638,6 +1650,7 @@ int fcntl_setlk64(struct file *filp, uns - goto out; - } - -+again: - error = flock64_to_posix_lock(filp, file_lock, &flock); - if (error) - goto out; -@@ -1666,23 +1679,31 @@ int fcntl_setlk64(struct file *filp, uns - if (error) - goto out; - -- if (filp->f_op && filp->f_op->lock != NULL) { -+ if (filp->f_op && filp->f_op->lock != NULL) - error = filp->f_op->lock(filp, cmd, file_lock); -- if (error < 0) -- goto out; -- } -- -- for (;;) { -- error = __posix_lock_file(inode, file_lock); -- if ((error != -EAGAIN) || (cmd == F_SETLK64)) -+ else { -+ for (;;) { -+ error = __posix_lock_file(inode, file_lock); -+ if ((error != -EAGAIN) || (cmd == F_SETLK64)) -+ break; -+ error = wait_event_interruptible(file_lock->fl_wait, -+ !file_lock->fl_next); -+ if (!error) -+ continue; -+ -+ locks_delete_block(file_lock); - break; -- error = wait_event_interruptible(file_lock->fl_wait, -- !file_lock->fl_next); -- if (!error) -- continue; -+ } -+ } - -- locks_delete_block(file_lock); -- break; -+ /* -+ * Attempt to detect a close/fcntl race and recover by -+ * releasing the lock that was just acquired. -+ */ -+ if (!error && -+ cmd != F_UNLCK && fcheck(fd) != filp && flock.l_type != F_UNLCK) { -+ flock.l_type = F_UNLCK; -+ goto again; - } - - out: -@@ -1766,12 +1788,7 @@ void locks_remove_flock(struct file *fil - - while ((fl = *before) != NULL) { - if (fl->fl_file == filp) { -- /* -- * We might have a POSIX lock that was created at the same time -- * the filp was closed for the last time. Just remove that too, -- * regardless of ownership, since nobody can own it. -- */ -- if (IS_FLOCK(fl) || IS_POSIX(fl)) { -+ if (IS_FLOCK(fl)) { - locks_delete_lock(before); - continue; - } ---- ./fs/fcntl.c.org 2005-06-07 13:54:14.000000000 -0400 -+++ ./fs/fcntl.c 2005-06-07 14:54:00.000000000 -0400 -@@ -320,7 +320,7 @@ static long do_fcntl(int fd, unsigned in - break; - case F_SETLK: - case F_SETLKW: -- err = fcntl_setlk(filp, cmd, (struct flock __user *) arg); -+ err = fcntl_setlk(fd, filp, cmd, (struct flock __user *) arg); - break; - case F_GETOWN: - /* -@@ -408,7 +408,8 @@ asmlinkage long sys_fcntl64(unsigned int - break; - case F_SETLK64: - case F_SETLKW64: -- err = fcntl_setlk64(filp, cmd, (struct flock64 __user *) arg); -+ err = fcntl_setlk64(fd, filp, cmd, -+ (struct flock64 __user *) arg); - break; - default: - err = do_fcntl(fd, cmd, arg, filp); |