Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5615942img; Wed, 27 Mar 2019 11:46:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyooKCWxRQzAVnsTJPhH2/Tl3PWE99uBNZA20ccSAoUCiZL04Oks0ruehZWinF9pYz0LPa3 X-Received: by 2002:a17:902:f83:: with SMTP id 3mr40110894plz.125.1553712404529; Wed, 27 Mar 2019 11:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553712404; cv=none; d=google.com; s=arc-20160816; b=I7Iyn8GFGeeIBGZ7zTvJF6H99NYHWKNObWGJbjD+UW5gSUOj0gZzrh894DNhFuWMuC Yo8uOKPJUE9vkV7lL+9yFxqiWGkZmqFNGLeamf9c0BYjPJSagLxBU0gYS5wfwktrhvCU 6f29xHEDmwMFaJRsXSHHJ2Q82cNG8pRn5uFl/bCYKPLWY9pMMSi5GeXo3ilLARdzUjeI W6+Itajek/FP6Xus9GA96cXWwBd+n+vZyL6duKRgGa7aETn9wF6m/+UE4CVE+hhIvyLw 9+CWqhvHt0jKC3QdkFx0yFT6mP85H8sDc5bWitRUWXYyULZQSAKJGiY1Dat6stZKtyed Ra8g== 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=S4xJyFkaeESzN5T/UwqYUv9Taf8GavBohMS64NEq9Ak=; b=zp5q/jl98zaMrLhnTcIfkhu3QUHg8BQUsYnKo+l0+XeMnzc99uXp+WenBDL5PHWAOJ V9O1laIqnLKkAB61qZOt16ADVYJo0C14bFVs9xMDvTOuCioRXBz+0mVc1RJ0pQoIBR9N O8xVPNTAWlkzQaqoGnAJyAoGPxzU+5vukpM6mhVJjuiyll0hDVCcjdGjm+uxy+pj6udI gi4f92XN9NtkdsTOnauEnsHfpoVzwCcFN0DQIPFRcRR5sTsf180NnUIV0SF4N09XyF+Z jkrYPUAb1Fu7a89YeDLSrM23fPVzLuk06s2pE4RYuuiDRZLo3K7BK7vwkPE4jPfpgNVc Ge6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0O6nIBtt; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si19610751pfb.56.2019.03.27.11.46.27; Wed, 27 Mar 2019 11:46:44 -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=0O6nIBtt; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391273AbfC0SpF (ORCPT + 99 others); Wed, 27 Mar 2019 14:45:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:38988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391057AbfC0SVK (ORCPT ); Wed, 27 Mar 2019 14:21:10 -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 1F8B520651; Wed, 27 Mar 2019 18:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710869; bh=2QAsr3WAmydxI/msKJTBBTMS9RdXid/6wfLINpYNJ5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0O6nIBttf/giZbUx7iUwxn4KRu5UZONGGvyEPuSWarU5WYl8AuD0tBoLnky54cHIn lgpE/9eH3ZiTudw73iR6vHJqggVfQmwluccgtMDlt3nq6SxFeBJm4OjnzR0BX3adwe opef4LSnRv3DRzY9+uLH9M57Bz0KC8RyoItO53Ac= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sahitya Tummala , Jaegeuk Kim , Sasha Levin , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH AUTOSEL 4.9 15/87] f2fs: do not use mutex lock in atomic context Date: Wed, 27 Mar 2019 14:19:28 -0400 Message-Id: <20190327182040.17444-15-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182040.17444-1-sashal@kernel.org> References: <20190327182040.17444-1-sashal@kernel.org> MIME-Version: 1.0 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: Sahitya Tummala [ Upstream commit 9083977dabf3833298ddcd40dee28687f1e6b483 ] Fix below warning coming because of using mutex lock in atomic context. BUG: sleeping function called from invalid context at kernel/locking/mutex.c:98 in_atomic(): 1, irqs_disabled(): 0, pid: 585, name: sh Preemption disabled at: __radix_tree_preload+0x28/0x130 Call trace: dump_backtrace+0x0/0x2b4 show_stack+0x20/0x28 dump_stack+0xa8/0xe0 ___might_sleep+0x144/0x194 __might_sleep+0x58/0x8c mutex_lock+0x2c/0x48 f2fs_trace_pid+0x88/0x14c f2fs_set_node_page_dirty+0xd0/0x184 Do not use f2fs_radix_tree_insert() to avoid doing cond_resched() with spin_lock() acquired. Signed-off-by: Sahitya Tummala Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/trace.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c index 73b4e1d1912a..501c283761d2 100644 --- a/fs/f2fs/trace.c +++ b/fs/f2fs/trace.c @@ -61,6 +61,7 @@ void f2fs_trace_pid(struct page *page) page->private = pid; +retry: if (radix_tree_preload(GFP_NOFS)) return; @@ -71,7 +72,12 @@ void f2fs_trace_pid(struct page *page) if (p) radix_tree_delete(&pids, pid); - f2fs_radix_tree_insert(&pids, pid, current); + if (radix_tree_insert(&pids, pid, current)) { + spin_unlock(&pids_lock); + radix_tree_preload_end(); + cond_resched(); + goto retry; + } trace_printk("%3x:%3x %4x %-16s\n", MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev), -- 2.19.1