diff options
author | kib <kib@FreeBSD.org> | 2012-10-22 17:50:54 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-10-22 17:50:54 +0000 |
commit | 560aa751e0f5cfef868bdf3fab01cdbc5169ef82 (patch) | |
tree | 6e9ef0a47c5e91d26227820c50c9767e84550821 /sys/ufs | |
parent | ca71b68ea40c83f641d6485e027368568f244197 (diff) | |
download | FreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.zip FreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.tar.gz |
Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the
filesystem module, remove the VFS_LOCK_GIANT() and related
macros. Stop handling buffers belonging to non-mpsafe filesystems.
The VFS_VERSION is bumped to indicate the interface change which does
not result in the interface signatures changes.
Conducted and reviewed by: attilio
Tested by: pho
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 14 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 5 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_quota.c | 29 |
3 files changed, 6 insertions, 42 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index a7378b6..ba5b997 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -2465,7 +2465,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) long blkcnt, blksize; struct filedesc *fdp; struct file *fp, *vfp; - int vfslocked, filetype, error; + int filetype, error; static struct fileops *origops, bufferedops; if (req->newlen > sizeof cmd) @@ -2670,23 +2670,18 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) #endif /* DEBUG */ if ((error = ffs_vget(mp, (ino_t)cmd.value, LK_SHARED, &vp))) break; - vfslocked = VFS_LOCK_GIANT(vp->v_mount); AUDIT_ARG_VNODE1(vp); if ((error = change_dir(vp, td)) != 0) { vput(vp); - VFS_UNLOCK_GIANT(vfslocked); break; } VOP_UNLOCK(vp, 0); - VFS_UNLOCK_GIANT(vfslocked); fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); vpold = fdp->fd_cdir; fdp->fd_cdir = vp; FILEDESC_XUNLOCK(fdp); - vfslocked = VFS_LOCK_GIANT(vpold->v_mount); vrele(vpold); - VFS_UNLOCK_GIANT(vfslocked); break; case FFS_SET_DOTDOT: @@ -2759,7 +2754,6 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) #endif /* DEBUG */ if ((error = ffs_vget(mp, (ino_t)cmd.value, LK_EXCLUSIVE, &vp))) break; - vfslocked = VFS_LOCK_GIANT(vp->v_mount); AUDIT_ARG_VNODE1(vp); ip = VTOI(vp); if (ip->i_ump->um_fstype == UFS1) @@ -2770,13 +2764,11 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) sizeof(struct ufs2_dinode)); if (error) { vput(vp); - VFS_UNLOCK_GIANT(vfslocked); break; } ip->i_flag |= IN_CHANGE | IN_MODIFIED; error = ffs_update(vp, 1); vput(vp); - VFS_UNLOCK_GIANT(vfslocked); break; case FFS_SET_BUFOUTPUT: @@ -2853,7 +2845,7 @@ buffered_write(fp, uio, active_cred, flags, td) struct inode *ip; struct buf *bp; struct fs *fs; - int error, vfslocked; + int error; daddr_t lbn; /* @@ -2868,7 +2860,6 @@ buffered_write(fp, uio, active_cred, flags, td) return (EINVAL); fs = ip->i_fs; foffset_lock_uio(fp, uio, flags); - vfslocked = VFS_LOCK_GIANT(ip->i_vnode->v_mount); vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); #ifdef DEBUG if (fsckcmds) { @@ -2896,7 +2887,6 @@ buffered_write(fp, uio, active_cred, flags, td) error = bwrite(bp); out: VOP_UNLOCK(devvp, 0); - VFS_UNLOCK_GIANT(vfslocked); foffset_unlock_uio(fp, uio, flags | FOF_NEXTOFF); return (error); } diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 97b3273..c14af04 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1338,14 +1338,12 @@ softdep_flush(void) struct thread *td; int remaining; int progress; - int vfslocked; td = curthread; td->td_pflags |= TDP_NORUNNINGBUF; for (;;) { kproc_suspend_check(softdepproc); - vfslocked = VFS_LOCK_GIANT((struct mount *)NULL); ACQUIRE_LOCK(&lk); /* * If requested, try removing inode or removal dependencies. @@ -1361,7 +1359,6 @@ softdep_flush(void) wakeup_one(&proc_waiting); } FREE_LOCK(&lk); - VFS_UNLOCK_GIANT(vfslocked); remaining = progress = 0; mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { @@ -1370,11 +1367,9 @@ softdep_flush(void) continue; if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) continue; - vfslocked = VFS_LOCK_GIANT(mp); progress += softdep_process_worklist(mp, 0); ump = VFSTOUFS(mp); remaining += ump->softdep_on_worklist; - VFS_UNLOCK_GIANT(vfslocked); mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); vfs_unbusy(mp); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index d353167..330f449 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -497,7 +497,7 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) struct vnode *vp, **vpp; struct vnode *mvp; struct dquot *dq; - int error, flags, vfslocked; + int error, flags; struct nameidata nd; error = priv_check(td, PRIV_UFS_QUOTAON); @@ -510,7 +510,7 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) ump = VFSTOUFS(mp); dq = NODQUOT; - NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_USERSPACE, fname, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, td); flags = FREAD | FWRITE; vfs_ref(mp); vfs_unbusy(mp); @@ -519,7 +519,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) vfs_rel(mp); return (error); } - vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; error = vfs_busy(mp, MBF_NOWAIT); @@ -533,7 +532,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) if (error != 0) { VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -542,7 +540,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) UFS_UNLOCK(ump); VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); vfs_unbusy(mp); return (EALREADY); } @@ -554,7 +551,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) ump->um_qflags[type] &= ~(QTF_OPENING|QTF_CLOSING); UFS_UNLOCK(ump); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); vfs_unbusy(mp); return (error); } @@ -571,7 +567,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) vp->v_vflag |= VV_SYSTEM; VOP_UNLOCK(vp, 0); *vpp = vp; - VFS_UNLOCK_GIANT(vfslocked); /* * Save the credential of the process that turned on quotas. * Set up the time limits for this quota. @@ -643,7 +638,6 @@ quotaoff1(struct thread *td, struct mount *mp, int type) struct dquot *dq; struct inode *ip; struct ucred *cr; - int vfslocked; int error; ump = VFSTOUFS(mp); @@ -689,12 +683,10 @@ again: ump->um_cred[type] = NOCRED; UFS_UNLOCK(ump); - vfslocked = VFS_LOCK_GIANT(qvp->v_mount); vn_lock(qvp, LK_EXCLUSIVE | LK_RETRY); qvp->v_vflag &= ~VV_SYSTEM; VOP_UNLOCK(qvp, 0); error = vn_close(qvp, FREAD|FWRITE, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); crfree(cr); return (error); @@ -1246,7 +1238,7 @@ dqget(struct vnode *vp, u_long id, struct ufsmount *ump, int type, struct vnode *dqvp; struct iovec aiov; struct uio auio; - int vfslocked, dqvplocked, error; + int dqvplocked, error; #ifdef DEBUG_VFS_LOCKS if (vp != NULLVP) @@ -1292,12 +1284,10 @@ hfound: DQI_LOCK(dq); error = EIO; } *dqp = dq; - vfslocked = VFS_LOCK_GIANT(dqvp->v_mount); if (dqvplocked) vput(dqvp); else vrele(dqvp); - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -1350,12 +1340,10 @@ hfound: DQI_LOCK(dq); DQH_UNLOCK(); tablefull("dquot"); *dqp = NODQUOT; - vfslocked = VFS_LOCK_GIANT(dqvp->v_mount); if (dqvplocked) vput(dqvp); else vrele(dqvp); - VFS_UNLOCK_GIANT(vfslocked); return (EUSERS); } if (dq->dq_cnt || (dq->dq_flags & DQ_MOD)) @@ -1398,7 +1386,6 @@ hfound: DQI_LOCK(dq); auio.uio_rw = UIO_READ; auio.uio_td = (struct thread *)0; - vfslocked = VFS_LOCK_GIANT(dqvp->v_mount); error = VOP_READ(dqvp, &auio, 0, ump->um_cred[type]); if (auio.uio_resid == recsize && error == 0) { bzero(&dq->dq_dqb, sizeof(dq->dq_dqb)); @@ -1412,7 +1399,6 @@ hfound: DQI_LOCK(dq); vput(dqvp); else vrele(dqvp); - VFS_UNLOCK_GIANT(vfslocked); /* * I/O error in reading quota file, release * quota structure and reflect problem to caller. @@ -1525,7 +1511,7 @@ dqsync(struct vnode *vp, struct dquot *dq) struct vnode *dqvp; struct iovec aiov; struct uio auio; - int vfslocked, error; + int error; struct mount *mp; struct ufsmount *ump; @@ -1546,12 +1532,10 @@ dqsync(struct vnode *vp, struct dquot *dq) vref(dqvp); UFS_UNLOCK(ump); - vfslocked = VFS_LOCK_GIANT(dqvp->v_mount); DQI_LOCK(dq); if ((dq->dq_flags & DQ_MOD) == 0) { DQI_UNLOCK(dq); vrele(dqvp); - VFS_UNLOCK_GIANT(vfslocked); return (0); } DQI_UNLOCK(dq); @@ -1560,7 +1544,6 @@ dqsync(struct vnode *vp, struct dquot *dq) if (vp != dqvp) vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY); - VFS_UNLOCK_GIANT(vfslocked); DQI_LOCK(dq); DQI_WAIT(dq, PINOD+2, "dqsync"); if ((dq->dq_flags & DQ_MOD) == 0) @@ -1591,9 +1574,7 @@ dqsync(struct vnode *vp, struct dquot *dq) auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_WRITE; auio.uio_td = (struct thread *)0; - vfslocked = VFS_LOCK_GIANT(dqvp->v_mount); error = VOP_WRITE(dqvp, &auio, 0, dq->dq_ump->um_cred[dq->dq_type]); - VFS_UNLOCK_GIANT(vfslocked); if (auio.uio_resid && error == 0) error = EIO; @@ -1602,13 +1583,11 @@ dqsync(struct vnode *vp, struct dquot *dq) dq->dq_flags &= ~DQ_MOD; out: DQI_UNLOCK(dq); - vfslocked = VFS_LOCK_GIANT(dqvp->v_mount); if (vp != dqvp) vput(dqvp); else vrele(dqvp); vn_finished_secondary_write(mp); - VFS_UNLOCK_GIANT(vfslocked); return (error); } |