public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.5.recent: device_remove_file() doesn't
@ 2003-03-27  3:53 David Brownell
  2003-03-27 17:58 ` Patrick Mochel
  0 siblings, 1 reply; 5+ messages in thread
From: David Brownell @ 2003-03-27  3:53 UTC (permalink / raw)
  To: linux-kernel, Patrick Mochel

I've noticed that recent kernels don't clean up device
attribute files correctly when they're removed.  Instead,
they're left in the directory with a refcount of zero.

That refcount stays even when the file is recreated later;
and the contents can be read.  Delete them again, and now
the refcount is 65535 ... though now reading the contents
may cause oopsing.

This worked correctly at some point last month:  the file
no longer appeared in sysfs after deletion.

Got Patch?

- Dave



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.5.recent: device_remove_file() doesn't
  2003-03-27  3:53 2.5.recent: device_remove_file() doesn't David Brownell
@ 2003-03-27 17:58 ` Patrick Mochel
  2003-03-27 20:04   ` Greg KH
  2003-03-27 23:34   ` David Brownell
  0 siblings, 2 replies; 5+ messages in thread
From: Patrick Mochel @ 2003-03-27 17:58 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-kernel, greg, andmike


On Wed, 26 Mar 2003, David Brownell wrote:

> I've noticed that recent kernels don't clean up device
> attribute files correctly when they're removed.  Instead,
> they're left in the directory with a refcount of zero.
> 
> That refcount stays even when the file is recreated later;
> and the contents can be read.  Delete them again, and now
> the refcount is 65535 ... though now reading the contents
> may cause oopsing.
> 
> This worked correctly at some point last month:  the file
> no longer appeared in sysfs after deletion.
> 
> Got Patch?

Yeah, and I apologize. File deletion has been causing some problems 
lately due to some bad assumptions of the dentry layer. This patch reverts 
a small bit of the patch that went in a couple of weeks ago, and should 
hopefully fix everything up. 

This should also take care of the problem that some have been seeing of 
symlinks not going away on device/module removal (though I've been unable 
to reproduce those). 

Greg/Mike, could you give this patch a shot and let me know if helps?

Thanks,


	-pat

===== fs/sysfs/inode.c 1.84 vs edited =====
--- 1.84/fs/sysfs/inode.c	Tue Mar 11 15:30:18 2003
+++ edited/fs/sysfs/inode.c	Thu Mar 27 11:53:44 2003
@@ -97,7 +97,7 @@
 				 atomic_read(&victim->d_count));
 
 			simple_unlink(dir->d_inode,victim);
-
+			d_delete(victim);
 		}
 		/*
 		 * Drop reference from sysfs_get_dentry() above.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.5.recent: device_remove_file() doesn't
  2003-03-27 17:58 ` Patrick Mochel
@ 2003-03-27 20:04   ` Greg KH
  2003-03-27 22:37     ` Mike Anderson
  2003-03-27 23:34   ` David Brownell
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2003-03-27 20:04 UTC (permalink / raw)
  To: Patrick Mochel; +Cc: David Brownell, linux-kernel, andmike

On Thu, Mar 27, 2003 at 11:58:14AM -0600, Patrick Mochel wrote:
> 
> Greg/Mike, could you give this patch a shot and let me know if helps?

Yes, this seems to fix the symlink problem I was seeing before, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.5.recent: device_remove_file() doesn't
  2003-03-27 20:04   ` Greg KH
@ 2003-03-27 22:37     ` Mike Anderson
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Anderson @ 2003-03-27 22:37 UTC (permalink / raw)
  To: Greg KH; +Cc: Patrick Mochel, David Brownell, linux-kernel

Greg KH [greg@kroah.com] wrote:
> On Thu, Mar 27, 2003 at 11:58:14AM -0600, Patrick Mochel wrote:
> > 
> > Greg/Mike, could you give this patch a shot and let me know if helps?
> 
> Yes, this seems to fix the symlink problem I was seeing before, thanks.
> 

It has also fixed my symlink issue.

thanks,

-andmike
--
Michael Anderson
andmike@us.ibm.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.5.recent: device_remove_file() doesn't
  2003-03-27 17:58 ` Patrick Mochel
  2003-03-27 20:04   ` Greg KH
@ 2003-03-27 23:34   ` David Brownell
  1 sibling, 0 replies; 5+ messages in thread
From: David Brownell @ 2003-03-27 23:34 UTC (permalink / raw)
  To: Patrick Mochel; +Cc: linux-kernel, greg, andmike

Thanks, it resolved that problem.

- Dave


> --- 1.84/fs/sysfs/inode.c	Tue Mar 11 15:30:18 2003
> +++ edited/fs/sysfs/inode.c	Thu Mar 27 11:53:44 2003
> @@ -97,7 +97,7 @@
>  				 atomic_read(&victim->d_count));
>  
>  			simple_unlink(dir->d_inode,victim);
> -
> +			d_delete(victim);
>  		}
>  		/*
>  		 * Drop reference from sysfs_get_dentry() above.
> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-27 23:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-27  3:53 2.5.recent: device_remove_file() doesn't David Brownell
2003-03-27 17:58 ` Patrick Mochel
2003-03-27 20:04   ` Greg KH
2003-03-27 22:37     ` Mike Anderson
2003-03-27 23:34   ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox