diff options
author | kib <kib@FreeBSD.org> | 2012-12-15 02:04:46 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-12-15 02:04:46 +0000 |
commit | 28185626518e530030999ed40cd3ea13edef36ec (patch) | |
tree | a136bb234fe92827d58aaf8382222710263f4f8d /sys/sys/mount.h | |
parent | d0ab51105c0d16258a5cc784fe2c56b90f54e297 (diff) | |
download | FreeBSD-src-28185626518e530030999ed40cd3ea13edef36ec.zip FreeBSD-src-28185626518e530030999ed40cd3ea13edef36ec.tar.gz |
When mnt_vnode_next_active iterator cannot lock the next vnode and
yields, specify the user priority for the yield. Otherwise, a
higher-priority (kernel) thread could fall into the priority-inversion
with the thread owning the mutex lock.
On single-processor machines or UP kernels, do not loop adaptively
when the next vnode cannot be locked, instead yield unconditionally.
Restructure the iteration initializer and the iterator to remove code
duplication. Put the code to fetch and lock a vnode next to the
current marker, into the mnt_vnode_next_active() function, and use it
instead of repeating the loop.
Reported by: hrs, rmacklem
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Diffstat (limited to 'sys/sys/mount.h')
-rw-r--r-- | sys/sys/mount.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 6f333a3..ed2b002 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -218,17 +218,12 @@ struct vnode *__mnt_vnode_next_active(struct vnode **mvp, struct mount *mp); struct vnode *__mnt_vnode_first_active(struct vnode **mvp, struct mount *mp); void __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *); -#define MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) \ - for (vp = __mnt_vnode_first_active(&(mvp), (mp)); \ +#define MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) \ + for (vp = __mnt_vnode_first_active(&(mvp), (mp)); \ (vp) != NULL; vp = __mnt_vnode_next_active(&(mvp), (mp))) #define MNT_VNODE_FOREACH_ACTIVE_ABORT(mp, mvp) \ - do { \ - MNT_ILOCK(mp); \ - __mnt_vnode_markerfree_active(&(mvp), (mp)); \ - /* MNT_IUNLOCK(mp); -- done in above function */ \ - mtx_assert(MNT_MTX(mp), MA_NOTOWNED); \ - } while (0) + __mnt_vnode_markerfree_active(&(mvp), (mp)) /* * Definitions for MNT_VNODE_FOREACH. |