diff options
author | kmacy <kmacy@FreeBSD.org> | 2010-04-30 19:40:37 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2010-04-30 19:40:37 +0000 |
commit | 6b22e476a5f920709982cdffed9a2e1b33e847fc (patch) | |
tree | 2819c51d62e6b7ae908afc2841ebe4de8480933a /sys/vm | |
parent | f69bf5326357c99ff7f751d0671bc2ecce5e0664 (diff) | |
download | FreeBSD-src-6b22e476a5f920709982cdffed9a2e1b33e847fc.zip FreeBSD-src-6b22e476a5f920709982cdffed9a2e1b33e847fc.tar.gz |
- don't check hold_count without the page lock held
- don't leak the page lock if m->object is NULL
(assuming that that check will in fact even be valid when m->object is protected by the page lock)
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_pageout.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 95517de..73c51b3 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -775,16 +775,17 @@ rescan0: if (m->flags & PG_MARKER) continue; - /* - * A held page may be undergoing I/O, so skip it. - */ - if (m->hold_count) { - vm_page_requeue(m); + if (!vm_page_trylock(m)) { addl_page_shortage++; continue; } - if (!vm_page_trylock(m) || (object = m->object) == NULL) { + /* + * A held page may be undergoing I/O, so skip it. + */ + if (m->hold_count || (object = m->object) == NULL) { + vm_page_unlock(m); + vm_page_requeue(m); addl_page_shortage++; continue; } |