From patchwork Wed May 28 01:52:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niu Yawei X-Patchwork-Id: 353202 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 21B7F1400DB for ; Wed, 28 May 2014 11:52:16 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752154AbaE1BwN (ORCPT ); Tue, 27 May 2014 21:52:13 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33426 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413AbaE1BwM (ORCPT ); Tue, 27 May 2014 21:52:12 -0400 Received: by mail-pa0-f49.google.com with SMTP id kp14so270883pab.22 for ; Tue, 27 May 2014 18:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=K6ygdwWVHAoPG4MofS1Q5k7KzOLREywGBeabfXVIATA=; b=Af1+RxPyL0SmNI5PDO7UnUHuT0l572e/yysD04s4CbbvJ3ac2gTCAXkcWv8OAvwwgR Nl9wjjr3bcnerBLz9WAqQchYgqmkuiB22R0xRvS/16KJrnYGDCvbbnMlHvVTmgbcJDfL 4cR4qZElZSf/bSId+ErWUhvoy2AOzoV1V2hYEdSqaX23+OymjexjY+ybTDTrTy1H3tHo 57EfFkvhjJ+eBeHB6iwsvihCbht4h1pNMnn4do0C+MUAAa55lt0jsK5FIH0AtFx9FkG9 6TT0V658F/QIa7zlSYfXlgGP30jbmukH2hFh5/p/WFqiOHl71//OjoLRtSWYIRioQcbK ZDeg== X-Received: by 10.67.21.205 with SMTP id hm13mr41795124pad.112.1401241932477; Tue, 27 May 2014 18:52:12 -0700 (PDT) Received: from [10.0.0.100] ([222.209.143.78]) by mx.google.com with ESMTPSA id or4sm25486176pbb.17.2014.05.27.18.52.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 May 2014 18:52:11 -0700 (PDT) Message-ID: <53854153.40601@gmail.com> Date: Wed, 28 May 2014 09:52:19 +0800 From: Niu Yawei User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Christoph Hellwig , jack@suse.cz CC: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, yawei.niu@intel.com, andreas.dilger@intel.com, lai.siyao@intel.com Subject: [PATCH 1/3 v2] quota: protect Q_GETFMT by dqonoff_mutex References: <537DD5BA.1050105@gmail.com> <538464AD.6050407@gmail.com> <20140527101219.GA28035@infradead.org> In-Reply-To: <20140527101219.GA28035@infradead.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Remove dqptr_sem to make quota code scalable: Protect the Q_GETFMT by dqonoff_mutex instead of dqptr_sem. Signed-off-by: Lai Siyao Signed-off-by: Niu Yawei --- fs/quota/quota.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/quota/quota.c b/fs/quota/quota.c index 2b363e2..e4851cb 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c @@ -79,13 +79,13 @@ static int quota_getfmt(struct super_block *sb, int type, void __user *addr) { __u32 fmt; - down_read(&sb_dqopt(sb)->dqptr_sem); + mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); if (!sb_has_quota_active(sb, type)) { - up_read(&sb_dqopt(sb)->dqptr_sem); + mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); return -ESRCH; } fmt = sb_dqopt(sb)->info[type].dqi_format->qf_fmt_id; - up_read(&sb_dqopt(sb)->dqptr_sem); + mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); if (copy_to_user(addr, &fmt, sizeof(fmt))) return -EFAULT; return 0;