linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Greg KH <greg@kroah.com>
Cc: Kernel development list <linux-kernel@vger.kernel.org>,
	Patrick Mochel <mochel@digitalimplant.org>
Subject: Re: Inconsistency in sysfs behavior?
Date: Wed, 7 Jan 2004 17:24:08 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.0401071712550.1589-100000@ida.rowland.org> (raw)
In-Reply-To: <20040107215624.GC1083@kroah.com>

On Wed, 7 Jan 2004, Greg KH wrote:

> On Wed, Jan 07, 2004 at 04:50:24PM -0500, Alan Stern wrote:
> > 
> > I had in mind approaching this the opposite way.  Instead of trying to 
> > make open directories also pin a kobject, why not make open attribute 
> > files not pin them?
> > 
> > It shouldn't be hard to avoid any errors; in fact I had a patch from some
> > time ago that would do the trick (although in a hacked-up kind of way).  
> > The main idea is to return -ENXIO instead of calling the show()/store()
> > routines once the attribute has been removed.
> 
> And you can do this without adding another lock, race free?

I used dentry->d_inode->i_sem.  While I'm not very familiar with the ins
and outs of the filesystem code, that ought to be safe enough.

The real problem was finding a way to indicate that the file was
disconnected from its kobject.  I did that by setting
dentry->d_inode->i_mode to 0.  (I didn't want to erase dentry->d_fsdata
for fear that it might be needed somewhere else.)  That's definitely not a
good way; it was intended only for my proof-of-principle.  No doubt
someone else could do a much better job.

Alan Stern


  reply	other threads:[~2004-01-07 22:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 15:48 Inconsistency in sysfs behavior? Alan Stern
2004-01-07 17:27 ` Greg KH
2004-01-07 21:50   ` Alan Stern
2004-01-07 21:56     ` Greg KH
2004-01-07 22:24       ` Alan Stern [this message]
2004-01-07 22:34         ` Greg KH
2004-01-08 10:32   ` Maneesh Soni
2004-01-08 20:19     ` Greg KH
2004-01-09  4:56       ` Maneesh Soni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44L0.0401071712550.1589-100000@ida.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@digitalimplant.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).