Skip to content

Commit 2e2f756

Browse files
author
Jeff Layton
committed
locks: fix list insertion when lock is split in two
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>
1 parent 267f112 commit 2e2f756

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎fs/locks.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
11071107
}
11081108
locks_copy_lock(new_fl, request);
11091109
locks_insert_lock_ctx(new_fl, &fl->fl_list);
1110+
fl = new_fl;
11101111
new_fl = NULL;
11111112
}
11121113
if (right) {

0 commit comments

Comments
 (0)