From patchwork Tue Mar 26 02:27:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2334431 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 917333FC54 for ; Tue, 26 Mar 2013 02:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754449Ab3CZC1O (ORCPT ); Mon, 25 Mar 2013 22:27:14 -0400 Received: from mail-ia0-f178.google.com ([209.85.210.178]:65157 "EHLO mail-ia0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753865Ab3CZC1O (ORCPT ); Mon, 25 Mar 2013 22:27:14 -0400 Received: by mail-ia0-f178.google.com with SMTP id r13so4945203iar.37 for ; Mon, 25 Mar 2013 19:27:13 -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 :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=VaMhxuPRCyLrRn8ypdxcqnYjiDuK+1wcoDdCymvNWNo=; b=IW3BpIR14SUrsBqt5t2GyI2+k9edtxdVNj3ZlqyGBihfseZu8uArv4l+5JAmh4LrzS uyLvah1XJBp6K0uZ9nBIxSavs7XwGHW9Av+OGArTmlvMu1mwAvWn+MxuantHEBItzHSA G5hB514da9+ZYZBEMY4x4AJef4rePm8r9gDBkuNKnhRws8jTlwu/YnmalVVRJJeZNIYe vfBl6DRKIl9tV2mG/ek9JKaPzbAUiLVuCGs2FIYQ09/f9FJabcsoQdmsusEYkZZ9+OYK Fby68WCmIThj6LOcFYFCgl2Y8z/jz7R0Vfr98jrPdzZklvdgfW8T47CBRQ+SnPL7FY2N 933w== X-Received: by 10.50.112.100 with SMTP id ip4mr118605igb.87.1364264833789; Mon, 25 Mar 2013 19:27:13 -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 px9sm1490957igc.0.2013.03.25.19.27.12 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Mar 2013 19:27:12 -0700 (PDT) Message-ID: <5151077F.10504@inktank.com> Date: Mon, 25 Mar 2013 21:27:11 -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 1/6] libceph: slightly defer registering osd request References: <5151071C.3000309@inktank.com> In-Reply-To: <5151071C.3000309@inktank.com> X-Gm-Message-State: ALoCoQnxRyx3e2h/tKAyhdiO2rkxnclwmSoSdliFouQ4l7BQcpEn98sd1nE/0V23FWy8zswqGPyv Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org One of the first things ceph_osdc_start_request() does is register the request. It then acquires the osd client's map semaphore and request mutex and proceeds to map and send the request. There is no reason the request has to be registered before acquiring the map semaphore. So hold off doing so until after the map semaphore is held. Since register_request() is nothing more than a wrapper around __register_request(), call the latter function instead, after acquiring the request mutex. That leaves register_request() unused, so get rid of it. This partially resolves: http://tracker.ceph.com/issues/4392 Signed-off-by: Alex Elder --- net/ceph/osd_client.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) */ @@ -1785,8 +1777,6 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, ceph_osdc_msg_data_set(req->r_reply, &req->r_data_in); ceph_osdc_msg_data_set(req->r_request, &req->r_data_out); - register_request(osdc, req); - down_read(&osdc->map_sem); mutex_lock(&osdc->request_mutex); /* @@ -1794,6 +1784,7 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, * while we dropped request_mutex above, so only send now if * the request still han't been touched yet. */ + __register_request(osdc, req); if (req->r_sent == 0) { rc = __map_request(osdc, req, 0); if (rc < 0) { diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 7041906..f9276cb 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -831,14 +831,6 @@ static void __register_request(struct ceph_osd_client *osdc, } } -static void register_request(struct ceph_osd_client *osdc, - struct ceph_osd_request *req) -{ - mutex_lock(&osdc->request_mutex); - __register_request(osdc, req); - mutex_unlock(&osdc->request_mutex); -} - /* * called under osdc->request_mutex