From patchwork Tue Jun 25 07:27:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2774901 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ACFDBC0AB1 for ; Tue, 25 Jun 2013 07:27:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39497200F2 for ; Tue, 25 Jun 2013 07:27:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEE56200EB for ; Tue, 25 Jun 2013 07:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266Ab3FYH1r (ORCPT ); Tue, 25 Jun 2013 03:27:47 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:58427 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028Ab3FYH1r (ORCPT ); Tue, 25 Jun 2013 03:27:47 -0400 Received: by mail-pa0-f47.google.com with SMTP id kl14so12142732pab.6 for ; Tue, 25 Jun 2013 00:27:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:reply-to:subject:x-priority:x-guid:x-has-attach :x-mailer:mime-version:message-id:content-type :content-transfer-encoding; bh=6DxdLp6X5EuhC+zkYR+GF8mlb60xZ/pYFB59Gk7VQrM=; b=BaUy9vduEGGakImsKa0KKh+uAo5j8bcwmG0oYvjv4gd1ZQH+yZSD7Wz2unILKrBZ71 qyvhvunLWp6JRzl8JGjlvA+d8Hx1dPa5/skKzmXrmPJR+iBYXICqBk4JL/y9xZj9XqQG Dfk9kOS5HcQH648t2QusP/fMVOLtkMS1EUTioNb1ikPZXaymGMg/mEMdwLAzzhUX0mcg C0JKyoqbKriRqBNtB5Tjv4FDnNeOUcGISDRxPkPr2ko2lCMlfMdS6yVV8ZzIqAeazJb6 oPmC/enzQ0RZYusAtFPVgg27g2Lqw/+oQAMvWW2R4NUMqT0O4aYCSFYawD2gadbDtvAH AzmA== X-Received: by 10.66.164.232 with SMTP id yt8mr30912691pab.21.1372145266702; Tue, 25 Jun 2013 00:27:46 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id b4sm19250828pbm.6.2013.06.25.00.27.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Jun 2013 00:27:45 -0700 (PDT) Date: Tue, 25 Jun 2013 15:27:44 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH][TRIVIAL] ceph: Free the previous caps if alloc failed. X-Priority: 3 X-GUID: D90303EC-B1F8-4BA4-9BD9-8CE6D1231494 X-Has-Attach: no X-Mailer: Foxmail 7.0.1.90[en] Mime-Version: 1.0 Message-ID: <201306251527405618532@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jianpeng Ma --- fs/ceph/caps.c | 5 +++++ 1 file changed, 5 insertions(+) -- 1.8.1.2 diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index da0f9b8..626b0ec 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -203,6 +203,11 @@ out_alloc_count: /* we didn't manage to reserve as much as we needed */ pr_warning("reserve caps ctx=%p ENOMEM need=%d got=%d\n", ctx, need, have); + if (alloc) { + struct ceph_cap *tmp; + list_for_each_entry_safe(cap, tmp, &newcaps, caps_item) + kmem_cache_free(ceph_cap_cachep, cap); + } return ret; }