Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156833264
D3547.id8462.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D3547.id8462.diff
View Options
Index: sys/vm/swap_pager.c
===================================================================
--- sys/vm/swap_pager.c
+++ sys/vm/swap_pager.c
@@ -2548,7 +2548,7 @@
bp->b_error = bp2->bio_error;
bufdone(bp);
mtx_lock(&sw_dev_mtx);
- if ((--cp->index) == 0 && cp->private) {
+ if ((--cp->index) == 0) {
if (g_post_event(swapgeom_close_ev, cp, M_NOWAIT, NULL) == 0) {
sp = bp2->bio_caller1;
sp->sw_id = NULL;
@@ -2573,6 +2573,8 @@
bufdone(bp);
return;
}
+ KASSERT(cp->index,
+ ("Reference count in swapgeom consumer impossibly zero."));
cp->index++;
mtx_unlock(&sw_dev_mtx);
if (bp->b_iocmd == BIO_WRITE)
@@ -2580,6 +2582,9 @@
else
bio = g_alloc_bio();
if (bio == NULL) {
+ mtx_lock(&sw_dev_mtx);
+ --cp->index;
+ mtx_unlock(&sw_dev_mtx);
bp->b_error = ENOMEM;
bp->b_ioflags |= BIO_ERROR;
bufdone(bp);
@@ -2619,7 +2624,7 @@
break;
}
}
- cp->private = (void *)(uintptr_t)1;
+ --cp->index; /* Drop reference we were created with */
destroy = ((sp != NULL) && (cp->index == 0));
if (destroy)
sp->sw_id = NULL;
@@ -2680,8 +2685,8 @@
if (gp == NULL)
gp = g_new_geomf(&g_swap_class, "swap");
cp = g_new_consumer(gp);
- cp->index = 0; /* Number of active I/Os. */
- cp->private = NULL; /* Orphanization flag */
+ cp->index = 1; /* Number of active I/Os, plus one for being active. */
+ cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
g_attach(cp, pp);
/*
* XXX: Everytime you think you can improve the margin for
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 17, 7:14 PM (22 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33203979
Default Alt Text
D3547.id8462.diff (1 KB)
Attached To
Mode
D3547: Mark swapgeom as direct dispatch safe and fix a reference leak
Attached
Detach File
Event Timeline
Log In to Comment