From patchwork Wed Jul 19 07:03:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 9850563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB87B60388 for ; Wed, 19 Jul 2017 07:03:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAD3D285EA for ; Wed, 19 Jul 2017 07:03:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFC3128608; Wed, 19 Jul 2017 07:03:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C22A285EA for ; Wed, 19 Jul 2017 07:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753198AbdGSHDk (ORCPT ); Wed, 19 Jul 2017 03:03:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:50579 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753189AbdGSHDh (ORCPT ); Wed, 19 Jul 2017 03:03:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0249BAB1E; Wed, 19 Jul 2017 07:03:35 +0000 (UTC) Date: Wed, 19 Jul 2017 09:03:35 +0200 From: Johannes Thumshirn To: Jason L Tibbitts III Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dvyukov@google.com, hare@suse.com, hch@lst.de, martin.petersen@oracle.com Subject: Re: [REGRESSION] 28676d869bbb (scsi: sg: check for valid direction before starting the request) breaks mtx tape library control Message-ID: <20170719070335.GC4151@linux-x5ow.site> References: <20170718073747.GD4875@linux-x5ow.site> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jul 18, 2017 at 12:33:59PM -0500, Jason L Tibbitts III wrote: > I have verified that building a clean v4.12 with > 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 cherry picked on top still > shows the problem: > > [root@backup2 ~]# mtx -f /dev/sg7 next 0 > Unloading drive 0 into Storage Element 45...mtx: Request Sense: Long > Report=yes > mtx: Request Sense: Valid Residual=no > mtx: Request Sense: Error Code=0 (Unknown?!) > mtx: Request Sense: Sense Key=No Sense > mtx: Request Sense: FileMark=no > mtx: Request Sense: EOM=no > mtx: Request Sense: ILI=no > mtx: Request Sense: Additional Sense Code = 00 > mtx: Request Sense: Additional Sense Qualifier = 00 > mtx: Request Sense: BPV=no > mtx: Request Sense: Error in CDB=no > mtx: Request Sense: SKSV=no > MOVE MEDIUM from Element Address 1 to 1045 Failed > > Nothing appears to be logged; is there any kind of debugging information > I can collect which might help to track this down? I'm not particularly > good at this but I am pretty sure that I'm building everything properly > and am actually booting the patched kernel. Can you please apply this debugging patch, so I can see what's going on. Thanks, Johannes diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 1e82d4128a84..2505fa0b2062 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -753,6 +753,10 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf, static bool sg_is_valid_dxfer(sg_io_hdr_t *hp) { + + pr_info("%s: dxfer_direction: %d, dxfer_len: %d\n", + __func__, hp->dxfer_direction, hp->dxfer_len); + switch (hp->dxfer_direction) { case SG_DXFER_NONE: if (hp->dxferp || hp->dxfer_len > 0)