From patchwork Wed Jul 8 12:59:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 6746891 Return-Path: X-Original-To: patchwork-linux-scsi@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 53973C05AC for ; Wed, 8 Jul 2015 12:59:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B7AF206D0 for ; Wed, 8 Jul 2015 12:59:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D13B1206BA for ; Wed, 8 Jul 2015 12:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758755AbbGHM7X (ORCPT ); Wed, 8 Jul 2015 08:59:23 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:34240 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758745AbbGHM7W (ORCPT ); Wed, 8 Jul 2015 08:59:22 -0400 Received: by wifm2 with SMTP id m2so88755909wif.1 for ; Wed, 08 Jul 2015 05:59:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=i3iTr100cFe9K6hImYplV4i3ZRH4XwH9U2kZ5dbFE3Q=; b=FbXiHNSIHDZEp1hTTLnR3kZPmRqd20e7XQdDZz05/JTbRgXHvxIKE4PoMGj1EcxdBH gm+Gbb8WPIONqDmR34Kk5E5z6zM0Gg2cxjuts5hBdi6F1gtQMHefqkv5u6KcN7CMhKRL IUjTK4ycmsPbaEyOSsJ7gIyP55PkvxPuVuZ/2FQyEpoc5Ok3cX/f2Bvj/Ver1dK51P4N bF+bl67zKkU9S8PuFUkDWipDueRQQSo4wBGNmazt4GLldx/wDToEkgPlvDT0kVxO4Z34 uOUgNMD/1MLa8k+/pCTUzVqb9hzDSkUXa4JwRBK10YWBL98EVwwG75SrqJ/1tkcr8PWy l+4w== X-Gm-Message-State: ALoCoQkv2fNZkEOOEtmIITY0mdk8tkkWJFCkr8KwVxuPhrksitXVZavrKHuCf0Tbtrf89heQ3VrA X-Received: by 10.180.86.234 with SMTP id s10mr73925129wiz.50.1436360361342; Wed, 08 Jul 2015 05:59:21 -0700 (PDT) Received: from [10.223.0.123] ([193.47.165.251]) by smtp.googlemail.com with ESMTPSA id q9sm2818343wiz.23.2015.07.08.05.59.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2015 05:59:20 -0700 (PDT) Subject: Re: [PATCH v3 5/5] target: Fix wrong setting of sense format for PI errors To: Hannes Reinecke , Christoph Hellwig References: <1436188508-1539-1-git-send-email-sagig@mellanox.com> <1436188508-1539-6-git-send-email-sagig@mellanox.com> <20150708101931.GD14466@infradead.org> <559CFD14.9090803@dev.mellanox.co.il> <20150708104955.GA20842@infradead.org> <559D0286.4070202@suse.de> <559D0619.9040101@dev.mellanox.co.il> Cc: Sagi Grimberg , target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, "Nicholas A. Bellinger" , Bart Van Assche From: Sagi Grimberg Message-ID: <559D1EB6.3090509@dev.mellanox.co.il> Date: Wed, 8 Jul 2015 15:59:34 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <559D0619.9040101@dev.mellanox.co.il> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.6 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 On 7/8/2015 2:14 PM, Sagi Grimberg wrote: >> >> And it's actually not true that you'd need descriptor sense to >> encode the sector information; it'll be stored in the 'information' >> section (byte 3-6) for fixed format sense. > > But when I return the sector info in a fixed size format, the initiator > is not able to decode the faulty sector: > > kernel: DIFv1 Type 1 reference failed on sector: 15 tag: 0xfffffff0 > sector MSB: 0x0000000f > kernel: sd 10:0:1:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK > driverbyte=DRIVER_SENSE > kernel: sd 10:0:1:0: [sdc] tag#0 Sense Key : Aborted Command [current] > kernel: sd 10:0:1:0: [sdc] tag#0 Add. Sense: No additional sense > information > kernel: sd 10:0:1:0: [sdc] tag#0 CDB: Read(10) 28 20 00 00 00 00 00 00 > 10 00 > kernel: blk_update_request: I/O error, dev sdc, sector 0 > > Is that a bug? Bleh, found the bug... It was in scsi_set_sense_information() For Fixed sized sense the information field is 4 bytes so this fixes it: I'll send out a separate patch. Thanks Hannes and Christoph for catching this. Sagi. --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c index 41432c1..8cfb7ee 100644 --- a/drivers/scsi/scsi_common.c +++ b/drivers/scsi/scsi_common.c @@ -270,7 +270,7 @@ void scsi_set_sense_information(u8 *buf, u64 info) put_unaligned_be64(info, &ucp[4]); } else if ((buf[0] & 0x7f) == 0x70) { buf[0] |= 0x80; - put_unaligned_be64(info, &buf[3]); + put_unaligned_be32(info, &buf[3]); } } EXPORT_SYMBOL(scsi_set_sense_information);