From patchwork Thu Sep 11 15:10:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 4888881 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9EBCE9F371 for ; Thu, 11 Sep 2014 15:11:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30B5C20220 for ; Thu, 11 Sep 2014 15:11:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CF58200DF for ; Thu, 11 Sep 2014 15:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750908AbaIKPLX (ORCPT ); Thu, 11 Sep 2014 11:11:23 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:40073 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752022AbaIKPLG (ORCPT ); Thu, 11 Sep 2014 11:11:06 -0400 Received: by mail-la0-f50.google.com with SMTP id ty20so8630908lab.9 for ; Thu, 11 Sep 2014 08:11:04 -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; bh=bvFRk75wyJFiQNslFUIbqSk7A5ItDjTbIgjCo4SGghM=; b=duS7bmD+8DSTxL36+NfXGccEzNeqk2b0j+R/gMW+wvkLmmfpEQg97ejbfGvyZsVh6p BC5jP981FdqvphDp83HCnV1/Wq2r0Yohy4laXPdzNms8WkaHJHScPtbI/egdzp/80gEp 0Beo5cbaAbbWRT46lr/HPbqi0lECSr9SNYT53OQnruOZqVbAHXFSMXFqYIVtr8/uxJC1 b480PtD7GI/BTdsxyzwAo1VaXZSmOiSfqZs7OAjAU10cfzjIPCKCtXKgeUWsqmlWUM5y woWqPlz8cxz4GJCNLN5c6o+wVXGeoFEcZdDZILzKMg2wo1E50R3XHHffgW6MERhRRatB hEng== X-Gm-Message-State: ALoCoQkNKTkidbI+8lI1g236l4Ss+XynIhx2DWeTu1vSEd1ThK6aWUJZQRxsMsKVu39TxAMC0Hud X-Received: by 10.152.26.133 with SMTP id l5mr2129432lag.4.1410448264819; Thu, 11 Sep 2014 08:11:04 -0700 (PDT) Received: from localhost ([109.110.67.183]) by mx.google.com with ESMTPSA id my10sm425677lbb.9.2014.09.11.08.11.03 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Sep 2014 08:11:04 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH] rbd: do not return -ERANGE on auth failure Date: Thu, 11 Sep 2014 19:10:46 +0400 Message-Id: <1410448246-6635-1-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Trying to map an image out of a pool for which we don't have an 'x' permission bit fails with -ERANGE from ceph_extract_encoded_string() due to an unsigned vs signed bug. Fix it and get rid of the -ENIVAL sink, thus exposing rbd::get_id cls method return value. (I've seen a bunch of unexplained -ERANGE reports, I bet this is it). Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder --- drivers/block/rbd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 4b97baf8afa3..fe3726c62a37 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4924,7 +4924,7 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev) ret = image_id ? 0 : -ENOMEM; if (!ret) rbd_dev->image_format = 1; - } else if (ret > sizeof (__le32)) { + } else if (ret > (int)sizeof(u32)) { void *p = response; image_id = ceph_extract_encoded_string(&p, p + ret, @@ -4932,8 +4932,6 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev) ret = PTR_ERR_OR_ZERO(image_id); if (!ret) rbd_dev->image_format = 2; - } else { - ret = -EINVAL; } if (!ret) {