locks: fix list insertion when lock is split in two
authorJeff Layton <jeff.layton@primarydata.com>
Tue, 17 Feb 2015 22:08:23 +0000 (17:08 -0500)
committerJeff Layton <jeff.layton@primarydata.com>
Tue, 17 Feb 2015 22:08:23 +0000 (17:08 -0500)
In the case where we're splitting a lock in two, the current code
the new "left" lock in the incorrect spot. It's inserted just
before "right" when it should instead be inserted just before the
new lock.

When we add a new lock, set "fl" to that value so that we can
add "left" before it.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
fs/locks.c

index 90b652ad306f126941258d7d8448f45172d67a4e..365c82e1b3a9a602057e65edc9b857c6adce6b76 100644 (file)
@@ -1107,6 +1107,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
                }
                locks_copy_lock(new_fl, request);
                locks_insert_lock_ctx(new_fl, &fl->fl_list);
+               fl = new_fl;
                new_fl = NULL;
        }
        if (right) {
This page took 0.033689 seconds and 5 git commands to generate.