From patchwork Sat Nov 3 02:32:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1691201 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5266CDF2A2 for ; Sat, 3 Nov 2012 02:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752444Ab2KCCcl (ORCPT ); Fri, 2 Nov 2012 22:32:41 -0400 Received: from mga03.intel.com ([143.182.124.21]:45937 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752156Ab2KCCcl (ORCPT ); Fri, 2 Nov 2012 22:32:41 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 02 Nov 2012 19:32:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,702,1344236400"; d="scan'208";a="212949505" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.21.107]) by azsmga001.ch.intel.com with ESMTP; 02 Nov 2012 19:32:38 -0700 From: "Yan, Zheng" To: sage@inktank.com, ceph-devel@vger.kernel.org Cc: "Yan, Zheng" Subject: [PATCH] ceph: Hold caps_list_lock when adjusting caps_{use, total}_count Date: Sat, 3 Nov 2012 10:32:37 +0800 Message-Id: <1351909957-15243-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" Signed-off-by: Yan, Zheng --- fs/ceph/caps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index c633d1d..8072aef 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -236,8 +236,10 @@ static struct ceph_cap *get_cap(struct ceph_mds_client *mdsc, if (!ctx) { cap = kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS); if (cap) { + spin_lock(&mdsc->caps_list_lock); mdsc->caps_use_count++; mdsc->caps_total_count++; + spin_unlock(&mdsc->caps_list_lock); } return cap; }