From patchwork Wed Jun 25 17:16:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 4422371 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 C8AAFBEEAA for ; Wed, 25 Jun 2014 17:17:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DEF0B20394 for ; Wed, 25 Jun 2014 17:17:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 185772038D for ; Wed, 25 Jun 2014 17:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757574AbaFYRRG (ORCPT ); Wed, 25 Jun 2014 13:17:06 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:42496 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757535AbaFYRRE (ORCPT ); Wed, 25 Jun 2014 13:17:04 -0400 Received: by mail-lb0-f176.google.com with SMTP id w7so2089907lbi.35 for ; Wed, 25 Jun 2014 10:17:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=G2Lcjxn4eptP2Nbc7k3e2wYTQSh06sZTs5DXZ8W+6vI=; b=WhxzrF/qDYA0+FFfj3xURiypSwQWUnHPA66XjWyliq2Wkzqdfwf6vM7i2HimgxEXiC O/BOK0klyBAWLl0TO8wStQYT6XQUeVMAVosbxLtC7FHxqSlX1WTiMwARLct7weQ+gkI9 Y6X2BYP2TOlsiC5SP0r2t1+04eS6kD8It4FPfZ0AL4dvxtkUd9rtq7rmA7wzVqgpStJm llHDn/scy7Yra7t9GstglHUD5WuzLsyYoeSbSBJBbbOb9uJyE/BjjubKuRewdIidKgVY l9T5ABBwJ0kJclEXnjFxA6iTtuh5MV7DmKS+DWuXQ9dGy2umC5x9ncoMoJpIL2eDpj3X 7aAw== X-Gm-Message-State: ALoCoQmyN59GmdeJIj3xPdqix31D8OBubXM+Wv4opkLcVjNid9CSFwRaUZ8wy/s+e0IAFgwBZVcK X-Received: by 10.112.180.225 with SMTP id dr1mr6291158lbc.51.1403716622835; Wed, 25 Jun 2014 10:17:02 -0700 (PDT) Received: from localhost ([109.110.67.53]) by mx.google.com with ESMTPSA id kx8sm1807202lac.38.2014.06.25.10.17.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 25 Jun 2014 10:17:02 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 05/14] libceph: harden ceph_osdc_request_release() a bit Date: Wed, 25 Jun 2014 21:16:38 +0400 Message-Id: <1403716607-13535-6-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403716607-13535-1-git-send-email-ilya.dryomov@inktank.com> References: <1403716607-13535-1-git-send-email-ilya.dryomov@inktank.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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Add some WARN_ONs to alert us when we try to destroy requests that are still registered. Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder --- net/ceph/osd_client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 7406046212dc..052eb8bfcc74 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -305,6 +305,12 @@ static void ceph_osdc_release_request(struct kref *kref) dout("%s %p (r_request %p r_reply %p)\n", __func__, req, req->r_request, req->r_reply); + WARN_ON(!RB_EMPTY_NODE(&req->r_node)); + WARN_ON(!list_empty(&req->r_req_lru_item)); + WARN_ON(!list_empty(&req->r_osd_item)); + WARN_ON(!list_empty(&req->r_linger_item)); + WARN_ON(!list_empty(&req->r_linger_osd_item)); + WARN_ON(req->r_osd); if (req->r_request) ceph_msg_put(req->r_request); @@ -1204,6 +1210,7 @@ static void __unregister_request(struct ceph_osd_client *osdc, dout("__unregister_request %p tid %lld\n", req, req->r_tid); rb_erase(&req->r_node, &osdc->requests); + RB_CLEAR_NODE(&req->r_node); osdc->num_requests--; if (req->r_osd) {