From patchwork Thu May 21 12:35:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 6454631 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D490DC0432 for ; Thu, 21 May 2015 12:35:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0F0F20450 for ; Thu, 21 May 2015 12:35:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D3C2203ED for ; Thu, 21 May 2015 12:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755490AbbEUMfk (ORCPT ); Thu, 21 May 2015 08:35:40 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:37410 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794AbbEUMfe (ORCPT ); Thu, 21 May 2015 08:35:34 -0400 Received: by wibt6 with SMTP id t6so12235886wib.0 for ; Thu, 21 May 2015 05:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CT78tx4NZ9DaHhrUM6xFrwTPnBEoFisvEak+7WYU0Vs=; b=XaXrY3TORfFESqNKLVmPctR8JO99tdoLSiO1HJhJgUgr4elChU/30Z/Rw6oBuCtb45 LwkuTjp/3Ibux4VIvY8cOc925kNNAbCVTrJ+FkkefZztdquSRbVSAO1KY/m+nW45bEP9 Wb8ZAUGldZg91bBDz776Lhnfjjhca9l9YVQgyFn+cfCLVBTAGeX34bIkuz53yfZ57qp5 3J4DS63mqFnm4vGDGCSEtgLkja2/6hrgmKlbx4XjmLf4Efth4N56twxxAl59b1ToDhDo msTgicN7l2v9GwC5BGpXwEpNBivh3jkAluugHMLdBwiSBH7B0L8qtyRZZ4fg1Wwiu/g1 q9fQ== X-Received: by 10.194.57.11 with SMTP id e11mr4728321wjq.19.1432211733000; Thu, 21 May 2015 05:35:33 -0700 (PDT) Received: from localhost.localdomain ([109.110.66.238]) by mx.google.com with ESMTPSA id gs7sm2682352wib.10.2015.05.21.05.35.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 05:35:32 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Zheng Yan Subject: [PATCH 3/5] libceph: a couple tweaks for wait loops Date: Thu, 21 May 2015 15:35:04 +0300 Message-Id: <1432211706-10473-4-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1432211706-10473-1-git-send-email-idryomov@gmail.com> References: <1432211706-10473-1-git-send-email-idryomov@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=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 - return -ETIMEDOUT instead of -EIO in case of timeout - wait_event_interruptible_timeout() returns time left until timeout and since it can be almost LONG_MAX we had better assign it to long Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder --- net/ceph/ceph_common.c | 7 +++---- net/ceph/mon_client.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index a80e91c2c9a3..925d0c890b80 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c @@ -647,8 +647,8 @@ static int have_mon_and_osd_map(struct ceph_client *client) */ int __ceph_open_session(struct ceph_client *client, unsigned long started) { - int err; unsigned long timeout = client->options->mount_timeout; + long err; /* open session, and wait for mon and osd maps */ err = ceph_monc_open_session(&client->monc); @@ -656,16 +656,15 @@ int __ceph_open_session(struct ceph_client *client, unsigned long started) return err; while (!have_mon_and_osd_map(client)) { - err = -EIO; if (timeout && time_after_eq(jiffies, started + timeout)) - return err; + return -ETIMEDOUT; /* wait */ dout("mount waiting for mon_map\n"); err = wait_event_interruptible_timeout(client->auth_wq, have_mon_and_osd_map(client) || (client->auth_err < 0), ceph_timeout_jiffies(timeout)); - if (err == -EINTR || err == -ERESTARTSYS) + if (err < 0) return err; if (client->auth_err < 0) return client->auth_err; diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 0da3bdc116f7..9d6ff1215928 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -308,7 +308,7 @@ int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch, unsigned long timeout) { unsigned long started = jiffies; - int ret; + long ret; mutex_lock(&monc->mutex); while (monc->have_osdmap < epoch) {