Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3022517ybt; Mon, 29 Jun 2020 13:09:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7RYQ39OoQ1+kM/c7NmaAP9dsNKCBtSATz8QoHHlme1VdF/aMakeuMoLuBIe67cZ4N1zP3 X-Received: by 2002:a50:a207:: with SMTP id 7mr19872858edl.92.1593461368527; Mon, 29 Jun 2020 13:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593461368; cv=none; d=google.com; s=arc-20160816; b=I892iP1ltLBPdJAzLRgZTu60GYhxk4bqTOfEusWSs3UIIChJgYwwWvP7sSI+wiTZyk +f4//AhSHmtgtcyOwzv6Jl7EbThROjqFBlex2UGRWctOjraT3Kelf3e4RMrQXcybdSjR jOWdJdmEeqyHTTzYHaIjU76rZrCzLpI4eB1b2Ep3HSEBVsnmXbstd7Gm8a39e4sdBYCD uwswJ2pZLBSbi+wWPBWrnJBknUMtEkkGWTc9jx6GSShfFZEOZJwZs14sjX5rt1AKaJAC qwHEgyXLJ471ujGCRvBx8cz2RLBqqYAz/McL9prPiE++VvQPsZpsVyk7VUauyJ86PqeV 3S7w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SZh/7neUgoK8st8JGTOHdmkiw0eeQYob4LVRNjT2wAs=; b=ygy06J6ik1CbWuD+/oS+gzfYUkk8mZXD95njrknFxUeDVd5uCzl9sMx9JOONCulac5 GegSZKx74pjL0Zb2AitdFGf8pdQy1d7lMrDd4xhf3VX8K9UHP4413yYdjpdpqAaHJlwX YsbpXTTru977Jp/FD3cr9O9mnbL8LqiIdvgXZbgQBnw0e2EpHLktlSI/C7+v6wDYBJ2J t2k71WY50TjI3zJBms4roA4CE3O29rAGvtbpCzz+WxZmPBueEaus9W4pNBn4kDu42Lz6 aV9oeKGfiEpapu0e2MTDrEFGvA2VHpaTOwD4aGnmMie7Hdw2WTFr+elO5KDIPeWrHp12 Jtig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vg8LIWdL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si371825ejf.218.2020.06.29.13.09.05; Mon, 29 Jun 2020 13:09:28 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Vg8LIWdL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388905AbgF2UIC (ORCPT + 99 others); Mon, 29 Jun 2020 16:08:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:40574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732935AbgF2TaX (ORCPT ); Mon, 29 Jun 2020 15:30:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0ACFB25242; Mon, 29 Jun 2020 15:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593444958; bh=+CZ1Ya6xfPZttiJxEVIJEq0Qr4UQlcxzo5YMQg1Qbts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vg8LIWdLl+IGqyKYrcmDkFJ0rL9NvDAzm/9ceLA7So6N/9AfeZ5sf/0y/xgtm7c0p S31nGLAuOwPrrCbpo6elffhvfUfKWS1Lyk0f3SpaBfH3iE/wy+kMFqc0H5piBh8M5M xMLQSz8rmhj5YgtAkYv2pZb8kSIqrY6l6B3Io4PA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zheng Bin , Christoph Hellwig , Bart Van Assche , Jens Axboe , Greg Kroah-Hartman Subject: [PATCH 4.19 057/131] loop: replace kill_bdev with invalidate_bdev Date: Mon, 29 Jun 2020 11:33:48 -0400 Message-Id: <20200629153502.2494656-58-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629153502.2494656-1-sashal@kernel.org> References: <20200629153502.2494656-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.131-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.19.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.19.131-rc1 X-KernelTest-Deadline: 2020-07-01T15:34+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zheng Bin commit f4bd34b139a3fa2808c4205f12714c65e1548c6c upstream. When a filesystem is mounted on a loop device and on a loop ioctl LOOP_SET_STATUS64, because of kill_bdev, buffer_head mappings are getting destroyed. kill_bdev truncate_inode_pages truncate_inode_pages_range do_invalidatepage block_invalidatepage discard_buffer -->clear BH_Mapped flag sb_bread __bread_gfp bh = __getblk_gfp -->discard_buffer clear BH_Mapped flag __bread_slow submit_bh submit_bh_wbc BUG_ON(!buffer_mapped(bh)) --> hit this BUG_ON Fixes: 5db470e229e2 ("loop: drop caches if offset or block_size are changed") Signed-off-by: Zheng Bin Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/block/loop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index c1341c86bcded..728681a20b7f4 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1238,7 +1238,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) if (lo->lo_offset != info->lo_offset || lo->lo_sizelimit != info->lo_sizelimit) { sync_blockdev(lo->lo_device); - kill_bdev(lo->lo_device); + invalidate_bdev(lo->lo_device); } /* I/O need to be drained during transfer transition */ @@ -1512,12 +1512,12 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg) if (lo->lo_queue->limits.logical_block_size != arg) { sync_blockdev(lo->lo_device); - kill_bdev(lo->lo_device); + invalidate_bdev(lo->lo_device); } blk_mq_freeze_queue(lo->lo_queue); - /* kill_bdev should have truncated all the pages */ + /* invalidate_bdev should have truncated all the pages */ if (lo->lo_queue->limits.logical_block_size != arg && lo->lo_device->bd_inode->i_mapping->nrpages) { err = -EAGAIN; -- 2.25.1