Return-Path: Received: from mx2.suse.de ([195.135.220.15]:32768 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752462AbdHULzU (ORCPT ); Mon, 21 Aug 2017 07:55:20 -0400 From: Jan Kara To: Cc: Wang Shilong , Andreas Dilger , Jan Kara Subject: [PATCH 03/27] quota: Acquire dqio_sem for reading in dquot_get_next_id() Date: Mon, 21 Aug 2017 13:54:53 +0200 Message-Id: <20170821115517.26542-4-jack@suse.cz> In-Reply-To: <20170821115517.26542-1-jack@suse.cz> References: <20170821115517.26542-1-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: dquot_get_next_id() needs dqio_sem only for reading to protect against racing with modification of quota file structure. Reviewed-by: Andreas Dilger Signed-off-by: Jan Kara --- fs/quota/dquot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 21358f31923d..8d5ccad3bf3e 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -2079,9 +2079,9 @@ int dquot_get_next_id(struct super_block *sb, struct kqid *qid) return -ESRCH; if (!dqopt->ops[qid->type]->get_next_id) return -ENOSYS; - down_write(&dqopt->dqio_sem); + down_read(&dqopt->dqio_sem); err = dqopt->ops[qid->type]->get_next_id(sb, qid); - up_write(&dqopt->dqio_sem); + up_read(&dqopt->dqio_sem); return err; } EXPORT_SYMBOL(dquot_get_next_id); -- 2.12.3