From patchwork Fri Feb 1 05:30:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2076601 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 9461CDFE75 for ; Fri, 1 Feb 2013 05:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751532Ab3BAFae (ORCPT ); Fri, 1 Feb 2013 00:30:34 -0500 Received: from mail-ia0-f177.google.com ([209.85.210.177]:37243 "EHLO mail-ia0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444Ab3BAFad (ORCPT ); Fri, 1 Feb 2013 00:30:33 -0500 Received: by mail-ia0-f177.google.com with SMTP id h8so4929453iaa.36 for ; Thu, 31 Jan 2013 21:30:33 -0800 (PST) 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=qHa5JYaA0FvsK0+CZtMSGN5qYcG7ojlCFmdQMf49alg=; b=WUUHPITmJ7iPtbVs6h6hI7JchTlLtE6M+sqL1LS7HeHiwvCrjBu9Pd4R63/2yM+1qk vA0Ww10USeYNLcimZjs8PyI6sqO3tKCz1I7WwzFAoQ+jy9x/7szKvo44JBTJeIRKXA6d uvlolL3KLmHHVb762Iqnd6gXdOfF2aPweBcKMg7e7rhQt8ZLbdS7ijJfhr7KADdfveUJ o7vHe4LwasDlANLfyvnz3e5egE1Eopz8hglTsESYpBNpXk6he2MLaAQaw7UVB2+AbemN BJ2QHmRvg7KzRC7TLZZQ0k5i4PmxoaQ1X9n+mYWlTGZUpQZI4eJ0lU8quMTlAlfArnKb JhQw== X-Received: by 10.50.45.166 with SMTP id o6mr381223igm.0.1359696633036; Thu, 31 Jan 2013 21:30:33 -0800 (PST) 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 eg7sm1221688igc.7.2013.01.31.21.30.31 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jan 2013 21:30:31 -0800 (PST) Message-ID: <510B52FD.3010907@inktank.com> Date: Thu, 31 Jan 2013 23:30:37 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH] libceph: don't require r_num_pages for bio requests X-Gm-Message-State: ALoCoQniyxTO5yZYcidJ/aDHsQ0Kd47v5lRWl5KrpKx/Q9yWvvL/iXf/D7JOh1YBewdUC3SYV9fy Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org There is a check in the completion path for osd requests that ensures the number of pages allocated is enough to hold the amount of incoming data expected. For bio requests coming from rbd the "number of pages" is not really meaningful (although total length would be). So stop requiring that nr_pages be supplied for bio requests. This is done by checking whether the pages pointer is null before checking the value of nr_pages. Note that this value is passed on to the messenger, but there it's only used for debugging--it's never used for validation. While here, change another spot that used r_pages in a debug message inappropriately, and also invalidate the r_con_filling_msg pointer after dropping a reference to it. This resolves: http://tracker.ceph.com/issues/3875 Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 2 -- net/ceph/osd_client.c | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) want, req->r_num_pages); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 3ba4836..14a6967 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1342,8 +1342,6 @@ static struct ceph_osd_request *rbd_osd_req_create( case OBJ_REQUEST_BIO: rbd_assert(obj_request->bio_list != NULL); osd_req->r_bio = obj_request->bio_list; - /* osd client requires "num pages" even for bio */ - osd_req->r_num_pages = calc_pages_for(offset, length); break; case OBJ_REQUEST_PAGES: osd_req->r_pages = obj_request->pages; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index ba03648..d9d58bb 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -137,10 +137,11 @@ void ceph_osdc_release_request(struct kref *kref) if (req->r_request) ceph_msg_put(req->r_request); if (req->r_con_filling_msg) { - dout("%s revoking pages %p from con %p\n", __func__, - req->r_pages, req->r_con_filling_msg); + dout("%s revoking msg %p from con %p\n", __func__, + req->r_reply, req->r_con_filling_msg); ceph_msg_revoke_incoming(req->r_reply); req->r_con_filling_msg->ops->put(req->r_con_filling_msg); + req->r_con_filling_msg = NULL; } if (req->r_reply) ceph_msg_put(req->r_reply); @@ -1981,7 +1982,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, if (data_len > 0) { int want = calc_pages_for(req->r_page_alignment, data_len); - if (unlikely(req->r_num_pages < want)) { + if (req->r_pages && unlikely(req->r_num_pages < want)) { pr_warning("tid %lld reply has %d bytes %d pages, we" " had only %d pages ready\n", tid, data_len,