Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2749840ybh; Mon, 5 Aug 2019 06:15:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOcFD/Gjx+lBEI8mhFg+QSigfLJdLSyPwVdojwxidf1GK70EkRACPdFOlUs93UNKB882Jw X-Received: by 2002:a63:2364:: with SMTP id u36mr131969488pgm.449.1565010949965; Mon, 05 Aug 2019 06:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565010949; cv=none; d=google.com; s=arc-20160816; b=gGhHi2nEhvo6uSWTOEeU5vmFFHb+AEJ6t13uqgHqFLhW+erR3s6NmMnghT98wzRiq5 iXqdR2zQz5Eo6kgL7YTbOqEWguJ9PIrtqCbdQdtXsFj19eBTIDQ3No4i2NyqWxk/aAsO NsYDMPFN2WAzET7n0WHl1yyGHwonFh0Dk0tTGF3MDEgSQajlBcsrfLjNRc/cEPnTVuJz U4n6+CUxHTbksrV2Z0S1LHTnU1WL84upmpK0qtfNV0pMQC+UBacXqyxh/Tp5//MPgTZb fc/ujF4Gl3R5b37ew1vjUIEVtSwurpLyvLtTbmyPwuXGmF0R0f9UFbQG+PsLwjbkEHrF Zwjg== 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=hfNbPQ5U0xhngG5VaUlFhVEKwoN0DJBGgX05GIU9Lak=; b=0BKV3QERENZV8jtN3+P4NVwL1V/DBjR48lmLtL8ZWBM75+TRv+6wCM47LQdJoZEWva XOYr4BmpO9d22qmp6EWaOxjXKeH1feKQXW0tFG9xB0g8sEuItgSHzRseZXOX4HTNMNHX QkmVTk7T063ILIkWNnX3++BtJCtDIu9/rsOQ/3HFpukEJWXykiZ3BAJJsUVEMG1/gHiK 2YG8cfvpyPttFnWf4JbXOag6ILM3ZTUfYD+lJYLRZ5GprhrUIiy4Nxkc4RDo1vtymJxO rpbXMpphsBFg6H+qs0ayoyQTAPbujYFTCV+tVEGPIdQuQC6YjGjn30bXQWyDk77det4y AyNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x8e50++d; 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 h18si12334686pjt.9.2019.08.05.06.15.34; Mon, 05 Aug 2019 06:15:49 -0700 (PDT) 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=x8e50++d; 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 S1729122AbfHENIJ (ORCPT + 99 others); Mon, 5 Aug 2019 09:08:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:46034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729955AbfHENIH (ORCPT ); Mon, 5 Aug 2019 09:08:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 4DCB92075B; Mon, 5 Aug 2019 13:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565010486; bh=IqjSK9W3j2L6/NohAdlcBv+/sC6WYnsk0r0fGiwNuA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8e50++dqz1ikr54ufAbsgC6MMDp+N5DN9wU0Yc3eIEVOy+u8CvM2tc1YrSoZ79Fk eUkf7Y+hhTbU7vwistQyh9jkyZzR122hgDFv+mJm0EIZGOOENUhH0G4SxqwKne4tbw ETiI1+cQl1mHqVLUlfSEOo5iSMX+Ig91u7M2DRbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-block@vger.kernel.org, Ratna Manoj Bolla , nbd@other.debian.org, David Woodhouse , Josef Bacik , Munehisa Kamata , Jens Axboe Subject: [PATCH 4.14 43/53] nbd: replace kill_bdev() with __invalidate_device() again Date: Mon, 5 Aug 2019 15:03:08 +0200 Message-Id: <20190805124932.785697070@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124927.973499541@linuxfoundation.org> References: <20190805124927.973499541@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Munehisa Kamata commit 2b5c8f0063e4b263cf2de82029798183cf85c320 upstream. Commit abbbdf12497d ("replace kill_bdev() with __invalidate_device()") once did this, but 29eaadc03649 ("nbd: stop using the bdev everywhere") resurrected kill_bdev() and it has been there since then. So buffer_head mappings still get killed on a server disconnection, and we can still hit the BUG_ON on a filesystem on the top of the nbd device. EXT4-fs (nbd0): mounted filesystem with ordered data mode. Opts: (null) block nbd0: Receive control failed (result -32) block nbd0: shutting down sockets print_req_error: I/O error, dev nbd0, sector 66264 flags 3000 EXT4-fs warning (device nbd0): htree_dirblock_to_tree:979: inode #2: lblock 0: comm ls: error -5 reading directory block print_req_error: I/O error, dev nbd0, sector 2264 flags 3000 EXT4-fs error (device nbd0): __ext4_get_inode_loc:4690: inode #2: block 283: comm ls: unable to read itable block EXT4-fs error (device nbd0) in ext4_reserve_inode_write:5894: IO failure ------------[ cut here ]------------ kernel BUG at fs/buffer.c:3057! invalid opcode: 0000 [#1] SMP PTI CPU: 7 PID: 40045 Comm: jbd2/nbd0-8 Not tainted 5.1.0-rc3+ #4 Hardware name: Amazon EC2 m5.12xlarge/, BIOS 1.0 10/16/2017 RIP: 0010:submit_bh_wbc+0x18b/0x190 ... Call Trace: jbd2_write_superblock+0xf1/0x230 [jbd2] ? account_entity_enqueue+0xc5/0xf0 jbd2_journal_update_sb_log_tail+0x94/0xe0 [jbd2] jbd2_journal_commit_transaction+0x12f/0x1d20 [jbd2] ? __switch_to_asm+0x40/0x70 ... ? lock_timer_base+0x67/0x80 kjournald2+0x121/0x360 [jbd2] ? remove_wait_queue+0x60/0x60 kthread+0xf8/0x130 ? commit_timeout+0x10/0x10 [jbd2] ? kthread_bind+0x10/0x10 ret_from_fork+0x35/0x40 With __invalidate_device(), I no longer hit the BUG_ON with sync or unmount on the disconnected device. Fixes: 29eaadc03649 ("nbd: stop using the bdev everywhere") Cc: linux-block@vger.kernel.org Cc: Ratna Manoj Bolla Cc: nbd@other.debian.org Cc: stable@vger.kernel.org Cc: David Woodhouse Reviewed-by: Josef Bacik Signed-off-by: Munehisa Kamata Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1207,7 +1207,7 @@ static void nbd_clear_sock_ioctl(struct struct block_device *bdev) { sock_shutdown(nbd); - kill_bdev(bdev); + __invalidate_device(bdev, true); nbd_bdev_reset(bdev); if (test_and_clear_bit(NBD_HAS_CONFIG_REF, &nbd->config->runtime_flags))