From patchwork Mon Jul 13 08:24:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6775881 Return-Path: X-Original-To: patchwork-linux-nfs@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 F3EC2C05AC for ; Mon, 13 Jul 2015 08:24:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06980205BD for ; Mon, 13 Jul 2015 08:24:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2655E2021B for ; Mon, 13 Jul 2015 08:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751370AbbGMIY4 (ORCPT ); Mon, 13 Jul 2015 04:24:56 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36285 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbbGMIYz (ORCPT ); Mon, 13 Jul 2015 04:24:55 -0400 Received: by pachj5 with SMTP id hj5so28299017pac.3 for ; Mon, 13 Jul 2015 01:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=G5qSnccgJliR923M9bWHFR7LEf9BtBdgBAGCfH5lKrg=; b=Hoj4oueE4m0xZ85yLmtRcf7vLsuFqBF5yEwzA5prBSPbsEix/99zteEcy2qoyVE2fC n2BcGCiDKIpQDSKYputWYeYA2BquqX/ZaDfVcV5tHEOPoDDkxD2SEbPYIgcofKOmDsdP d3OrO5fxY+Mm5i2TIv4GZXIpmKijpEUkDYlDIL6qAmAyDqWAbtNWKRP8MkuLtSUtvhVB 1df6ua8zvRycgcCuVAts7U8lqH9AUCJHGdMBO75tznUtfy1mfXdho29Cj9kG1tWngPbK QvsXfY67+LDcpSwjQ8LXuXxnuyDsJBUQUKllscLtR2MVpMkfgfk9KCCVpOkC+oKbZsAM sbWA== X-Received: by 10.70.35.16 with SMTP id d16mr34789510pdj.66.1436775894973; Mon, 13 Jul 2015 01:24:54 -0700 (PDT) Received: from [192.168.99.19] ([104.143.41.79]) by smtp.googlemail.com with ESMTPSA id ze3sm1214627pbb.32.2015.07.13.01.24.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jul 2015 01:24:54 -0700 (PDT) Message-ID: <55A375A1.4000800@gmail.com> Date: Mon, 13 Jul 2015 16:24:01 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Steve Dickson , "linux-nfs@vger.kernel.org" CC: Christoph Hellwig , kinglongmee@gmail.com Subject: [PATCH v2] blkmapd: Skip the SCSI ID if data length is zero References: <55A2FEE4.6030201@gmail.com> <20150713064216.GA31842@infradead.org> In-Reply-To: <20150713064216.GA31842@infradead.org> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.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 In vmware linux, the iscsi device contains more than one SCSI ID, and, the second one's data length is zero. If there are two iSCSI devices with the second SCSI ID's data length is zero, the first iSCSI device will record with an invalid SCSI ID as zero length, the second one will be treat as the first one for the SCSI ID is zero length too. It means the only the first iSCSI device is exist in blkmapd's cache, the request for the second iSCSI device will failed as, "blkmapd: Could not find disk for device" and, "bl_resolve_deviceid failed to decode device: 2". v2, update comments Signed-off-by: Kinglong Mee --- utils/blkmapd/device-inq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c index 6b56b67..57fe7a3 100644 --- a/utils/blkmapd/device-inq.c +++ b/utils/blkmapd/device-inq.c @@ -198,7 +198,7 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename) dev_id = (struct bl_dev_id *)&(dev_root->data[pos]); pos += (dev_id->len + devid_len); - if ((dev_id->ids & 0xf) < current_id) + if ((dev_id->ids & 0xf) < current_id || !dev_id->len) continue; switch (dev_id->ids & 0xf) { /* We process SCSI ID with four ID cases: 0, 1, 2 and 3.