Bug 81588 - [kernel] [patch] Devices with SI_CHEAPCLONE flag don't seem to go away when they're no longer used in -current
Summary: [kernel] [patch] Devices with SI_CHEAPCLONE flag don't seem to go away when t...
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 6.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Kyle Evans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-28 14:50 UTC by Antoine Brodin
Modified: 2019-10-06 02:09 UTC (History)
2 users (show)

See Also:


Attachments
patch.txt (1.24 KB, text/plain)
2005-06-25 15:06 UTC, Antoine Brodin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Brodin 2005-05-28 14:50:01 UTC
On freebsd 5, when you use a lot of bpf(4), and you stop using them, and
then you run something like /etc/periodic/weekly/310.locate , the bpf(4)
go away.
On -current, this doesn't seem to work anymore.

Fix: 

I don't have a fix, but revision 1.172 of kern/kern_conf.c looks suspect,
especially the lines:
%%%
+	if (dev->si_usecount == 0 &&
+	    (dev->si_flags & SI_CHEAPCLONE) && (dev->si_flags & SI_NAMED))
 	if (dev->si_devsw == NULL && dev->si_refcount == 0) {
 		LIST_REMOVE(dev, si_list);
 		flag = 1;
%%%
The indentation suggests that a line is missing...
How-To-Repeat: Use something like this:
#!/usr/bin/env perl
my $i;
my $s;
for ($i = 0; $i < 1000; $i++) {
	$s = "/dev/bpf".$i;
	system "ls $s";
}

and then run /etc/periodic/weekly/310.locate , the devices don't go away.
Comment 1 Robert Watson freebsd_committer freebsd_triage 2005-05-29 16:29:57 UTC
Responsible Changed
From-To: freebsd-bugs->phk

This sounds like it's in phk's areas of interest.
Comment 2 Antoine Brodin 2005-06-25 15:06:44 UTC
The attached patch seems to do the trick.
However I don't unterstand all the code so it probably needs a good
review.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2011-09-24 18:44:27 UTC
Responsible Changed
From-To: phk->freebsd-bugs

return to the pool (approved by phk)
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:52 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 5 Kyle Evans freebsd_committer freebsd_triage 2019-10-06 02:09:12 UTC
Take; closed as "overcome by events" -- the last instance of an SI_CHEAPCLONE device I could find was 2010 and I've since axed SI_CHEAPCLONE entirely, so it's safe to say this isn't a problem in any stable branch or head.