Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2656424ybv; Fri, 21 Feb 2020 20:42:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxKzo4DuF2aS7Hdku9vSbaYkYyS+b6AWE73ib+HU0giKT1iANRI+v+Awuer0GxN8lV/ZrBH X-Received: by 2002:aca:f242:: with SMTP id q63mr4951697oih.72.1582346569445; Fri, 21 Feb 2020 20:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582346569; cv=none; d=google.com; s=arc-20160816; b=epksJ9EIlHWGHFUmFCC2opqtM+dsIESrNw2Yk8VU9dm2JTahnT6iZtlptMDnvJAjvV AGBIl3vwVwgaPEiXZ+1bxJ0KBs5Tk4WHZO99OHheunS+fgCKSkewYVnx5HMNDMK09Mgr db9W1uMMbr0ReHX2fvSFWshuh93fFGJXcFHpt6TPcUVePlqu81EkTCBpwbLUrAVxLf75 DuIzi2R1Vc+fIAipCbHzAGUSOMPxCP1qQxMtgodXXcUdyiW7jkCcEAdRXNDc7Vc/+SV0 VNWwzdxHr/EKf68DHZcvxNf+5bmXif2zizqG1eInz4q/ufYOi/yCZVAaahS6DF+Id9XW lAlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=znToJ/lIEAhJLQpWxDm+HGZrOss5HeGjuQbqCLVcbZ4=; b=v5IXHPlYFofawH7m8AD4zsw1VUwqYd/YUkYvoINVDTDQkyde2g/8qCd1bXGZ9RCQ7v vileyy/x5fjEyhQjFGdZ57Z9uvk59RAAvO1GMdWXTOu27kUg3nzq4wEUW2zif5t4/exm juoa9y3ESLVBr9hybS15Yy6BVv7dW0J90UcLjVrs9m2uko8195+kit/DTq7s3YeeBFqA 70uPS+Fh3vVWEpdVisNhNqq2F9haZfj1iNqF2Vb19D7AVkbQiqB1Q4Y5Evvfev5D5ImD HP1hVWUnERLaLgbzUUezUNRkRzy9+Rsgep19hwi4hgPIIFtJMWrgeRP4Rzih430DOubE SMlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=r0kgt1qz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si2706243otq.51.2020.02.21.20.42.33; Fri, 21 Feb 2020 20:42:49 -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=@megous.com header.s=mail header.b=r0kgt1qz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727959AbgBVEly (ORCPT + 99 others); Fri, 21 Feb 2020 23:41:54 -0500 Received: from vps.xff.cz ([195.181.215.36]:53204 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgBVEly (ORCPT ); Fri, 21 Feb 2020 23:41:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1582346512; bh=lu42HKPfs8W3F34qV2Vvg++VjwzFzV7KC4WH6c2u/0Y=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=r0kgt1qzNAwLorPK+IlooEqy5oL0J1E/DJZVoFiAzdDyuET7pqJKA7Dm/5F8su1AT BgL+65fJ0CjaxPS5CTJsndzkpc5QM1yc5V4NUO57izHozKf3De3qEInt3p+trOkO7P fYX496T3AdqhasAVKhr5Uf/P6KGdf9gOJ/FUVNk8= Date: Sat, 22 Feb 2020 05:41:51 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: Re: [PATCH 5.5 020/399] f2fs: call f2fs_balance_fs outside of locked page Message-ID: <20200222044151.odurt3xqyhgxqqve@core.my.home> Mail-Followup-To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin References: <20200221072402.315346745@linuxfoundation.org> <20200221072404.289499313@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200221072404.289499313@linuxfoundation.org> X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, Feb 21, 2020 at 08:35:45AM +0100, Greg Kroah-Hartman wrote: > From: Jaegeuk Kim > > [ Upstream commit bdf03299248916640a835a05d32841bb3d31912d ] I have somes issues with this patch. It causes panics due to hung tasks on 5.6. I guess it fixes one deadlock, but causes other one? Not sure backporting it to stable branches is a good idea. regards, o. INFO: task kworker/u16:2:341 blocked for more than 122 seconds. Not tainted 5.6.0-rc2-00254-g9a029a493dc16 #4 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. kworker/u16:2 D 0 341 2 0x00000000 Workqueue: writeback wb_workfn (flush-179:0) Backtrace: [] (__schedule) from [] (schedule+0x78/0xf4) r10:ede1a000 r9:00000000 r8:ede1ba60 r7:ec417290 r6:00000002 r5:ede1a000 r4:ee8e8000 [] (schedule) from [] (rwsem_down_write_slowpath+0x24c/0x4c0) r5:00000001 r4:ec417280 [] (rwsem_down_write_slowpath) from [] (down_write+0x6c/0x70) r10:ec417280 r9:ede1bd80 r8:ee128000 r7:00000001 r6:00000000 r5:eff0afc4 r4:ec417280 [] (down_write) from [] (f2fs_write_single_data_page+0x608/0x7ac) r5:eff0afc4 r4:ec4170e0 [] (f2fs_write_single_data_page) from [] (f2fs_write_cache_pages+0x2b4/0x7c4) r10:ede1bc28 r9:ec4171e0 r8:ec4170e0 r7:00000001 r6:ede1bd80 r5:00000001 r4:eff0afc4 [] (f2fs_write_cache_pages) from [] (f2fs_write_data_pages+0x344/0x35c) r10:0000012c r9:ee12802c r8:ee128000 r7:00000004 r6:ec4171e0 r5:ec4170e0 r4:ede1bd80 [] (f2fs_write_data_pages) from [] (do_writepages+0x3c/0xd4) r10:0000012c r9:c0e03d00 r8:00001400 r7:c0264e94 r6:ede1bd80 r5:ec4171e0 r4:ec4170e0 [] (do_writepages) from [] (__writeback_single_inode+0x44/0x454) r7:ec4171e0 r6:ede1beac r5:ede1bd80 r4:ec4170e0 [] (__writeback_single_inode) from [] (writeback_sb_inodes+0x204/0x4b0) r10:0000012c r9:c0e03d00 r8:ec417148 r7:ec4170e0 r6:ede1beac r5:ec417188 r4:eebed848 [] (writeback_sb_inodes) from [] (__writeback_inodes_wb+0x50/0xe4) r10:ee7128e8 r9:c0e03d00 r8:eebed85c r7:ede1beac r6:00000000 r5:eebed848 r4:ee120000 [] (__writeback_inodes_wb) from [] (wb_writeback+0x294/0x338) r10:00020800 r9:ede1a000 r8:c0e04e64 r7:eebed848 r6:000192d0 r5:ede1beac r4:eebed848 [] (wb_writeback) from [] (wb_workfn+0x3e0/0x54c) r10:ee894005 r9:eebed84c r8:eebed948 r7:eebed848 r6:00000000 r5:eebed954 r4:00002b6e [] (wb_workfn) from [] (process_one_work+0x214/0x544) r10:ee894005 r9:00000200 r8:00000000 r7:ee894000 r6:ef044400 r5:edb1c700 r4:eebed954 [] (process_one_work) from [] (worker_thread+0x4c/0x574) r10:ef044400 r9:c0e03d00 r8:ef044418 r7:00000088 r6:ef044400 r5:edb1c714 r4:edb1c700 [] (worker_thread) from [] (kthread+0x144/0x170) r10:ef125e90 r9:ec0f235c r8:edb1c700 r7:ede1a000 r6:00000000 r5:ec0f2300 r4:ec0f2340 [] (kthread) from [] (ret_from_fork+0x14/0x2c) Exception stack(0xede1bfb0 to 0xede1bff8) bfa0: 00000000 00000000 00000000 00000000 bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c01563b8 r4:ec0f2300 NMI backtrace for cpu 2 CPU: 2 PID: 52 Comm: khungtaskd Not tainted 5.6.0-rc2-00254-g9a029a493dc16 #4 Hardware name: Allwinner A83t board Backtrace: [] (dump_backtrace) from [] (show_stack+0x20/0x24) r7:00000000 r6:60060013 r5:00000000 r4:c0e9ab10 > Otherwise, we can hit deadlock by waiting for the locked page in > move_data_block in GC. > > Thread A Thread B > - do_page_mkwrite > - f2fs_vm_page_mkwrite > - lock_page > - f2fs_balance_fs > - mutex_lock(gc_mutex) > - f2fs_gc > - do_garbage_collect > - ra_data_block > - grab_cache_page > - f2fs_balance_fs > - mutex_lock(gc_mutex) > > Fixes: 39a8695824510 ("f2fs: refactor ->page_mkwrite() flow") > Reviewed-by: Chao Yu > Signed-off-by: Jaegeuk Kim > Signed-off-by: Sasha Levin > --- > fs/f2fs/file.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 33c412d178f0f..6c4436a5ce797 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -50,7 +50,7 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) > struct page *page = vmf->page; > struct inode *inode = file_inode(vmf->vma->vm_file); > struct f2fs_sb_info *sbi = F2FS_I_SB(inode); > - struct dnode_of_data dn = { .node_changed = false }; > + struct dnode_of_data dn; > int err; > > if (unlikely(f2fs_cp_error(sbi))) { > @@ -63,6 +63,9 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) > goto err; > } > > + /* should do out of any locked page */ > + f2fs_balance_fs(sbi, true); > + > sb_start_pagefault(inode->i_sb); > > f2fs_bug_on(sbi, f2fs_has_inline_data(inode)); > @@ -120,8 +123,6 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) > out_sem: > up_read(&F2FS_I(inode)->i_mmap_sem); > > - f2fs_balance_fs(sbi, dn.node_changed); > - > sb_end_pagefault(inode->i_sb); > err: > return block_page_mkwrite_return(err); > -- > 2.20.1 > > >