소스 검색

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>
Jeff Layton 11 년 전
부모
커밋
2e2f756f81
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      fs/locks.c

+ 1 - 0
fs/locks.c

@@ -1107,6 +1107,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
 		}
 		}
 		locks_copy_lock(new_fl, request);
 		locks_copy_lock(new_fl, request);
 		locks_insert_lock_ctx(new_fl, &fl->fl_list);
 		locks_insert_lock_ctx(new_fl, &fl->fl_list);
+		fl = new_fl;
 		new_fl = NULL;
 		new_fl = NULL;
 	}
 	}
 	if (right) {
 	if (right) {