From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbbBRAzP (ORCPT ); Tue, 17 Feb 2015 19:55:15 -0500 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.232]:5585 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751940AbbBRAzN (ORCPT ); Tue, 17 Feb 2015 19:55:13 -0500 X-Greylist: delayed 43719 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Feb 2015 19:55:13 EST From: Jeff Layton To: Al Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds Subject: [PATCH] locks: fix list insertion when lock is split in two Date: Tue, 17 Feb 2015 19:55:10 -0500 Message-Id: <1424220910-19516-1-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.1.0 X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Al reported that he had seen some LTP fcntl11 and fcntl21 test failures since the merge window had opened. 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 Signed-off-by: Jeff Layton --- fs/locks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/locks.c b/fs/locks.c index 90b652ad306f..365c82e1b3a9 100644 --- a/fs/locks.c +++ b/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_insert_lock_ctx(new_fl, &fl->fl_list); + fl = new_fl; new_fl = NULL; } if (right) { -- 2.1.0