From patchwork Wed May 23 14:42:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10421453 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 F030E60545 for ; Wed, 23 May 2018 14:43:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF4CE2897A for ; Wed, 23 May 2018 14:43:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96D46289B1; Wed, 23 May 2018 14:43:45 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 C96EA29039 for ; Wed, 23 May 2018 14:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933151AbeEWOm4 (ORCPT ); Wed, 23 May 2018 10:42:56 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:38408 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933199AbeEWOmx (ORCPT ); Wed, 23 May 2018 10:42:53 -0400 Received: by mail-it0-f68.google.com with SMTP id q4-v6so4639468ite.3 for ; Wed, 23 May 2018 07:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HBfKvWabj15I/Ynbe/DVwfHv60sADuamFbfs7fGc7/4=; b=sNoWPg1lHHCwW1PbY8w1LcXaz54b4Jb9HKW+XY226ZyBy+yvtOPMKCmmXrj6NDEI5Q ahbigstd5EmBEFvoWp50V1BBLoYJpiwFyTSncqVbbB95q+snlgN295dnQMUPmFwyE/Jk V3bN4HpsfTnrDsvxdJgomeW0tmK8Dika1rSHBCV54LnSI3EP1k0HRaCxGTK0PFfZY9Z+ T+Od5A3yXOMJIdwL39aIXPfPnE68PGSxkBNhqAc0oS3XMJ6pl1CraUjv3i6WuGCOjgyt pGTq12A1MuIqYqvTG7JAiSbSUoe+u8ZqamIvbzNwIWIwJEyTGqDzybpIuutRPPNgYb30 b5Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HBfKvWabj15I/Ynbe/DVwfHv60sADuamFbfs7fGc7/4=; b=gWi7doHfd5wxCemQnQIvHJ3v/Cy1dnVEROSWmC3wLNW3T3gfkbFf0HXpX5SphLvb09 4iAx9CXr30nUbErAO4C3mmtmBsk6kbZTsGzygXx29/dEiHriP0WJWGMrlD2ZiLWDgOu/ g65trnKjKoSzLfrmjrkPGp1Qm7yQm7RWi0ja5glQgSRbqBTIC2X5vTGuwcenlcTIayYG vaYse8NEUkm7UGHQBIKebLkmfqD34zZeG4RZ2D7dWxSORMIXINoZPKHkKAP9pF5NMLh+ 7I6/OjfzK5xuAH8A4OyDZjL0Fb9ghSnZWnjvnOhO9MWRnpteqvMjkmVHA8KmMeR21VgN KBhg== X-Gm-Message-State: ALKqPwf/St6DPr55lEn816vXXSY83Yyk9aygT/DFa4xilPmMpnLy3Qkg NcmoIcuaS2nb31LuBkdVAXOCTQ== X-Google-Smtp-Source: AB8JxZq3CvKGtZJyiw4rUvBrYtXQuAzYoYxlh4yBsx0rdqnmCfRhibmViGs38m3L7uBSNQ3T0GKWaQ== X-Received: by 2002:a24:220d:: with SMTP id o13-v6mr5395508ito.65.1527086573053; Wed, 23 May 2018 07:42:53 -0700 (PDT) Received: from [192.168.1.167] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id g1-v6sm1303710itg.27.2018.05.23.07.42.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 07:42:51 -0700 (PDT) Subject: Re: [PATCH RFC] sr: mark the device as changed when burning a CD To: Maurizio Lombardi Cc: linux-scsi@vger.kernel.org, bart.vanassche@wdc.com References: <1526980538-18707-1-git-send-email-mlombard@redhat.com> <954678cb-a3bb-135c-f55c-6d3d45eafbd9@redhat.com> From: Jens Axboe Message-ID: <56b93db8-921d-e243-390d-561ac93875f8@kernel.dk> Date: Wed, 23 May 2018 08:42:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <954678cb-a3bb-135c-f55c-6d3d45eafbd9@redhat.com> Content-Language: en-US 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 5/23/18 3:19 AM, Maurizio Lombardi wrote: > > > Dne 22.5.2018 v 16:47 Jens Axboe napsal(a): >> It's been many years, but back in the day the program writing the cd >> would eject the disc once done. This of course forces a reload of >> the toc and clearing of the flag. What program is this? Seems like >> it should probably eject when it's done. > > They are using wodim to burn the CDs on their servers. > The problem is that they do not want the CD to be ejected because their drives > lack a motorized tray, thus requiring manual intervention which they would like to avoid. I took a quick look at it, man that sr driver needs a bit of love :-) Anyway, I wonder if something like the below would work. Check for a close track command in the sr completion handler, and flag the media as changed if we see one. Totally untested... diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 3f3cb72e0c0c..48f0d7a096db 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -328,6 +328,9 @@ static int sr_done(struct scsi_cmnd *SCpnt) scmd_printk(KERN_INFO, SCpnt, "done: %x\n", result); #endif + if (SCpnt->cmnd[0] == GPCMD_CLOSE_TRACK) + cd->device->changed = 1; + /* * Handle MEDIUM ERRORs or VOLUME OVERFLOWs that indicate partial * success. Since this is a relatively rare error condition, no