Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2148216ybh; Fri, 24 Jul 2020 05:46:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE9Fwbr8wcXsLM+F2XCeD8Khu/RxQANE/UHxP7Xwda6D0atoaZsqg4k7KNIDaxj8PJMZ5E X-Received: by 2002:aa7:d043:: with SMTP id n3mr9049564edo.102.1595594761189; Fri, 24 Jul 2020 05:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595594761; cv=none; d=google.com; s=arc-20160816; b=AtbaFu0cAiQrprXKA2vDCH+WlGOdTNlqeHveJA7dg5tTk103xWc1vCZnJLkzFlqRNR jOBZEY09DyEyyOF1I/fCkZT0NLRslz7Dua4Br13jZJWIB78+87o63Ip/Uvx5/ZX6bc/W ZtJ/WmbHZDZJZsX431bcCDOlZO61jJ7wOIfGXH53TXN5fodnfVJHMgTfc78eLPZr5hNC WFWenxCYljRhqCkH3f5oCSo8lYwIcAzjR1NcbwRUpjLfv0z6Q1V9NCDrZl1VRtXPMxdm lwUikc08LHYbC+50usBzUvfoeL6kceJWLTkYCT8dFH4FYGF9JBsUIQV2gSGkL4+0X4cG 9hKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date; bh=TEoFH+RTekVI8oOBksvS7gIvUmdsL4ciCyh3D03+bD4=; b=QE7n2MXmn8JgdEjiBP3z/AmB4MfeyxnX/vULGEWdeiAOpnUj4vfXrt/jUH/H3eXavo AOzO5PADUPxaqJ5T4vRkCWLSgzR/oon+QIBVrBSis0KK4wLjM7kqofo+4gtgaf/D2D/B XocWzWhPd6hllXARwHm9hnEkPjysx2LxwHntmUyAMX+YSppiMhkU5u0y4BVF/VVVwTUg PCX8h6cjwhC19HKm7jaLDFPiVmXkNcw9za1MR9wE6AAaljaRWahhCsNEH+1x6dNHlVY7 RhUIrwmlDZuyXYXP2GNrwm6Iy5zCMjc6RbQZhMBgjkRILjfToKpi8CKtUN8bfe4eBW4r RS2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si496826ejr.728.2020.07.24.05.45.38; Fri, 24 Jul 2020 05:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726717AbgGXMoq (ORCPT + 99 others); Fri, 24 Jul 2020 08:44:46 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:54924 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbgGXMoq (ORCPT ); Fri, 24 Jul 2020 08:44:46 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 820931C0BD2; Fri, 24 Jul 2020 14:44:43 +0200 (CEST) Date: Fri, 24 Jul 2020 14:44:43 +0200 From: Pavel Machek To: trivial@kernel.org, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org, Linus Torvalds Subject: [PATCH] ocfs2: fix unbalanced locking Message-ID: <20200724124443.GA28164@duo.ucw.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Based on what fails, function can return with nfs_sync_rwlock either locked or unlocked. That can not be right. Always return with lock unlocked on error. Signed-off-by: Pavel Machek (CIP) diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 751bc4dc7466..8e3a369086db 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -2871,9 +2871,15 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int= ex) =20 status =3D ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE, 0, 0); - if (status < 0) + if (status < 0) { mlog(ML_ERROR, "lock on nfs sync lock failed %d\n", status); =20 + if (ex) + up_write(&osb->nfs_sync_rwlock); + else + up_read(&osb->nfs_sync_rwlock); + } + return status; } =20 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --UlVJffcvxoiEqYs2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCXxrXuwAKCRAw5/Bqldv6 8mMZAJ9ImD3Zna3EbjqRkZmQ9g+j2FIR+ACfVSoDxZcmWOs5QfVBWyriyW1cD58= =ULHo -----END PGP SIGNATURE----- --UlVJffcvxoiEqYs2--