diff options
author | tegge <tegge@FreeBSD.org> | 2006-01-09 20:42:19 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 2006-01-09 20:42:19 +0000 |
commit | d344c1186100b5323aefd8a08d585a95db5aa73c (patch) | |
tree | 63c09ce208013c75e9755db86cfe31120c538d27 /sys/ufs/ffs | |
parent | 4d88aab3ea1d28d6617480348f596c37389d6434 (diff) | |
download | FreeBSD-src-d344c1186100b5323aefd8a08d585a95db5aa73c.zip FreeBSD-src-d344c1186100b5323aefd8a08d585a95db5aa73c.tar.gz |
Add marker vnodes to ensure that all vnodes associated with the mount point are
iterated over when using MNT_VNODE_FOREACH.
Reviewed by: truckman
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 6 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 14 |
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index c64a1e3..355c19f 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -203,7 +203,7 @@ ffs_snapshot(mp, snapfile) struct nameidata nd; struct mount *wrtmp; struct vattr vat; - struct vnode *vp, *xvp, *nvp, *devvp; + struct vnode *vp, *xvp, *mvp, *devvp; struct uio auio; struct iovec aiov; struct snapdata *sn; @@ -485,7 +485,7 @@ restart: MNT_ILOCK(mp); mp->mnt_kern_flag &= ~MNTK_SUSPENDED; loop: - MNT_VNODE_FOREACH(xvp, mp, nvp) { + MNT_VNODE_FOREACH(xvp, mp, mvp) { VI_LOCK(xvp); MNT_IUNLOCK(mp); if ((xvp->v_iflag & VI_DOOMED) || @@ -506,6 +506,7 @@ loop: } if (vn_lock(xvp, LK_EXCLUSIVE | LK_INTERLOCK, td) != 0) { MNT_ILOCK(mp); + MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp); goto loop; } if (snapdebug) @@ -553,6 +554,7 @@ loop: free(copy_fs->fs_csp, M_UFSMNT); bawrite(sbp); sbp = NULL; + MNT_VNODE_FOREACH_ABORT(mp, mvp); goto out1; } MNT_ILOCK(mp); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 04c4dba..c6c6510 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -445,7 +445,7 @@ ffs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) static int ffs_reload(struct mount *mp, struct thread *td) { - struct vnode *vp, *nvp, *devvp; + struct vnode *vp, *mvp, *devvp; struct inode *ip; void *space; struct buf *bp; @@ -536,7 +536,7 @@ ffs_reload(struct mount *mp, struct thread *td) loop: MNT_ILOCK(mp); - MNT_VNODE_FOREACH(vp, mp, nvp) { + MNT_VNODE_FOREACH(vp, mp, mvp) { VI_LOCK(vp); if (vp->v_iflag & VI_DOOMED) { VI_UNLOCK(vp); @@ -547,6 +547,7 @@ loop: * Step 4: invalidate all cached file data. */ if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) { + MNT_VNODE_FOREACH_ABORT(mp, mvp); goto loop; } if (vinvalbuf(vp, 0, td, 0, 0)) @@ -561,6 +562,7 @@ loop: if (error) { VOP_UNLOCK(vp, 0, td); vrele(vp); + MNT_VNODE_FOREACH_ABORT(mp, mvp); return (error); } ffs_load_inode(bp, ip, fs, ip->i_number); @@ -1106,7 +1108,7 @@ ffs_sync(mp, waitfor, td) int waitfor; struct thread *td; { - struct vnode *nvp, *vp, *devvp; + struct vnode *mvp, *vp, *devvp; struct inode *ip; struct ufsmount *ump = VFSTOUFS(mp); struct fs *fs; @@ -1130,7 +1132,7 @@ ffs_sync(mp, waitfor, td) lockreq |= LK_INTERLOCK | LK_SLEEPFAIL; MNT_ILOCK(mp); loop: - MNT_VNODE_FOREACH(vp, mp, nvp) { + MNT_VNODE_FOREACH(vp, mp, mvp) { /* * Depend on the mntvnode_slock to keep things stable enough * for a quick test. Since there might be hundreds of @@ -1152,8 +1154,10 @@ loop: MNT_IUNLOCK(mp); if ((error = vget(vp, lockreq, td)) != 0) { MNT_ILOCK(mp); - if (error == ENOENT || error == ENOLCK) + if (error == ENOENT || error == ENOLCK) { + MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp); goto loop; + } continue; } if ((error = ffs_syncvnode(vp, waitfor)) != 0) |