public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Maneesh Soni <maneesh@in.ibm.com>,
	gregkh@suse.com, linux-usb-devel@lists.sourceforge.net,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: race in sysfs between sysfs_remove_file() and read()/write() #2
Date: Mon, 4 Dec 2006 17:35:13 +0100	[thread overview]
Message-ID: <200612041735.13615.oliver@neukum.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0612041101410.3606-100000@iolanthe.rowland.org>

Am Montag, 4. Dezember 2006 17:06 schrieb Alan Stern:
> On Mon, 4 Dec 2006, Maneesh Soni wrote:
> 
> > hmm, I guess Greg has to say the final word. The question is either to fail
> > the IO (-ENODEV) or fail the file removal (-EBUSY). If we are not going to
> > fail the removal then your patch is the way to go.
> > 
> > Greg?
> 
> Oliver is right that we cannot allow device_remove_file() to fail.  In 
> fact we can't even allow it to block until all the existing open file 
> references are closed.

Yes, we must have an upper bound with respect to time.

> Our major questions have to do with the details of the patch itself.  In 
> particular, we are worried about possible races with the VFS and the 
> handling of the inode's usage count.  Can you examine the patch carefully 
> to see if it is okay?
> 
> Also, Oliver, it looks like the latest version of your patch makes an 
> unnecessary change to sysfs_remove_file().

Code like:

int d(int a, int b)
{
	return a + b;
}

int c(int a, int b)
{
	return d(a, b);
}

is a detrimental to correct understanding and thence coding.
In fact reading sysfs source code is like jumping all around the kernel
tree. Such changes made it readable by normal people. I have to
understand which method I am coding on to do reasonable work. ;-)

	Regards
		Oliver

  reply	other threads:[~2006-12-04 16:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-01 22:43 race in sysfs between sysfs_remove_file() and read()/write() #2 Oliver Neukum
2006-12-04  4:43 ` Maneesh Soni
2006-12-04  6:38   ` Oliver Neukum
2006-12-04 13:04     ` Maneesh Soni
2006-12-04 13:58       ` Oliver Neukum
2006-12-04 16:06       ` Alan Stern
2006-12-04 16:35         ` Oliver Neukum [this message]
2006-12-04 16:57           ` Alan Stern
2006-12-04 17:34             ` Oliver Neukum
2006-12-11 10:43         ` Maneesh Soni
2006-12-11 23:05           ` Greg KH
2006-12-04 18:47       ` Greg KH

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=200612041735.13615.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=gregkh@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=maneesh@in.ibm.com \
    --cc=stern@rowland.harvard.edu \
    /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