From patchwork Thu Jan 18 16:22:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 10173679 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 DF15F603B5 for ; Thu, 18 Jan 2018 16:23:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D76A428173 for ; Thu, 18 Jan 2018 16:23:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA64328329; Thu, 18 Jan 2018 16:23:00 +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,DKIM_SIGNED, DKIM_VALID,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 E3CD828173 for ; Thu, 18 Jan 2018 16:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933517AbeARQW6 (ORCPT ); Thu, 18 Jan 2018 11:22:58 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36641 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933388AbeARQWn (ORCPT ); Thu, 18 Jan 2018 11:22:43 -0500 Received: by mail-wr0-f193.google.com with SMTP id d9so23156258wre.3 for ; Thu, 18 Jan 2018 08:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=WK/XiPyJYMi3Ja7WVFtgqGZm+0mlkIumIn6c97+0u5o=; b=Npm8X/Ws/mVXu/zAYfXKXplzjPvWJ5fT2CabJIIa04XSV9p/ktByDN/YlDcyBRjWHR kcGy3A/7dAt02i4Dkr+qOCNOb51hl68COVWFm4OrOF8F5Ww3XMl+R1elds5tOD8NHIc+ /8bb9Bvph5U/5MOvjmETlQFUY24SpDjqxfyeNHhvoOLccemZi+Rw5/jGWP621Xk10jkk wO8Y6gxPpwQ7i/4cROo0x+J0ttvphtwvLPQvPg8WXzP5v4n4qoGHd8OZVd2R3OMpHUFA 1rZzJzV+sxdGNOoJw1uIZQ5RehUnocbAiujBt0xK/UgboaprSeJ3KN8VeigB0G9JG9ER e6zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WK/XiPyJYMi3Ja7WVFtgqGZm+0mlkIumIn6c97+0u5o=; b=DH9f8kMLV7XoqiEcHqI2eOQIA8tEJL/lG+Ceq+xi1WHUY8bJLdkv+xAWerhojRlEiT T//DDo6AvJC1MVNQ4dgqa8+InT4NgxpfrLFsSqNa4W/THcneBvXXFifONC1kQsmDvrBD sazIY4bog5CsL4Q8NHWHXgQWjeoAe+Qqlodr0GK/7nvr7O+w7PRsdMUJk0CN/Pkjbu+l +kAxtg0fgHmXduV9YGDfvm7crVigYHJTpEv6tmnOn1O4gLWMKafwNdIGMFP5J+jOQT0r j/09APZ82dplmaxQlNSs/mMMkxbcMV3uQ3uNbmA1ZfK5UultFbfJPUle4qSwofN544Ko uCTg== X-Gm-Message-State: AKwxytd1b86M0vBjz2PRg1qC0HDZyytHP+A0q8DyGZYjBPrZmafv/OBh odbGLkZiMWS3GOw8qqftd84s1g== X-Google-Smtp-Source: ACJfBosejxNRiohIE4cDZs5s7fg273GLcWDLlAHsrTVsMhIL+Qmw+e+9tLXm7PrDps0+YB0WCWp99g== X-Received: by 10.223.153.103 with SMTP id x94mr7208876wrb.210.1516292562198; Thu, 18 Jan 2018 08:22:42 -0800 (PST) Received: from jinpu-GA-870A-USB3.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id x203sm18988074wmd.11.2018.01.18.08.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Jan 2018 08:22:41 -0800 (PST) From: Jack Wang X-Google-Original-From: Jack Wang To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, gi-oh.kim@profitbricks.com, Jack Wang Subject: [PATCH] sd: succeed check_event if device is not removable Date: Thu, 18 Jan 2018 17:22:39 +0100 Message-Id: <1516292559-26649-1-git-send-email-jinpu.wangl@profitbricks.com> X-Mailer: git-send-email 2.7.4 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 From: Jack Wang The check_events interface was added for check if device changes, mainly for device is removable eg. CDROM In sd_open, it checks if device is removable then check_disk_change. when the device is not removable, we can simple succeeds the call without send TUR. Signed-off-by: Jack Wang --- drivers/scsi/sd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ab75ebd..773ce81 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1576,6 +1576,10 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) sdp = sdkp->device; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n")); + if (!sdp->removable) { + retval = 0; + goto out; + } /* * If the device is offline, don't send any commands - just pretend as * if the command failed. If the device ever comes back online, we