Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4640333ybl; Mon, 9 Dec 2019 14:25:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwiXadt9Z4J+/UZj79msaj1GrJcU1DQdLyhMkmoi6C7baySv4/xokFWWQ53J2sKEzkv3Tek X-Received: by 2002:aca:a896:: with SMTP id r144mr1291828oie.142.1575930349483; Mon, 09 Dec 2019 14:25:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575930349; cv=none; d=google.com; s=arc-20160816; b=sM4ChvTYcX6jicz4A84HPTyZw79b2wc3XTBoq1NLzrmD1RZBYUPEMQOGXdnYCby7Yt 8qvnkHCrbLiX8EYZ57TUkUXpPTgcIZ9ZeCiDQMrsq45Us/74SwWrzcRzPGOvLnILSfRv h60+m+RNlXkhCLMGMEoCmgej6DaCU/z9pqGyy6P5W+v+vgL3B8Xyam7fzjxlE1CAs6VU a5F1W7E271iUTxf3V4qWC1e8kwaHKm3aVKgovkGt9vB8ZYDU8vMCn3eekpcbuuu6WoRa KZBabvDxeOQCa1R+XdMLHJtE8ok/KTrGobsaJ7A8UQIvJ1H9oA/RVEdV3wvwrXyX0P33 J8PQ== 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=KYnahTGQQvx23zazvjYuGgA0YACGNMtX/Xy0pXzVMh8=; b=b8EBCU1eXTPxWpXbmyIvppO8bEgPe0+b9W+HhsM/orzKjPGSqxAV1UHXuW2UxPdFZr F2BYYXhUEzEQoppmaBo7adChL45V3fTAsTKLZ11A1iRs+vG12nyrcONLuWNM2QeZWNAD cYmgA1D6yQmSUBXjIJf+ObD9O1+I0o4d3ZZ0Gf76+l/bUTIqgzZgpwACFjfCt0udmK2h HFnCnlFaxqBd8ExxD6vNXt7+VwzJDUEv/6nP4OcgBbkR3pJvEIGsrHUMiDHhEAAyZdxi 8Uby961MLh7WDvEr8Q9mOu7rwTjA6GxppzkOaRE18wejoKao8PpE6WJ7AdCCuYTB6wmu grEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QoM6NzNi; 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 f65si813612oib.0.2019.12.09.14.25.37; Mon, 09 Dec 2019 14:25: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=@kernel.org header.s=default header.b=QoM6NzNi; 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 S1726973AbfLIWXu (ORCPT + 99 others); Mon, 9 Dec 2019 17:23:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:40534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726665AbfLIWXr (ORCPT ); Mon, 9 Dec 2019 17:23:47 -0500 Received: from localhost (unknown [104.132.0.81]) (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 7B9762071E; Mon, 9 Dec 2019 22:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575930227; bh=A+gppiBF+YkBTBbG9jAbQcsegmphuu6BqQl55N2MGpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QoM6NzNiGJqicb+Ws8gUtxZCWYelOHpEef3cGJYk6HEfrAGJOGUz/RZ4SFzVt5GsQ 2Y9TUW4k9V5XXjX9g2774ksy4/mngjfVobySy5Tr2vaC99Y6KI5FQ0VahT0cmV60St wqF73/kj7rWlziKSdt+p6MhcVScbmlwg2IEW+2qw= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 2/6] f2fs: declare nested quota_sem and remove unnecessary sems Date: Mon, 9 Dec 2019 14:23:41 -0800 Message-Id: <20191209222345.1078-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20191209222345.1078-1-jaegeuk@kernel.org> References: <20191209222345.1078-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 1. f2fs_quota_sync -> down_read(&sbi->quota_sem) -> dquot_writeback_dquots -> f2fs_dquot_commit -> down_read(&sbi->quota_sem) 2. f2fs_quota_sync -> down_read(&sbi->quota_sem) -> f2fs_write_data_pages -> f2fs_write_single_data_page -> down_write(&F2FS_I(inode)->i_sem) f2fs_mkdir -> f2fs_do_add_link -> down_write(&F2FS_I(inode)->i_sem) -> f2fs_init_inode_metadata -> f2fs_new_node_page -> dquot_alloc_inode -> f2fs_dquot_mark_dquot_dirty -> down_read(&sbi->quota_sem) Signed-off-by: Jaegeuk Kim --- fs/f2fs/super.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 5111e1ffe58a..15888ca02e7f 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2156,39 +2156,30 @@ static void f2fs_truncate_quota_inode_pages(struct super_block *sb) static int f2fs_dquot_commit(struct dquot *dquot) { struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); - int ret; + int ret = dquot_commit(dquot); - down_read(&sbi->quota_sem); - ret = dquot_commit(dquot); if (ret < 0) set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); - up_read(&sbi->quota_sem); return ret; } static int f2fs_dquot_acquire(struct dquot *dquot) { struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); - int ret; + int ret = dquot_acquire(dquot); - down_read(&sbi->quota_sem); - ret = dquot_acquire(dquot); if (ret < 0) set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); - up_read(&sbi->quota_sem); return ret; } static int f2fs_dquot_release(struct dquot *dquot) { struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); - int ret; + int ret = dquot_release(dquot); - down_read(&sbi->quota_sem); - ret = dquot_release(dquot); if (ret < 0) set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); - up_read(&sbi->quota_sem); return ret; } @@ -2198,7 +2189,7 @@ static int f2fs_dquot_mark_dquot_dirty(struct dquot *dquot) struct f2fs_sb_info *sbi = F2FS_SB(sb); int ret; - down_read(&sbi->quota_sem); + down_read_nested(&sbi->quota_sem, SINGLE_DEPTH_NESTING); ret = dquot_mark_dquot_dirty(dquot); /* if we are using journalled quota */ @@ -2212,13 +2203,10 @@ static int f2fs_dquot_mark_dquot_dirty(struct dquot *dquot) static int f2fs_dquot_commit_info(struct super_block *sb, int type) { struct f2fs_sb_info *sbi = F2FS_SB(sb); - int ret; + int ret = dquot_commit_info(sb, type); - down_read(&sbi->quota_sem); - ret = dquot_commit_info(sb, type); if (ret < 0) set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); - up_read(&sbi->quota_sem); return ret; } -- 2.19.0.605.g01d371f741-goog