Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp37129pja; Fri, 22 Nov 2019 03:08:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyp5EuWr7kivgKTMd/5RqiCMoOCcZduaGD9DMzYnqDRsxThqumbT1IYzkLZ7rTlFZA+kmkC X-Received: by 2002:a17:906:344c:: with SMTP id d12mr20663575ejb.227.1574420911230; Fri, 22 Nov 2019 03:08:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574420911; cv=none; d=google.com; s=arc-20160816; b=pZxMxhTdcRuhzP1inK2LSxxu7uT7GFNGzMcBX7ldkZYBXTN7LGibxluDj0r5rQzOXI Frf2v3/ok2/GRQ5bsGoNlzo9Ye7j08Xp5geRd4HI2VLGz8GhOiYkY2X1I+JS0JzJGZbf i5e/MGkjc1848n2n5qxx1yEyCGpj0UPgkQZi56s5GgwAFxE39rQ/cgaOP3yk3VfPj2FM e6Mbv6yD/O99/wsF1mEA/lCdb8vgKvbCYzMoEnlvCnfzRCB8Pf23QLBw+aMCPZoq4EYU L9T0Awc9ku62tADZp+Ka8qoI1pKuqzHcqtw4DpDPRgoZMdynE01pJtcd3FEqlKEEnje7 O0zQ== 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=w8uM3L1ytsxDYq0vp/V83gT8TeeGP/fRVXvbPn8CEjY=; b=tH6oxYqGQxDTDdjrU1byX+cchvE/tw7U0eFWo48oZFsOO0taHXsJPbbnurGoGxDZn3 wNr2oVBQo+ItMxo8W5yG4NDE1qH98hnqnKu+XYL++3JSsUZKXDVT9xS+HWe+eYuf5FSF vkxBqovgelxUghFwDZUPZe5/CkzR858qftNrz/UoeDlLtM9SuxjhTiEFAl//+5tRBQc8 75EXyS+Kp1o66fombes1d7KbJPw5uuklqSMvCQ+OqZozGrnMdlg18PLu6MBmUWqMDz5C nb61Ejz+ifLV4HFdabsRFcnNd2sUoMpWuT8e046xvhD/6Fb23cNTmk8LIsCtShZarjh5 T4Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jM8p5G2l; 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 ot13si3893508ejb.199.2019.11.22.03.08.06; Fri, 22 Nov 2019 03:08:31 -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=jM8p5G2l; 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 S1731814AbfKVLGK (ORCPT + 99 others); Fri, 22 Nov 2019 06:06:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:34158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730087AbfKVLGI (ORCPT ); Fri, 22 Nov 2019 06:06:08 -0500 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 633E520870; Fri, 22 Nov 2019 11:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420767; bh=H98E+O2rGiNbR2/s9wKrb2qi+Flmw69WX72yGfxD1Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jM8p5G2lwWvTmgU8ZOkwaFZc6KkNdRIP9lzW6/QaP/IcwiYKGeDF0RUbOvcBADVtQ zTRVMhRqNICcT8lwjYXauaI+KTQF8R9RTFbwzDOg4kdAov83fgjOVnhKMtG6cOZC0G WeSAyfWOWMnWtb/wwkwIbhw3P3B+nlPUh0u0+HVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Smith , Mark Syms , Bob Peterson , Sasha Levin Subject: [PATCH 4.19 175/220] GFS2: Flush the GFS2 delete workqueue before stopping the kernel threads Date: Fri, 22 Nov 2019 11:29:00 +0100 Message-Id: <20191122100925.439875114@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@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: Tim Smith [ Upstream commit 1eb8d7387908022951792a46fa040ad3942b3b08 ] Flushing the workqueue can cause operations to happen which might call gfs2_log_reserve(), or get stuck waiting for locks taken by such operations. gfs2_log_reserve() can io_schedule(). If this happens, it will never wake because the only thing which can wake it is gfs2_logd() which was already stopped. This causes umount of a gfs2 filesystem to wedge permanently if, for example, the umount immediately follows a large delete operation. When this occured, the following stack trace was obtained from the umount command [] flush_workqueue+0x1c8/0x520 [] gfs2_make_fs_ro+0x69/0x160 [gfs2] [] gfs2_put_super+0xa9/0x1c0 [gfs2] [] generic_shutdown_super+0x6f/0x100 [] kill_block_super+0x27/0x70 [] gfs2_kill_sb+0x71/0x80 [gfs2] [] deactivate_locked_super+0x3b/0x70 [] deactivate_super+0x59/0x60 [] cleanup_mnt+0x58/0x80 [] __cleanup_mnt+0x12/0x20 [] task_work_run+0x7d/0xa0 [] exit_to_usermode_loop+0x73/0x98 [] syscall_return_slowpath+0x41/0x50 [] int_ret_from_sys_call+0x25/0x8f [] 0xffffffffffffffff Signed-off-by: Tim Smith Signed-off-by: Mark Syms Signed-off-by: Bob Peterson Signed-off-by: Sasha Levin --- fs/gfs2/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index c212893534ed6..a971862b186e3 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -854,10 +854,10 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) return error; + flush_workqueue(gfs2_delete_workqueue); kthread_stop(sdp->sd_quotad_process); kthread_stop(sdp->sd_logd_process); - flush_workqueue(gfs2_delete_workqueue); gfs2_quota_sync(sdp->sd_vfs, 0); gfs2_statfs_sync(sdp->sd_vfs, 0); -- 2.20.1