From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751139AbdBKR7U (ORCPT ); Sat, 11 Feb 2017 12:59:20 -0500 Received: from ale.deltatee.com ([207.54.116.67]:42419 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750831AbdBKR7P (ORCPT ); Sat, 11 Feb 2017 12:59:15 -0500 To: Dan Williams , Greg Kroah-Hartman References: <1486754370-3057-1-git-send-email-logang@deltatee.com> <20170210201737.GA15397@kroah.com> <20170211071619.GA1345@kroah.com> Cc: Johannes Thumshirn , "Paul E. McKenney" , Sajjan Vikas C , Arnd Bergmann , Jan Kara , "linux-kernel@vger.kernel.org" , "linux-nvdimm@lists.01.org" From: Logan Gunthorpe Message-ID: Date: Sat, 11 Feb 2017 10:59:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 50.66.97.235 X-SA-Exim-Rcpt-To: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, jack@suse.cz, arnd@arndb.de, vikas.cha.sajjan@hpe.com, paulmck@linux.vnet.ibm.com, jthumshirn@suse.de, gregkh@linuxfoundation.org, dan.j.williams@intel.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH] device-dax: don't set kobj parent during cdev init X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/02/17 01:56 AM, Dan Williams wrote: > When the device is unregistered it invalidates all existing mappings, > but the driver may continue to service vm fault requests until the > final put of the cdev. Until that time the fault handler needs to be > able to check dax_dev->alive. Since the final cdev put is handled by > the vfs I use the cdev's kobject to keep the struct dax_dev instance > alive. I'm just taking a wild stab at this, but would it not make sense to just take a reference to the dax_dev device in dax_open and put it back it in dax_release? (Or perhaps, in the open/close of the vm_ops.) That way the structure won't be free'd until there are no users and alive will always be accessible. It would also be a bit more clear as to what's going on because you are actually making a reference in filp->private_data. Logan