From patchwork Mon Mar 25 16:56:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2332371 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 083903FC54 for ; Mon, 25 Mar 2013 16:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932802Ab3CYQ5A (ORCPT ); Mon, 25 Mar 2013 12:57:00 -0400 Received: from mail-ie0-f178.google.com ([209.85.223.178]:43741 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932751Ab3CYQ4q (ORCPT ); Mon, 25 Mar 2013 12:56:46 -0400 Received: by mail-ie0-f178.google.com with SMTP id bn7so5182997ieb.23 for ; Mon, 25 Mar 2013 09:56:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=d5bV/XeCToowO0yPxY4g+3Wy+WIbKpn/+6fCDo6nOTM=; b=Ct8AWkGKED1/c3x3kF01xoZgD/CN0uAvw+8zfHJ10Xp7FVccJv1gjjIw0gUIPJJg6w OkGjRHG/iNTwQQoPOhlp/KfojG1H/DESprRPeEqgtURC1wx74f9LgjeamhDc6wgdNhpK NcMB9s+G3en5agE8DrJ2VlO8lRAKDdRNzlIfxJdMld9CYz+l8ABHZ8aLwXQdWAuDotGg wmmMYq21j+ND153FEX78eAe9+6ovs3E1aX+L3qUiehXXiuKd/n8GPoHeSeDvpc6V+olo S66hJvNVaZDWJ+LshlEshvenXaZeaLvYPmjygPD3ldh3cTamqEmDZuuq7+1XvZYOniJ7 xgBQ== X-Received: by 10.43.117.136 with SMTP id fm8mr7262741icc.33.1364230606276; Mon, 25 Mar 2013 09:56:46 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id s8sm16701610igs.0.2013.03.25.09.56.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Mar 2013 09:56:45 -0700 (PDT) Message-ID: <515081D0.4080405@inktank.com> Date: Mon, 25 Mar 2013 11:56:48 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH] libceph: initialize data fields on last msg put X-Gm-Message-State: ALoCoQmk5RZR+CxUU7H92rSDEoG7bLlzE1wOmpTonD8E3invHEOwytzVjAKc6q4BZRtmkDfiB76i Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org (This patch is available in branch "review/wip-4540" of the ceph-client git repository, which is based on the current "testing" branch.) When the last reference to a ceph message is dropped, ceph_msg_last_put() is called to clean things up. For "normal" messages (allocated via ceph_msg_new() rather than being allocated from a memory pool) it's sufficient to just release resources. But for a mempool-allocated message we actually have to re-initialize the data fields in the message back to initial state so they're ready to go in the event the message gets reused. Some of this was already done; this fleshes it out so it's done more completely. This resolves: http://tracker.ceph.com/issues/4540 Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- net/ceph/messenger.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 997dacc..2ccbd189 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -3299,12 +3299,17 @@ void ceph_msg_last_put(struct kref *kref) if (ceph_msg_has_pages(m)) { m->p.length = 0; m->p.pages = NULL; + m->p.type = CEPH_OSD_DATA_TYPE_NONE; } - if (ceph_msg_has_pagelist(m)) { ceph_pagelist_release(m->l.pagelist); kfree(m->l.pagelist); m->l.pagelist = NULL; + m->l.type = CEPH_OSD_DATA_TYPE_NONE; + } + if (ceph_msg_has_bio(m)) { + m->b.bio = NULL; + m->b.type = CEPH_OSD_DATA_TYPE_NONE; } if (m->pool)