Received: by 10.213.65.68 with SMTP id h4csp390225imn; Fri, 16 Mar 2018 06:25:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELuCZCPTGqY5HPzWpPXLARvQ1NTWNcXTSWgWvYyzncf55rtuaREjxPjN+zNWNu4GuHuyXoip X-Received: by 10.98.41.134 with SMTP id p128mr1614887pfp.120.1521206725932; Fri, 16 Mar 2018 06:25:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521206725; cv=none; d=google.com; s=arc-20160816; b=SnibD9QOZB6otIO7JZzfByluB6SaF0DyIhEUq/4bC1hO1dZBPTZapk0ilC4mBPT78G 7IXboT2po62hhCLx2QBPwtSz17YHqiLC9prEJ6IXXgRWxMLNEnSyFwzKYAusByCFwbJN nBHf2bmht5RX0nQ4QrtFYSHOu8QxI+iNmVI4X6AIVI93w7aB3QYth+UnNyJW4anmuERa YU8cAG0urqayWZXFmQGa3K9b/to+/3hi7iSr6uekYKqLj4z/P3934sJJkC8ZZrqL5H9T NlXYjGpCC7q5eZP/aHuHs7VvxuHICBLW/Y+klFqi4vyOJAWlJVwWX3+pofSv6QfY6GE9 /Rbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=g/b/L3XHdx3yQ1kULp4cwzGayI78pFeYItKNFU93yzc=; b=aazBBhSzokYyPXOhyTW/AY0sPTHyvGzzWkGkXusOXpiZiMHl/DRt/uCNxOjmQQZCYc i9+Cx/C4sIqxO3qvYzfItGlT22hz/ECgesc9XPshkB18Mv0Qq31mOSOU5PetD4Tu6AYp s5vLcrqh/w8TKUPin+lCjvPCBHmfCfqIYq7Souxg1C2RgwUFAz2b01GpZ0nv/Z/dbKsX XH1haBc9ngpBYxyvtUo2U1gBXSE9NiXoaT6FgXGygoCQTV/yHif+GgVxKH2C5+x7pQpq D2ZiAg4Px2JU5k8ovCQQc5RqZ1QiN2F8bAanRtuAW5GRbDt2SZbYZPRM5P8lM6zjnklS m69g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=VXinr8Tt; dkim=pass header.i=@codeaurora.org header.s=default header.b=XCuFkkxp; 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 g2si4980930pgq.496.2018.03.16.06.25.11; Fri, 16 Mar 2018 06:25:25 -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=@codeaurora.org header.s=default header.b=VXinr8Tt; dkim=pass header.i=@codeaurora.org header.s=default header.b=XCuFkkxp; 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 S1752875AbeCPNYN (ORCPT + 99 others); Fri, 16 Mar 2018 09:24:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60904 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751236AbeCPNYJ (ORCPT ); Fri, 16 Mar 2018 09:24:09 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0954D60591; Fri, 16 Mar 2018 13:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521206649; bh=dCSws3JYlahhiDN6TPHyb3A85HAsSeXq0b9F03ugrrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXinr8TtaunFwYTAOMvoa7klLhRxwwerEL8+3caHdNhJjoBvlLGJok8439yUdypjq YQd6bkEgjcTt0wEAz8qAMuRGa6PUw7L2T4QwSGNC/jz9Y8tT191oVo5yoAS2OIVf4H 0F7caHfVPjWJWSjS1ecsi0CXurLooZVJTAbtXRPY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from hyd-lnxbld448.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: riteshh@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 72D4B60C5F; Fri, 16 Mar 2018 13:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521206648; bh=dCSws3JYlahhiDN6TPHyb3A85HAsSeXq0b9F03ugrrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XCuFkkxp0ESAnk8ZNwgw4RA2csI9Fwz4SFXaFWe/hgx+sA5Q3gJ+rfIO214Z49Vm/ 6sUGWjZ2EYfAPVLOzJUxx8812IHT6iX/tJc7zjNxLphWQlNBLSmnYoSs7Sad9tXC2A iCENiczcW/4NYLxDLvd0D53hIo87h2hIUqxrpl80= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 72D4B60C5F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=riteshh@codeaurora.org From: Ritesh Harjani To: jaegeuk@kernel.org, yuchao0@huawei.com, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: stummala@codeaurora.org, Ritesh Harjani Subject: [PATCH] f2fs: Set GF_NOFS in read_cache_page_gfp while doing f2fs_quota_read Date: Fri, 16 Mar 2018 18:53:53 +0530 Message-Id: <1521206633-21378-2-git-send-email-riteshh@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521206633-21378-1-git-send-email-riteshh@codeaurora.org> References: <1521206633-21378-1-git-send-email-riteshh@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quota code itself is serializing the operations by taking mutex_lock. It seems a below deadlock can happen if GF_NOFS is not used in f2fs_quota_read __switch_to+0x88 __schedule+0x5b0 schedule+0x78 schedule_preempt_disabled+0x20 __mutex_lock_slowpath+0xdc //mutex owner is itself mutex_lock+0x2c dquot_commit+0x30 //mutex_lock(&dqopt->dqio_mutex); dqput+0xe0 __dquot_drop+0x80 dquot_drop+0x48 f2fs_evict_inode+0x218 evict+0xa8 dispose_list+0x3c prune_icache_sb+0x58 super_cache_scan+0xf4 do_shrink_slab+0x208 shrink_slab.part.40+0xac shrink_zone+0x1b0 do_try_to_free_pages+0x25c try_to_free_pages+0x164 __alloc_pages_nodemask+0x534 do_read_cache_page+0x6c read_cache_page+0x14 f2fs_quota_read+0xa4 read_blk+0x54 find_tree_dqentry+0xe4 find_tree_dqentry+0xb8 find_tree_dqentry+0xb8 find_tree_dqentry+0xb8 qtree_read_dquot+0x68 v2_read_dquot+0x24 dquot_acquire+0x5c // mutex_lock(&dqopt->dqio_mutex); dqget+0x238 __dquot_initialize+0xd4 dquot_initialize+0x10 dquot_file_open+0x34 f2fs_file_open+0x6c do_dentry_open+0x1e4 vfs_open+0x6c path_openat+0xa20 do_filp_open+0x4c do_sys_open+0x178 Signed-off-by: Ritesh Harjani --- fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 708155d..3a9a924 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1382,7 +1382,7 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data, while (toread > 0) { tocopy = min_t(unsigned long, sb->s_blocksize - offset, toread); repeat: - page = read_mapping_page(mapping, blkidx, NULL); + page = read_cache_page_gfp(mapping, blkidx, GFP_NOFS); if (IS_ERR(page)) { if (PTR_ERR(page) == -ENOMEM) { congestion_wait(BLK_RW_ASYNC, HZ/50); -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.