From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 298C5CA0EC7 for ; Mon, 11 Sep 2023 21:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237441AbjIKVTJ (ORCPT ); Mon, 11 Sep 2023 17:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239654AbjIKOZc (ORCPT ); Mon, 11 Sep 2023 10:25:32 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB5A9DE for ; Mon, 11 Sep 2023 07:25:28 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D7CBC433C8; Mon, 11 Sep 2023 14:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694442328; bh=Lp16CY7BhTg1fEmg2r5b3rzImD8J7Bs9rBTRaVD8XFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rXOhTn05Uh8cn/ZoVqWaYEtx4F8s2qPMXI0w7QXoA+qPbckY1BAgTlaYir+b7wCck eFJHZ/1NacL1azrB+im9FIflu0su5d1jK07Hmvz6IlNXEoZ3plWvEXE002rJsWrmKL abESeTgFR/ZMCggxX+6BXCeKbk1JtQsFYutsV4E4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Barry Marson , Alexander Aring , David Teigland Subject: [PATCH 6.5 699/739] dlm: fix plock lookup when using multiple lockspaces Date: Mon, 11 Sep 2023 15:48:18 +0200 Message-ID: <20230911134710.616768642@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230911134650.921299741@linuxfoundation.org> References: <20230911134650.921299741@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Aring commit 7c53e847ff5e97f033fdd31f71949807633d506b upstream. All posix lock ops, for all lockspaces (gfs2 file systems) are sent to userspace (dlm_controld) through a single misc device. The dlm_controld daemon reads the ops from the misc device and sends them to other cluster nodes using separate, per-lockspace cluster api communication channels. The ops for a single lockspace are ordered at this level, so that the results are received in the same sequence that the requests were sent. When the results are sent back to the kernel via the misc device, they are again funneled through the single misc device for all lockspaces. When the dlm code in the kernel processes the results from the misc device, these results will be returned in the same sequence that the requests were sent, on a per-lockspace basis. A recent change in this request/reply matching code missed the "per-lockspace" check (fsid comparison) when matching request and reply, so replies could be incorrectly matched to requests from other lockspaces. Cc: stable@vger.kernel.org Reported-by: Barry Marson Fixes: 57e2c2f2d94c ("fs: dlm: fix mismatch of plock results from userspace") Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- fs/dlm/plock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c @@ -456,7 +456,8 @@ static ssize_t dev_write(struct file *fi } } else { list_for_each_entry(iter, &recv_list, list) { - if (!iter->info.wait) { + if (!iter->info.wait && + iter->info.fsid == info.fsid) { op = iter; break; } @@ -468,8 +469,7 @@ static ssize_t dev_write(struct file *fi if (info.wait) WARN_ON(op->info.optype != DLM_PLOCK_OP_LOCK); else - WARN_ON(op->info.fsid != info.fsid || - op->info.number != info.number || + WARN_ON(op->info.number != info.number || op->info.owner != info.owner || op->info.optype != info.optype);