Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2513707imm; Mon, 24 Sep 2018 05:44:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV60QARthVmU64DmuwmAcOlXPhji/v6nXqybRo/FqHta+G8q5aHWJq8Iv2RpNE69WaTVz1GwH X-Received: by 2002:a17:902:1001:: with SMTP id b1-v6mr10629237pla.155.1537793095687; Mon, 24 Sep 2018 05:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793095; cv=none; d=google.com; s=arc-20160816; b=AFYLI12JcXMhvIFjcdly0BCMn0+LzJSUKChAvG+bKdmuvcGHmp9l6d3glZQWkv0wis kr/rdT1hnmqnvTJLrLPe5LdddYtYRIWxP10wQmAotXHoUBPxnW+lPggN/2/pcsmYlfU7 SRgwf84rPUa/h2buy2PY8miKZVehpe2pFTXGL4R5O+cyyrVMvmof4C0o0ry/8wJC4/Hb wECsyLNOa2xeI9c40vlj6RLyog9zR9Kx6w7RqjqarCfGMCwbCbOOccX4REyzzA+5knWy IKyMXqXvxOlshMtzrlVOqetFS4svTU2wbRthaNU4D7PGLahymNpAmbtOV7zRYAJ8mPXd cLiQ== 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; bh=ZtUGBevPj3iOAAQMtelyFq7uulDa/xPasSHh00Zfj/k=; b=LkPhYXAnHZgCbWJSWHbMU2QqtW94mPviTevRgHhkDa1VaBymWdF7NEXDCRM25QlQhH /VCquEOQKF35oUDBOPr4XUjue4fu6Qhy7BfSJAqdVYqJre9JQ0w+Nll7EjBt54xKOGrr 2nH3JbrKPjf029BIA9HZ76NeZFEY3fzfFMFYPr5cGNoUlfl/13as6GYLZOaO1rcg/Aky PvwLyEYtOV4g0eBmKbX/HCXw2SAcEL6nFq4r6q6nANQJ/hXcgef9b2uFh5rKeX0dJ5Ep s/Qwa5e0oMCZS5NHKXhiVbzZIe1hqVE8w6JAGiP36lYCNjGDszPYzvrOXWqHQapHUQQU nGGw== ARC-Authentication-Results: i=1; mx.google.com; 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 1-v6si34987169plr.326.2018.09.24.05.44.40; Mon, 24 Sep 2018 05:44:55 -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; 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 S2388966AbeIXSog (ORCPT + 99 others); Mon, 24 Sep 2018 14:44:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59360 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731786AbeIXSog (ORCPT ); Mon, 24 Sep 2018 14:44:36 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 99153E1C; Mon, 24 Sep 2018 12:42:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.18 193/235] f2fs: do checkpoint in kill_sb Date: Mon, 24 Sep 2018 13:52:59 +0200 Message-Id: <20180924113123.679785167@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jaegeuk Kim [ Upstream commit 1cb50f87e10696e8cc61fb62d0d948e11b0e6dc1 ] When unmounting f2fs in force mode, we can get it stuck by io_schedule() by some pending IOs in meta_inode. io_schedule+0xd/0x30 wait_on_page_bit_common+0xc6/0x130 __filemap_fdatawait_range+0xbd/0x100 filemap_fdatawait_keep_errors+0x15/0x40 sync_inodes_sb+0x1cf/0x240 sync_filesystem+0x52/0x90 generic_shutdown_super+0x1d/0x110 kill_f2fs_super+0x28/0x80 [f2fs] deactivate_locked_super+0x35/0x60 cleanup_mnt+0x36/0x70 task_work_run+0x79/0xa0 exit_to_usermode_loop+0x62/0x70 do_syscall_64+0xdb/0xf0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 0xffffffffffffffff Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -3106,9 +3106,19 @@ static struct dentry *f2fs_mount(struct static void kill_f2fs_super(struct super_block *sb) { if (sb->s_root) { - set_sbi_flag(F2FS_SB(sb), SBI_IS_CLOSE); - f2fs_stop_gc_thread(F2FS_SB(sb)); - f2fs_stop_discard_thread(F2FS_SB(sb)); + struct f2fs_sb_info *sbi = F2FS_SB(sb); + + set_sbi_flag(sbi, SBI_IS_CLOSE); + f2fs_stop_gc_thread(sbi); + f2fs_stop_discard_thread(sbi); + + if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) || + !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { + struct cp_control cpc = { + .reason = CP_UMOUNT, + }; + f2fs_write_checkpoint(sbi, &cpc); + } } kill_block_super(sb); }