From patchwork Fri Jun 16 12:48:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maurizio Lombardi X-Patchwork-Id: 9791443 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 7AE926038E for ; Fri, 16 Jun 2017 12:49:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AB5228630 for ; Fri, 16 Jun 2017 12:49:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FA702863A; Fri, 16 Jun 2017 12:49:01 +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=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 0E20E2863B for ; Fri, 16 Jun 2017 12:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753673AbdFPMs7 (ORCPT ); Fri, 16 Jun 2017 08:48:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59062 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753265AbdFPMs5 (ORCPT ); Fri, 16 Jun 2017 08:48:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0623FC04B941; Fri, 16 Jun 2017 12:48:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0623FC04B941 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mlombard@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0623FC04B941 Received: from [10.40.204.75] (ovpn-204-75.brq.redhat.com [10.40.204.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C3949CB61; Fri, 16 Jun 2017 12:48:51 +0000 (UTC) Subject: Re: [RFC] enclosure: fix sysfs symlinks creation when using multipath To: Douglas Miller , jejb@linux.vnet.ibm.com References: <1486476528-27580-2-git-send-email-mlombard@redhat.com> <12b5fa7f-3799-1223-db06-c233da3e7c33@linux.vnet.ibm.com> Cc: linux-scsi@vger.kernel.org From: Maurizio Lombardi Message-ID: Date: Fri, 16 Jun 2017 14:48:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <12b5fa7f-3799-1223-db06-c233da3e7c33@linux.vnet.ibm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 16 Jun 2017 12:48:52 +0000 (UTC) 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 Dne 16.6.2017 v 14:40 Douglas Miller napsal(a): > > I'd like to add that we are seeing this problem with singlepath installations and need to get this fixed upstream as soon as possible. RHEL new product contains this fix and is working for us, but we need to be able to offer other distros as well. I am currently running this patch on a custom-built Ubuntu 16.04.2 kernel and it is fixing the problem there. > > What needs to be done to get this patch accepted? > Note that James proposed a different patch to fix this bug. diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 65fed71..ae89082 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -375,6 +375,7 @@ int enclosure_add_device(struct enclosure_device *edev, int component, struct device *dev) { struct enclosure_component *cdev; + int err; if (!edev || component >= edev->components) return -EINVAL; @@ -384,12 +385,15 @@ int enclosure_add_device(struct enclosure_device *edev, int component, if (cdev->dev == dev) return -EEXIST; - if (cdev->dev) + if (cdev->dev) { enclosure_remove_links(cdev); - - put_device(cdev->dev); - cdev->dev = get_device(dev); - return enclosure_add_links(cdev); + put_device(cdev->dev); + cdev->dev = NULL; + } + err = enclosure_add_links(cdev); + if (!err) + cdev->dev = get_device(dev); + return err; } EXPORT_SYMBOL_GPL(enclosure_add_device);