From patchwork Tue Jul 16 07:45:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2827996 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 3544AC0AB3 for ; Tue, 16 Jul 2013 07:46:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADC7E2015A for ; Tue, 16 Jul 2013 07:46:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8DBC20154 for ; Tue, 16 Jul 2013 07:46:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753089Ab3GPHp5 (ORCPT ); Tue, 16 Jul 2013 03:45:57 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:48313 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753059Ab3GPHpz (ORCPT ); Tue, 16 Jul 2013 03:45:55 -0400 Received: by mail-pd0-f174.google.com with SMTP id 10so399233pdc.33 for ; Tue, 16 Jul 2013 00:45:55 -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=G2PuT/ECeMxuWgT8PrA6a7TM4HH0YvhbBSRxQpnJxPo=; b=GkoxBLBVxbuywmBuo99z0wwPqVLS0mOYw3iTlYjmwITcTcgrPULgCTG2Zz+w7S8wNC v9jUhM/7SH5rG/LzsbHAqfo9P0+Sskh0MbIUjyPUHofZaO+Dn69JQztm8UJxHyqktYVm yHDNg/r1v96ukS3VVSbdPw4bCigeAvsrktjpyvcdBFlJV+6+ibY+Kv3mh6cdbp0ihv0s DZr2YVfejFphzYYNgCmwzKVwkPQ3+YsTUuolLRo5p7yIK8mVYr+i018h5XVslxPrEp6n ukXhjnUYrpSDEw6TN8mTfCKho2qE/QhFpSsxKvfo+luSGSDWdPQkTAva0LDosEnAjEyo ZMDQ== X-Received: by 10.67.22.99 with SMTP id hr3mr1406398pad.12.1373960755104; Tue, 16 Jul 2013 00:45:55 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id ot4sm2722641pac.17.2013.07.16.00.45.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 16 Jul 2013 00:45:54 -0700 (PDT) Date: Tue, 16 Jul 2013 15:45:52 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH 2/2] libceph: Remap notarget requests in handle_timeout. X-Priority: 3 X-GUID: E44CBC07-64FA-441B-8625-FC716A2512D9 X-Has-Attach: no X-Mailer: Foxmail 7.0.1.90[en] Mime-Version: 1.0 Message-ID: <2013071615454946640410@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=-7.2 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 If __map_request failed ,the request can't send and in list req_notarget. For those, they only remaped in func ceph_osdc_handle_map which update the epoch of osdmap.There are some reasons like ENOMEM which can't cause update epoch of osdmap.So the notarget requested can't remap for ever. Add a chance in handle_timeout to remap those. Signed-off-by: Jianpeng Ma --- net/ceph/osd_client.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 1.8.1.2 diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 7d40a61..f0deed0 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1355,6 +1355,41 @@ static void __send_queued(struct ceph_osd_client *osdc) } /* + * Resend any requests in the queue(req_notarget) + * After this function,it should call __send_queued to do + * real send operation + */ +static void __send_notarget(struct ceph_osd_client *osdc) +{ + struct ceph_osd_request *req, *tmp; + int rc, needmap = 0; + + dout("__send_notarget\n"); + list_for_each_entry_safe(req, tmp, &osdc->req_notarget, + r_req_lru_item) { + rc = __map_request(osdc, req, 0); + if (rc < 0) + dout("__send_notarget failed map, " + " will retry %lld\n", req->r_tid); + if (req->r_osd == NULL) { + dout("__send_notarget %p no up osds in pg\n", req); + needmap++; + } else if (rc > 0) { + if (!req->r_linger) { + dout("%p tid %llu requeued on osd%d\n", req, + req->r_tid, + req->r_osd ? req->r_osd->o_osd : -1); + req->r_flags |= CEPH_OSD_FLAG_RETRY; + } + } + + } + + if (needmap) + ceph_monc_request_next_osdmap(&osdc->client->monc); +} + +/* * Timeout callback, called every N seconds when 1 or more osd * requests has been active for more than N seconds. When this * happens, we ping all OSDs with requests who have timed out to @@ -1403,6 +1438,7 @@ static void handle_timeout(struct work_struct *work) } __schedule_osd_timeout(osdc); + __send_notarget(osdc); __send_queued(osdc); mutex_unlock(&osdc->request_mutex); up_read(&osdc->map_sem);