Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6265991imu; Mon, 21 Jan 2019 06:05:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN6nrTQG0m/b+F78h3pJj3EDSTksfgqX98BmwHCYAvcdMGrVSNa/jzrNg+52ITHaB5Rsxzr0 X-Received: by 2002:a63:e950:: with SMTP id q16mr28351510pgj.138.1548079554604; Mon, 21 Jan 2019 06:05:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079554; cv=none; d=google.com; s=arc-20160816; b=NrZ2QZhvn9gI4/8BcGx0UyvBvzO2Dsuv2ssiIwRhM3livSpDx0JAsW0OEVIf60Hp8I BoJF/1x9hnwBcSF4+qyo5pB9/OC/MXN75kBPp1d6ghrny8HNd77o2ZGNMDFSY3pBbdVj iJtnWyC5BkPnBq7S2D7b7fCdDtHbLKuNJ4BB+yu+5yxzujO61a+c80vtL+tQJ6NFsyMN a9phouVba43+XMptml0wfTzQTY58wEMDNmKKvuB06Yoc5iCsXz6+urxoVVkbW5nrFfkA gxCzF6LNM4gJc/H8rLDzyiffk7pY+AoLqG+/gj4wxdpTry+pt5Ps/RY/k14qvi+/cnlx 6CKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FERKA3uCEuTwxylU3kuEdmJQYY37B8qtgp4zRQI8Vfk=; b=Wt8UDxODyDbl1CYHyKqy0jsK6Yqu0Hnb7Q1Fplnf+JtZPyv4vhJA1KCNFi1NqDF+ro VdfQJaB278MsTOMHBVRlDs/zJtbI1qCjYTpd1kdlSmV5fVQ9B8WmcdsaOhh/uIb4+r9Q wLlkd6q47zDITbtHNl9IO33jvYH1hr61/VTYnCsLW51/eqeegaUqhiAC5IaLDDN+j+6U 36TF807FmdaqJ4GjLI2AisAG3XYqZAakpactwtR77tHOi6XZVa7OSHEkYXsI3MECNOls 0KX8go5ByROKGDeZ8i8FlQMOHw9DNtoj/7AsXEx3PgniNq9819sD4pIw7hN1qHK5HkIm YgYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="smpy9/7h"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si13079366pli.220.2019.01.21.06.05.37; Mon, 21 Jan 2019 06:05:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="smpy9/7h"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732910AbfAUODA (ORCPT + 99 others); Mon, 21 Jan 2019 09:03:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:50684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732895AbfAUOCx (ORCPT ); Mon, 21 Jan 2019 09:02:53 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B3CB2089F; Mon, 21 Jan 2019 14:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079372; bh=EJ7mhCHlruBHBz7rBn73zQo/Dm4GHF6SYh1xiWP3R5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=smpy9/7hAUTrevGULM1pAv3Zq7Y5d4m7utj27y30w87UnR7ItPsto6ZFd+/qrv46u Pw/s9Nob9OWs5xlk7DBl2S7DPsDApZV4U+7h0WzxSEkxHTYh++sKxItffCcrxIxg5w 58o38S8zVm1hbs60zRbDMoThzoc+F6eELGIuYyjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Jens Axboe Subject: [PATCH 4.19 82/99] loop: Fold __loop_release into loop_release Date: Mon, 21 Jan 2019 14:49:14 +0100 Message-Id: <20190121134917.220981242@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jan Kara commit 967d1dc144b50ad005e5eecdfadfbcfb399ffff6 upstream. __loop_release() has a single call site. Fold it there. This is currently not a huge win but it will make following replacement of loop_index_mutex more obvious. Signed-off-by: Jan Kara Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/block/loop.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1642,12 +1642,15 @@ out: return err; } -static void __lo_release(struct loop_device *lo) +static void lo_release(struct gendisk *disk, fmode_t mode) { + struct loop_device *lo; int err; + mutex_lock(&loop_index_mutex); + lo = disk->private_data; if (atomic_dec_return(&lo->lo_refcnt)) - return; + goto unlock_index; mutex_lock(&loop_ctl_mutex); if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) { @@ -1657,7 +1660,7 @@ static void __lo_release(struct loop_dev */ err = loop_clr_fd(lo); if (!err) - return; + goto unlock_index; } else if (lo->lo_state == Lo_bound) { /* * Otherwise keep thread (if running) and config, @@ -1668,12 +1671,7 @@ static void __lo_release(struct loop_dev } mutex_unlock(&loop_ctl_mutex); -} - -static void lo_release(struct gendisk *disk, fmode_t mode) -{ - mutex_lock(&loop_index_mutex); - __lo_release(disk->private_data); +unlock_index: mutex_unlock(&loop_index_mutex); }