From patchwork Sat Apr 5 11:13:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Herbszt X-Patchwork-Id: 3942041 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-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 7535EBFF02 for ; Sat, 5 Apr 2014 11:17:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A141320398 for ; Sat, 5 Apr 2014 11:17:50 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 816CF2034E for ; Sat, 5 Apr 2014 11:17:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s35BDWDw001795; Sat, 5 Apr 2014 07:13:33 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s35BDVPH001536 for ; Sat, 5 Apr 2014 07:13:31 -0400 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s35BDVVV002045 for ; Sat, 5 Apr 2014 07:13:31 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s35BDTtL026267 for ; Sat, 5 Apr 2014 07:13:30 -0400 Received: from localhost ([88.74.100.197]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MhNk6-1Wizhi2ypO-00MYaA; Sat, 05 Apr 2014 13:13:28 +0200 Date: Sat, 5 Apr 2014 13:13:23 +0200 From: Sebastian Herbszt To: dm-devel@redhat.com Message-ID: <20140405131323.00000d4b@localhost> MIME-Version: 1.0 X-Provags-ID: V03:K0:pdJQwFi9k4QdZjmUN2dR7bKoXpyqSbQzDwgaS+wi/x1BaQJQIEe fdavcuWWUaO1GPCCFXUJOpk9DRhLPaQe5pjA6gyS1mWZP0o0ynU/tBhep5o//9vfKaajP2r C9GL04ETemAlWnxX0zs8qREB9Ojqic3hrXNk+rZ03dtuxE6aA9UQZVgtvYt7xcYsBeqpQMK FAE/y2/VrOvdeYxDSxN0w== X-RedHat-Spam-Score: -2.31 (BAYES_00, DCC_REPUT_00_12, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-loop: dm-devel@redhat.com Cc: Sebastian Herbszt Subject: [dm-devel] multipath-tools: mismatch between CDB allocation length and SG_IO dxfer_len X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Hello, while playing with multipath-tools and scst I got the following warning: [ 6382.467569] [3806]: scst: scst_parse_cmd:826:Warning: expected transfer length 256 for opcode 0x12 (handler vdisk_blockio, target scst_local) doesn't match decoded value 128 [ 6382.467574] [3806]: scst_parse_cmd:828:Suspicious CDB: [ 6382.467579] (h)___0__1__2__3__4__5__6__7__8__9__A__B__C__D__E__F [ 6382.467581] 0: 12 01 c0 00 80 00 ...... This happened when my scst target pretended to be a CLARiiON. I noticed a mismatch in emc_clariion_prio (libmultipath/prioritizers/emc.c) between the allocation length and dxfer_len: int emc_clariion_prio(const char *dev, int fd) { unsigned char sense_buffer[256]; unsigned char sb[128]; unsigned char inqCmdBlk[INQUIRY_CMDLEN] = {INQUIRY_CMD, 1, 0xC0, 0, sizeof(sb), 0}; ... memset(&sense_buffer, 0, 256); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof (inqCmdBlk); io_hdr.mx_sb_len = sizeof (sb); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = sizeof (sense_buffer); io_hdr.dxferp = sense_buffer; io_hdr.cmdp = inqCmdBlk; io_hdr.sbp = sb; io_hdr.timeout = 60000; io_hdr.pack_id = 0; The following change shrinks the size of sense_buffer to 128. Sebastian --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/libmultipath/prioritizers/emc.c b/libmultipath/prioritizers/emc.c index 87e9a8d..91b3d90 100644 --- a/libmultipath/prioritizers/emc.c +++ b/libmultipath/prioritizers/emc.c @@ -14,15 +14,15 @@ int emc_clariion_prio(const char *dev, int fd) { - unsigned char sense_buffer[256]; + unsigned char sense_buffer[128]; unsigned char sb[128]; unsigned char inqCmdBlk[INQUIRY_CMDLEN] = {INQUIRY_CMD, 1, 0xC0, 0, - sizeof(sb), 0}; + sizeof(sense_buffer), 0}; struct sg_io_hdr io_hdr; int ret = PRIO_UNDEF; memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - memset(&sense_buffer, 0, 256); + memset(&sense_buffer, 0, 128); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof (inqCmdBlk); io_hdr.mx_sb_len = sizeof (sb);