Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1080170ybh; Mon, 13 Jul 2020 08:53:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1MdVrwfnOSb+a/Hf1vnkBrKDk1scO38vKC/aQBgJOidaF0ZhxDPZQRfE1zh9NSMefStpN X-Received: by 2002:a50:a451:: with SMTP id v17mr66941edb.256.1594655603730; Mon, 13 Jul 2020 08:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594655603; cv=none; d=google.com; s=arc-20160816; b=D29nbQHq5TKtY86Q0WRZcX2iMmATBQTBCL6TXhDJgAHpEppc4jwBLspyi2sGkNZgtM pTiutwS4ILhxeMoTXoA2TMzeWIXo4AQ5Jq5D+kYLQM5vJ7dc9glCjGVnS59pyzT34CM/ NwU1m6SWKZ+gIwfwSyXRJGemHpj5gENkWVUumWXHSSAL0yVJDcbgFxFH/iP+RMKRyK1V iv8Mg2L2+st191FM9X0m0nTxhfaaAjU6lSYyWZtMgfOX65ea+ghcMZB3hPu9CRhLvlnq fuUtJugmWTf0JTwKBt6USYXipc0I8TJKxjTQPdLM/mFQZqVD+H9i7gfix1R+yyjMgtt5 jOGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jQ/6vjrJXBmC8nNFfwxbEiOo6btJ3MEAoF+uPsMoDyw=; b=yKTPbkEqq+yOsZybLcN/8qKER+0jrqhwktLNWn11qHcIQ7btjYaUUQ1FxFx1UX1UlO zQVlFIUuhQ2SzZjiYmFNtfLEvIdVazOaUlVlm0mELCMZYwL471BNJ8c/ucRZdrBNpdbf vHea0nJdEzC6lcvpHQEvEH5F1LOP2mfVuF6gBW3G8oy6/DwSRVAmgT7O5F5WakjnwNf6 mSK21uzVnwsdTeN0hOuY1gqn6O5Bi4WnW8i/o/1dDwJQbvAPu3BkcjXpDakv+hiQ/qRY 2AWQ7nJD1m6bvn6VMe+HqFsPK6Mptbg3shkMNVeW22smMoALWD6QeStkB4PoUjr801Ib vPyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wl1NZRBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d19si9665777ejt.396.2020.07.13.08.53.00; Mon, 13 Jul 2020 08:53:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wl1NZRBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730234AbgGMPwY (ORCPT + 99 others); Mon, 13 Jul 2020 11:52:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:45302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729593AbgGMPwX (ORCPT ); Mon, 13 Jul 2020 11:52:23 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE59D20663; Mon, 13 Jul 2020 15:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594655542; bh=Hcixoq4GgPe0VCO4s6wUL8CqrZev3dIhKbWRkkOIrHc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wl1NZRBGSi7cAVo8NztdIgBUgTQWNZEa4wL/fa93EpRcWtMHAVzi3ljykDEsPT7wY BSBmd7lLUo8a3wfMaWGkV93gEjLWGvbSbLjl6M/KlXZmAT7YEM7cfQHpIRkS5IlY1V vqCxN5LtjDOFOi7FWjtCOOK9yB+Z9NghG6kRstTs= Date: Mon, 13 Jul 2020 17:52:22 +0200 From: Greg Kroah-Hartman To: Dan Williams Cc: linux-nvdimm , "Rafael J. Wysocki" , Peter Zijlstra , Vishal L Verma , Dave Hansen , Ard Biesheuvel , Linux MM , Linux Kernel Mailing List , Linux ACPI , Christoph Hellwig , Joao Martins Subject: Re: [PATCH v2 17/22] drivers/base: Make device_find_child_by_name() compatible with sysfs inputs Message-ID: <20200713155222.GB267581@kroah.com> References: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> <159457125753.754248.6000936585361264069.stgit@dwillia2-desk3.amr.corp.intel.com> <20200712170945.GA194499@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 13, 2020 at 08:39:43AM -0700, Dan Williams wrote: > On Sun, Jul 12, 2020 at 10:09 AM Greg Kroah-Hartman > wrote: > > > > On Sun, Jul 12, 2020 at 09:27:37AM -0700, Dan Williams wrote: > > > Use sysfs_streq() in device_find_child_by_name() to allow it to use a > > > sysfs input string that might contain a trailing newline. > > > > > > The other "device by name" interfaces, > > > {bus,driver,class}_find_device_by_name(), already account for sysfs > > > strings. > > > > > > Cc: Greg Kroah-Hartman > > > Cc: "Rafael J. Wysocki" > > > Signed-off-by: Dan Williams > > > --- > > > drivers/base/core.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/base/core.c b/drivers/base/core.c > > > index 67d39a90b45c..5d31b962c898 100644 > > > --- a/drivers/base/core.c > > > +++ b/drivers/base/core.c > > > @@ -3078,7 +3078,7 @@ struct device *device_find_child_by_name(struct device *parent, > > > > > > klist_iter_init(&parent->p->klist_children, &i); > > > while ((child = next_device(&i))) > > > - if (!strcmp(dev_name(child), name) && get_device(child)) > > > + if (sysfs_streq(dev_name(child), name) && get_device(child)) > > > > Who wants to call this function with a name passed from userspace? > > > > Not objecting to it, just curious... > > > > The series that incorporates this patch adds a partitioning mechanism > to "device-dax region" devices with an: > "echo 1 > regionX/create" to create a new partition / sub-instance > of a region, and... > "echo $devname > regionX/delete" to delete. Where $devname is > searched in the child devices of regionX to trigger device_del(). Shouldn't that be done in configfs, not sysfs? > This arrangement avoids one of the design mistakes of libnvdimm which > uses a sysfs attribute of the device to delete itself. Parent-device > triggered deletion rather than self-deletion avoids those locking > entanglements. Ugh, yeah, getting rid of that would be great, it's a mess. I think scsi still does that :( thanks, greg k-h