From patchwork Wed Jul 22 22:08:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Spencer Baugh X-Patchwork-Id: 6847331 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 07E10C05AC for ; Wed, 22 Jul 2015 22:09:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37B1820663 for ; Wed, 22 Jul 2015 22:09:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 614952065D for ; Wed, 22 Jul 2015 22:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753707AbbGVWIp (ORCPT ); Wed, 22 Jul 2015 18:08:45 -0400 Received: from catern.com ([104.131.201.120]:37288 "EHLO mail.catern.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753433AbbGVWIo (ORCPT ); Wed, 22 Jul 2015 18:08:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.catern.com (Postfix) with ESMTPSA id B3131479E4; Wed, 22 Jul 2015 22:08:42 +0000 (UTC) From: Spencer Baugh To: "Nicholas A. Bellinger" , linux-scsi@vger.kernel.org (open list:TARGET SUBSYSTEM), target-devel@vger.kernel.org (open list:TARGET SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Cc: Joern Engel , Spencer Baugh , Roland Dreier , Spencer Baugh Subject: [PATCH] target: respond to unknown initiators with sensible REPORT LUNS list length Date: Wed, 22 Jul 2015 15:08:17 -0700 Message-Id: <1437602898-15229-3-git-send-email-sbaugh@catern.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.1 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 From: Roland Dreier Solaris seems to go beserk if we respond to REPORT LUNS with a LUN LIST LENGTH of 0. Signed-off-by: Roland Dreier Signed-off-by: Spencer Baugh --- drivers/target/target_core_spc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 87d4adb..d8a32e5 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -1241,6 +1241,13 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) * See SPC3 r07, page 159. */ done: + /* + * If no real LUNs are accessible, report an allocation length + * of 1 LUN to account for virtual LUN 0. + */ + if (lun_count == 0) + lun_count = 1; + lun_count *= 8; buf[0] = ((lun_count >> 24) & 0xff); buf[1] = ((lun_count >> 16) & 0xff);