1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

Remove the unused credential argument from VOP_FSYNC() and VFS_SYNC().

I'm not sure why a credential was added to these in the first place, it is
not used anywhere and it doesn't make much sense:

	The credentials for syncing a file (ability to write to the
	file) should be checked at the system call level.

	Credentials for syncing one or more filesystems ("none")
	should be checked at the system call level as well.

	If the filesystem implementation needs a particular credential
	to carry out the syncing it would logically have to the
	cached mount credential, or a credential cached along with
	any delayed write data.

Discussed with:	rwatson
This commit is contained in:
Poul-Henning Kamp 2005-01-11 07:36:22 +00:00
parent ad3142eda4
commit 8df6bac4c7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140048
35 changed files with 90 additions and 110 deletions

View File

@ -395,14 +395,13 @@ venus_readlink(void *mdp, CodaFid *fid,
}
int
venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p)
venus_fsync(void *mdp, CodaFid *fid, struct proc *p)
{
DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */
ALLOC_NO_OUT(coda_fsync); /* sets inp & outp */
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_FSYNC, cred, p);
INIT_IN(&inp->ih, CODA_FSYNC, NOCRED, p); /* XXX: should be cached mount cred */
inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);

View File

@ -75,8 +75,7 @@ venus_readlink(void *mdp, CodaFid *fid,
/*out*/ char **str, int *len);
int
venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p);
venus_fsync(void *mdp, CodaFid *fid, struct proc *p);
int
venus_lookup(void *mdp, CodaFid *fid,

View File

@ -419,10 +419,9 @@ coda_nb_statfs(vfsp, sbp, td)
* Flush any pending I/O.
*/
int
coda_sync(vfsp, waitfor, cred, td)
coda_sync(vfsp, waitfor, td)
struct mount *vfsp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
ENTRY;

View File

@ -763,7 +763,6 @@ coda_fsync(struct vop_fsync_args *ap)
/* true args */
struct vnode *vp = ap->a_vp;
struct cnode *cp = VTOC(vp);
struct ucred *cred = ap->a_cred;
struct thread *td = ap->a_td;
/* locals */
struct vnode *convp = cp->c_ovp;
@ -787,7 +786,7 @@ coda_fsync(struct vop_fsync_args *ap)
}
if (convp)
VOP_FSYNC(convp, cred, MNT_WAIT, td);
VOP_FSYNC(convp, MNT_WAIT, td);
/*
* We see fsyncs with usecount == 1 then usecount == 0.
@ -815,7 +814,7 @@ coda_fsync(struct vop_fsync_args *ap)
/* needs research */
return 0;
error = venus_fsync(vtomi(vp), &cp->c_fid, cred, td->td_proc);
error = venus_fsync(vtomi(vp), &cp->c_fid, td->td_proc);
CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); );
return(error);

View File

@ -395,14 +395,13 @@ venus_readlink(void *mdp, CodaFid *fid,
}
int
venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p)
venus_fsync(void *mdp, CodaFid *fid, struct proc *p)
{
DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */
ALLOC_NO_OUT(coda_fsync); /* sets inp & outp */
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_FSYNC, cred, p);
INIT_IN(&inp->ih, CODA_FSYNC, NOCRED, p); /* XXX: should be cached mount cred */
inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);

View File

@ -75,8 +75,7 @@ venus_readlink(void *mdp, CodaFid *fid,
/*out*/ char **str, int *len);
int
venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p);
venus_fsync(void *mdp, CodaFid *fid, struct proc *p);
int
venus_lookup(void *mdp, CodaFid *fid,

View File

@ -419,10 +419,9 @@ coda_nb_statfs(vfsp, sbp, td)
* Flush any pending I/O.
*/
int
coda_sync(vfsp, waitfor, cred, td)
coda_sync(vfsp, waitfor, td)
struct mount *vfsp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
ENTRY;

View File

@ -763,7 +763,6 @@ coda_fsync(struct vop_fsync_args *ap)
/* true args */
struct vnode *vp = ap->a_vp;
struct cnode *cp = VTOC(vp);
struct ucred *cred = ap->a_cred;
struct thread *td = ap->a_td;
/* locals */
struct vnode *convp = cp->c_ovp;
@ -787,7 +786,7 @@ coda_fsync(struct vop_fsync_args *ap)
}
if (convp)
VOP_FSYNC(convp, cred, MNT_WAIT, td);
VOP_FSYNC(convp, MNT_WAIT, td);
/*
* We see fsyncs with usecount == 1 then usecount == 0.
@ -815,7 +814,7 @@ coda_fsync(struct vop_fsync_args *ap)
/* needs research */
return 0;
error = venus_fsync(vtomi(vp), &cp->c_fid, cred, td->td_proc);
error = venus_fsync(vtomi(vp), &cp->c_fid, td->td_proc);
CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); );
return(error);

View File

@ -270,7 +270,7 @@ msdosfs_mount(struct mount *mp, struct thread *td)
}
if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) &&
vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) {
error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td);
error = VFS_SYNC(mp, MNT_WAIT, td);
if (error)
return (error);
flags = WRITECLOSE;
@ -852,10 +852,9 @@ msdosfs_statfs(mp, sbp, td)
}
static int
msdosfs_sync(mp, waitfor, cred, td)
msdosfs_sync(mp, waitfor, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
struct vnode *vp, *nvp;
@ -902,7 +901,7 @@ msdosfs_sync(mp, waitfor, cred, td)
goto loop;
continue;
}
error = VOP_FSYNC(vp, cred, waitfor, td);
error = VOP_FSYNC(vp, waitfor, td);
if (error)
allerror = error;
VOP_UNLOCK(vp, 0, td);
@ -916,7 +915,7 @@ msdosfs_sync(mp, waitfor, cred, td)
*/
if (waitfor != MNT_LAZY) {
vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_FSYNC(pmp->pm_devvp, cred, waitfor, td);
error = VOP_FSYNC(pmp->pm_devvp, waitfor, td);
if (error)
allerror = error;
VOP_UNLOCK(pmp->pm_devvp, 0, td);

View File

@ -296,10 +296,9 @@ nullfs_statfs(mp, sbp, td)
}
static int
nullfs_sync(mp, waitfor, cred, td)
nullfs_sync(mp, waitfor, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
/*

View File

@ -1169,7 +1169,7 @@ union_fsync(ap)
struct union_node *un = VTOUNION(ap->a_vp);
if ((targetvp = union_lock_other(un, td)) != NULLVP) {
error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_waitfor, td);
error = VOP_FSYNC(targetvp, ap->a_waitfor, td);
union_unlock_other(targetvp, td);
}

View File

@ -152,7 +152,7 @@ ext2_mount(mp, td)
error = 0;
if (fs->s_rd_only == 0 &&
vfs_flagopt(opts, "ro", NULL, 0)) {
error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td);
error = VFS_SYNC(mp, MNT_WAIT, td);
if (error)
return (error);
flags = WRITECLOSE;
@ -837,10 +837,9 @@ ext2_statfs(mp, sbp, td)
* Note: we are always called with the filesystem marked `MPBUSY'.
*/
static int
ext2_sync(mp, waitfor, cred, td)
ext2_sync(mp, waitfor, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
struct vnode *nvp, *vp;
@ -882,7 +881,7 @@ ext2_sync(mp, waitfor, cred, td)
goto loop;
continue;
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
if ((error = VOP_FSYNC(vp, waitfor, td)) != 0)
allerror = error;
VOP_UNLOCK(vp, 0, td);
vrele(vp);
@ -894,7 +893,7 @@ ext2_sync(mp, waitfor, cred, td)
*/
if (waitfor != MNT_LAZY) {
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_FSYNC(ump->um_devvp, cred, waitfor, td)) != 0)
if ((error = VOP_FSYNC(ump->um_devvp, waitfor, td)) != 0)
allerror = error;
VOP_UNLOCK(ump->um_devvp, 0, td);
}

View File

@ -152,7 +152,7 @@ ext2_mount(mp, td)
error = 0;
if (fs->s_rd_only == 0 &&
vfs_flagopt(opts, "ro", NULL, 0)) {
error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td);
error = VFS_SYNC(mp, MNT_WAIT, td);
if (error)
return (error);
flags = WRITECLOSE;
@ -837,10 +837,9 @@ ext2_statfs(mp, sbp, td)
* Note: we are always called with the filesystem marked `MPBUSY'.
*/
static int
ext2_sync(mp, waitfor, cred, td)
ext2_sync(mp, waitfor, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
struct vnode *nvp, *vp;
@ -882,7 +881,7 @@ ext2_sync(mp, waitfor, cred, td)
goto loop;
continue;
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
if ((error = VOP_FSYNC(vp, waitfor, td)) != 0)
allerror = error;
VOP_UNLOCK(vp, 0, td);
vrele(vp);
@ -894,7 +893,7 @@ ext2_sync(mp, waitfor, cred, td)
*/
if (waitfor != MNT_LAZY) {
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_FSYNC(ump->um_devvp, cred, waitfor, td)) != 0)
if ((error = VOP_FSYNC(ump->um_devvp, waitfor, td)) != 0)
allerror = error;
VOP_UNLOCK(ump->um_devvp, 0, td);
}

View File

@ -1028,7 +1028,7 @@ bdwrite(struct buf *bp)
recursiveflushes++;
} else if (bo->bo_dirty.bv_cnt > dirtybufthresh + 10) {
BO_UNLOCK(bo);
(void) VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td);
(void) VOP_FSYNC(vp, MNT_NOWAIT, td);
BO_LOCK(bo);
altbufferflushes++;
} else if (bo->bo_dirty.bv_cnt > dirtybufthresh) {

View File

@ -686,10 +686,9 @@ vfs_stdquotactl (mp, cmds, uid, arg, td)
}
int
vfs_stdsync(mp, waitfor, cred, td)
vfs_stdsync(mp, waitfor, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
struct vnode *vp, *nvp;
@ -718,7 +717,7 @@ vfs_stdsync(mp, waitfor, cred, td)
goto loop;
continue;
}
error = VOP_FSYNC(vp, cred, waitfor, td);
error = VOP_FSYNC(vp, waitfor, td);
if (error)
allerror = error;
@ -731,10 +730,9 @@ vfs_stdsync(mp, waitfor, cred, td)
}
int
vfs_stdnosync (mp, waitfor, cred, td)
vfs_stdnosync (mp, waitfor, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct thread *td;
{

View File

@ -133,8 +133,7 @@ sync(td, uap)
asyncflag = mp->mnt_flag & MNT_ASYNC;
mp->mnt_flag &= ~MNT_ASYNC;
vfs_msync(mp, MNT_NOWAIT);
VFS_SYNC(mp, MNT_NOWAIT,
((td != NULL) ? td->td_ucred : NOCRED), td);
VFS_SYNC(mp, MNT_NOWAIT, td);
mp->mnt_flag |= asyncflag;
vn_finished_write(mp);
}
@ -3053,7 +3052,7 @@ fsync(td, uap)
vm_object_page_clean(obj, 0, 0, 0);
VM_OBJECT_UNLOCK(obj);
}
error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, td);
error = VOP_FSYNC(vp, MNT_WAIT, td);
if (error == 0 && vp->v_mount && (vp->v_mount->mnt_flag & MNT_SOFTDEP)
&& softdep_fsync_hook != NULL)
error = (*softdep_fsync_hook)(vp);

View File

@ -950,7 +950,7 @@ dounmount(mp, flags, td)
vput(fsrootvp);
}
if (((mp->mnt_flag & MNT_RDONLY) ||
(error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td)) == 0) ||
(error = VFS_SYNC(mp, MNT_WAIT, td)) == 0) ||
(flags & MNT_FORCE)) {
error = VFS_UNMOUNT(mp, flags, td);
}

View File

@ -936,7 +936,7 @@ vinvalbuf(vp, flags, cred, td, slpflag, slptimeo)
}
if (bo->bo_dirty.bv_cnt > 0) {
VI_UNLOCK(vp);
if ((error = VOP_FSYNC(vp, cred, MNT_WAIT, td)) != 0)
if ((error = VOP_FSYNC(vp, MNT_WAIT, td)) != 0)
return (error);
/*
* XXX We could save a lock/unlock if this was only
@ -1487,7 +1487,7 @@ sync_vnode(struct bufobj *bo, struct thread *td)
vholdl(vp);
mtx_unlock(&sync_mtx);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_INTERLOCK, td);
(void) VOP_FSYNC(vp, td->td_ucred, MNT_LAZY, td);
(void) VOP_FSYNC(vp, MNT_LAZY, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
VI_LOCK(vp);
@ -3135,7 +3135,7 @@ sync_fsync(ap)
asyncflag = mp->mnt_flag & MNT_ASYNC;
mp->mnt_flag &= ~MNT_ASYNC;
vfs_msync(mp, MNT_NOWAIT);
error = VFS_SYNC(mp, MNT_LAZY, ap->a_cred, td);
error = VFS_SYNC(mp, MNT_LAZY, td);
if (asyncflag)
mp->mnt_flag |= MNT_ASYNC;
vn_finished_write(mp);

View File

@ -133,8 +133,7 @@ sync(td, uap)
asyncflag = mp->mnt_flag & MNT_ASYNC;
mp->mnt_flag &= ~MNT_ASYNC;
vfs_msync(mp, MNT_NOWAIT);
VFS_SYNC(mp, MNT_NOWAIT,
((td != NULL) ? td->td_ucred : NOCRED), td);
VFS_SYNC(mp, MNT_NOWAIT, td);
mp->mnt_flag |= asyncflag;
vn_finished_write(mp);
}
@ -3053,7 +3052,7 @@ fsync(td, uap)
vm_object_page_clean(obj, 0, 0, 0);
VM_OBJECT_UNLOCK(obj);
}
error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, td);
error = VOP_FSYNC(vp, MNT_WAIT, td);
if (error == 0 && vp->v_mount && (vp->v_mount->mnt_flag & MNT_SOFTDEP)
&& softdep_fsync_hook != NULL)
error = (*softdep_fsync_hook)(vp);

View File

@ -1021,7 +1021,7 @@ vfs_write_suspend(mp)
mp->mnt_kern_flag |= MNTK_SUSPEND;
if (mp->mnt_writeopcount > 0)
(void) tsleep(&mp->mnt_writeopcount, PUSER - 1, "suspwt", 0);
if ((error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td)) != 0) {
if ((error = VFS_SYNC(mp, MNT_WAIT, td)) != 0) {
vfs_write_resume(mp);
return (error);
}

View File

@ -247,7 +247,6 @@ vop_revoke {
#
vop_fsync {
IN struct vnode *vp;
IN struct ucred *cred;
IN int waitfor;
IN struct thread *td;
};

View File

@ -733,7 +733,7 @@ nfs_root(struct mount *mp, struct vnode **vpp, struct thread *td)
*/
/* ARGSUSED */
static int
nfs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct thread *td)
nfs_sync(struct mount *mp, int waitfor, struct thread *td)
{
struct vnode *vp, *nvp;
int error, allerror = 0;
@ -756,7 +756,7 @@ nfs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct thread *td)
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
goto loop;
}
error = VOP_FSYNC(vp, cred, waitfor, td);
error = VOP_FSYNC(vp, waitfor, td);
if (error)
allerror = error;
VOP_UNLOCK(vp, 0, td);

View File

@ -127,7 +127,7 @@ __FBSDID("$FreeBSD$");
#define vfs_busy_pages(bp, f)
#endif
static int nfs4_flush(struct vnode *, struct ucred *, int, struct thread *,
static int nfs4_flush(struct vnode *, int, struct thread *,
int);
static int nfs4_setattrrpc(struct vnode *, struct vattr *, struct ucred *,
struct thread *);
@ -1791,10 +1791,10 @@ nfs4_rename(struct vop_rename_args *ap)
* ( as far as I can tell ) it flushes dirty buffers more
* often.
*/
VOP_FSYNC(fvp, fcnp->cn_cred, MNT_WAIT, fcnp->cn_thread);
VOP_FSYNC(fvp, MNT_WAIT, fcnp->cn_thread);
VOP_UNLOCK(fvp, 0, fcnp->cn_thread);
if (tvp)
VOP_FSYNC(tvp, tcnp->cn_cred, MNT_WAIT, tcnp->cn_thread);
VOP_FSYNC(tvp, MNT_WAIT, tcnp->cn_thread);
/*
* If the tvp exists and is in use, sillyrename it before doing the
@ -1869,7 +1869,7 @@ nfs4_link(struct vop_link_args *ap)
* doesn't get "out of sync" with the server.
* XXX There should be a better way!
*/
VOP_FSYNC(vp, cnp->cn_cred, MNT_WAIT, cnp->cn_thread);
VOP_FSYNC(vp, MNT_WAIT, cnp->cn_thread);
nfsstats.rpccnt[NFSPROC_LINK]++;
@ -2549,7 +2549,7 @@ nfs4_strategy(struct vop_strategy_args *ap)
static int
nfs4_fsync(struct vop_fsync_args *ap)
{
return (nfs4_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_td, 1));
return (nfs4_flush(ap->a_vp, ap->a_waitfor, ap->a_td, 1));
}
/*
@ -2558,7 +2558,7 @@ nfs4_fsync(struct vop_fsync_args *ap)
* associated with the vnode.
*/
static int
nfs4_flush(struct vnode *vp, struct ucred *cred, int waitfor, struct thread *td,
nfs4_flush(struct vnode *vp, int waitfor, struct thread *td,
int commit)
{
struct nfsnode *np = VTONFS(vp);

View File

@ -977,7 +977,7 @@ nfs_root(struct mount *mp, struct vnode **vpp, struct thread *td)
*/
/* ARGSUSED */
static int
nfs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct thread *td)
nfs_sync(struct mount *mp, int waitfor, struct thread *td)
{
struct vnode *vp, *nvp;
int error, allerror = 0;
@ -1001,7 +1001,7 @@ nfs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct thread *td)
MNT_ILOCK(mp);
goto loop;
}
error = VOP_FSYNC(vp, cred, waitfor, td);
error = VOP_FSYNC(vp, waitfor, td);
if (error)
allerror = error;
VOP_UNLOCK(vp, 0, td);

View File

@ -99,7 +99,7 @@ __FBSDID("$FreeBSD$");
static vop_read_t nfsfifo_read;
static vop_write_t nfsfifo_write;
static vop_close_t nfsfifo_close;
static int nfs_flush(struct vnode *, struct ucred *, int, struct thread *,
static int nfs_flush(struct vnode *, int, struct thread *,
int);
static int nfs_setattrrpc(struct vnode *, struct vattr *, struct ucred *,
struct thread *);
@ -534,7 +534,7 @@ nfs_close(struct vop_close_args *ap)
* cannot clear it if we don't commit.
*/
int cm = nfsv3_commit_on_close ? 1 : 0;
error = nfs_flush(vp, ap->a_cred, MNT_WAIT, ap->a_td, cm);
error = nfs_flush(vp, MNT_WAIT, ap->a_td, cm);
/* np->n_flag &= ~NMODIFIED; */
} else {
error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_td, 1);
@ -1585,10 +1585,10 @@ nfs_rename(struct vop_rename_args *ap)
* that was written back to our cache earlier. Not checking for
* this condition can result in potential (silent) data loss.
*/
error = VOP_FSYNC(fvp, fcnp->cn_cred, MNT_WAIT, fcnp->cn_thread);
error = VOP_FSYNC(fvp, MNT_WAIT, fcnp->cn_thread);
VOP_UNLOCK(fvp, 0, fcnp->cn_thread);
if (!error && tvp)
error = VOP_FSYNC(tvp, tcnp->cn_cred, MNT_WAIT, tcnp->cn_thread);
error = VOP_FSYNC(tvp, MNT_WAIT, tcnp->cn_thread);
if (error)
goto out;
@ -1704,7 +1704,7 @@ nfs_link(struct vop_link_args *ap)
* doesn't get "out of sync" with the server.
* XXX There should be a better way!
*/
VOP_FSYNC(vp, cnp->cn_cred, MNT_WAIT, cnp->cn_thread);
VOP_FSYNC(vp, MNT_WAIT, cnp->cn_thread);
v3 = NFS_ISV3(vp);
nfsstats.rpccnt[NFSPROC_LINK]++;
@ -2661,7 +2661,7 @@ static int
nfs_fsync(struct vop_fsync_args *ap)
{
return (nfs_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_td, 1));
return (nfs_flush(ap->a_vp, ap->a_waitfor, ap->a_td, 1));
}
/*
@ -2670,7 +2670,7 @@ nfs_fsync(struct vop_fsync_args *ap)
* associated with the vnode.
*/
static int
nfs_flush(struct vnode *vp, struct ucred *cred, int waitfor, struct thread *td,
nfs_flush(struct vnode *vp, int waitfor, struct thread *td,
int commit)
{
struct nfsnode *np = VTONFS(vp);

View File

@ -4042,7 +4042,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC);
VM_OBJECT_UNLOCK(vp->v_object);
}
error = VOP_FSYNC(vp, cred, MNT_WAIT, td);
error = VOP_FSYNC(vp, MNT_WAIT, td);
} else {
/*
* Locate and synchronously write any buffers that fall

View File

@ -469,8 +469,7 @@ typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid,
caddr_t arg, struct thread *td);
typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp,
struct thread *td);
typedef int vfs_sync_t(struct mount *mp, int waitfor, struct ucred *cred,
struct thread *td);
typedef int vfs_sync_t(struct mount *mp, int waitfor, struct thread *td);
typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags,
struct vnode **vpp);
typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp);
@ -513,7 +512,7 @@ vfs_statfs_t __vfs_statfs;
#define VFS_ROOT(MP, VPP, P) (*(MP)->mnt_op->vfs_root)(MP, VPP, P)
#define VFS_QUOTACTL(MP,C,U,A,P) (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
#define VFS_STATFS(MP, SBP, P) __vfs_statfs((MP), (SBP), (P))
#define VFS_SYNC(MP, WAIT, C, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
#define VFS_SYNC(MP, WAIT, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, P)
#define VFS_VGET(MP, INO, FLAGS, VPP) \
(*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP)
#define VFS_FHTOVP(MP, FIDP, VPP) \

View File

@ -395,7 +395,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
* occurence. The error return from fsync is ignored as we already
* have an error to return to the user.
*/
(void) VOP_FSYNC(vp, cred, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
for (deallocated = 0, blkp = allociblk; blkp < allocblk; blkp++) {
ffs_blkfree(fs, ip->i_devvp, *blkp, fs->fs_bsize, ip->i_number);
deallocated += fs->fs_bsize;
@ -432,7 +432,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
dp->di_blocks -= btodb(deallocated);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
}
(void) VOP_FSYNC(vp, cred, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
return (error);
}
@ -862,7 +862,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
* occurence. The error return from fsync is ignored as we already
* have an error to return to the user.
*/
(void) VOP_FSYNC(vp, cred, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
for (deallocated = 0, blkp = allociblk; blkp < allocblk; blkp++) {
ffs_blkfree(fs, ip->i_devvp, *blkp, fs->fs_bsize, ip->i_number);
deallocated += fs->fs_bsize;
@ -899,6 +899,6 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
dp->di_blocks -= btodb(deallocated);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
}
(void) VOP_FSYNC(vp, cred, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
return (error);
}

View File

@ -192,7 +192,7 @@ ffs_truncate(vp, length, flags, cred, td)
} else {
if (length != 0)
panic("ffs_truncate: partial trunc of extdata");
if ((error = VOP_FSYNC(ovp, cred, MNT_WAIT, td)) != 0)
if ((error = VOP_FSYNC(ovp, MNT_WAIT, td)) != 0)
return (error);
osize = oip->i_din2->di_extsize;
oip->i_din2->di_blocks -= extblocks;
@ -262,7 +262,7 @@ ffs_truncate(vp, length, flags, cred, td)
* rarely, we solve the problem by syncing the file
* so that it will have no data structures left.
*/
if ((error = VOP_FSYNC(ovp, cred, MNT_WAIT, td)) != 0)
if ((error = VOP_FSYNC(ovp, MNT_WAIT, td)) != 0)
return (error);
if (oip->i_flag & IN_SPACECOUNTED)
fs->fs_pendingblocks -= datablocks;
@ -330,7 +330,7 @@ ffs_truncate(vp, length, flags, cred, td)
*/
if (DOINGSOFTDEP(ovp) && lbn < NDADDR &&
fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize &&
(error = VOP_FSYNC(ovp, cred, MNT_WAIT, td)) != 0)
(error = VOP_FSYNC(ovp, MNT_WAIT, td)) != 0)
return (error);
oip->i_size = length;
DIP_SET(oip, i_size, length);

View File

@ -151,7 +151,7 @@ ffs_rawread_sync(struct vnode *vp, struct thread *td)
if (bo->bo_dirty.bv_cnt > 0) {
splx(spl);
VI_UNLOCK(vp);
if ((error = VOP_FSYNC(vp, NOCRED, MNT_WAIT, td)) != 0) {
if ((error = VOP_FSYNC(vp, MNT_WAIT, td)) != 0) {
if (upgraded != 0)
VOP_LOCK(vp, LK_DOWNGRADE, td);
return (error);

View File

@ -308,7 +308,7 @@ ffs_snapshot(mp, snapfile)
* Since we have marked it as a snapshot it is safe to
* unlock it as no process will be allowed to write to it.
*/
if ((error = VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td)) != 0)
if ((error = VOP_FSYNC(vp, MNT_WAIT, td)) != 0)
goto out;
VOP_UNLOCK(vp, 0, td);
/*
@ -690,7 +690,7 @@ ffs_snapshot(mp, snapfile)
mp->mnt_flag = flag;
if (error)
(void) UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td);
(void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
if (error)
vput(vp);
else
@ -1711,7 +1711,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum)
bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
(void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
continue;
}
/*
@ -1721,7 +1721,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum)
bzero(cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
(void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
break;
}
savedcbp = cbp;
@ -1735,7 +1735,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum)
vp = savedcbp->b_vp;
bawrite(savedcbp);
if (dopersistence && VTOI(vp)->i_effnlink > 0)
(void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
}
/*
* If we have been unable to allocate a block in which to do
@ -1797,7 +1797,7 @@ ffs_snapshot_mount(mp)
} else {
reason = "old format snapshot";
(void)UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td);
(void)VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void)VOP_FSYNC(vp, MNT_WAIT, td);
}
printf("ffs_snapshot_mount: %s inode %d\n",
reason, fs->fs_snapinum[snaploc]);
@ -2078,7 +2078,7 @@ ffs_copyonwrite(devvp, bp)
bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
(void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
continue;
}
/*
@ -2088,7 +2088,7 @@ ffs_copyonwrite(devvp, bp)
bzero(cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
(void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
break;
}
savedcbp = cbp;
@ -2102,7 +2102,7 @@ ffs_copyonwrite(devvp, bp)
vp = savedcbp->b_vp;
bawrite(savedcbp);
if (dopersistence && VTOI(vp)->i_effnlink > 0)
(void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
(void) VOP_FSYNC(vp, MNT_WAIT, td);
}
if (snapshot_locked)
VOP_UNLOCK(vp, 0, td);

View File

@ -844,7 +844,7 @@ softdep_flushworklist(oldmnt, countp, td)
while ((count = softdep_process_worklist(oldmnt)) > 0) {
*countp += count;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_FSYNC(devvp, td->td_ucred, MNT_WAIT, td);
error = VOP_FSYNC(devvp, MNT_WAIT, td);
VOP_UNLOCK(devvp, 0, td);
if (error)
break;
@ -4882,7 +4882,7 @@ softdep_fsync(vp)
return (error);
}
if ((pagedep->pd_state & NEWBLOCK) &&
(error = VOP_FSYNC(pvp, td->td_ucred, MNT_WAIT, td))) {
(error = VOP_FSYNC(pvp, MNT_WAIT, td))) {
vput(pvp);
return (error);
}
@ -5362,8 +5362,8 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
FREE_LOCK(&lk);
if ((error = VFS_VGET(mp, inum, LK_EXCLUSIVE, &vp)))
break;
if ((error=VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td)) ||
(error=VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td))) {
if ((error=VOP_FSYNC(vp, MNT_NOWAIT, td)) ||
(error=VOP_FSYNC(vp, MNT_NOWAIT, td))) {
vput(vp);
break;
}
@ -5641,7 +5641,7 @@ clear_remove(td)
vn_finished_write(mp);
return;
}
if ((error = VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td)))
if ((error = VOP_FSYNC(vp, MNT_NOWAIT, td)))
softdep_error("clear_remove: fsync", error);
VI_LOCK(vp);
drain_output(vp, 0);
@ -5717,10 +5717,10 @@ clear_inodedeps(td)
return;
}
if (ino == lastino) {
if ((error = VOP_FSYNC(vp, td->td_ucred, MNT_WAIT, td)))
if ((error = VOP_FSYNC(vp, MNT_WAIT, td)))
softdep_error("clear_inodedeps: fsync1", error);
} else {
if ((error = VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td)))
if ((error = VOP_FSYNC(vp, MNT_NOWAIT, td)))
softdep_error("clear_inodedeps: fsync2", error);
VI_LOCK(vp);
drain_output(vp, 0);

View File

@ -157,8 +157,7 @@ ffs_mount(struct mount *mp, struct thread *td)
/*
* Flush any dirty data.
*/
if ((error = VFS_SYNC(mp, MNT_WAIT,
td->td_ucred, td)) != 0) {
if ((error = VFS_SYNC(mp, MNT_WAIT, td)) != 0) {
vn_finished_write(mp);
return (error);
}
@ -1001,7 +1000,7 @@ ffs_flushfiles(mp, flags, td)
* Flush filesystem metadata.
*/
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_FSYNC(ump->um_devvp, td->td_ucred, MNT_WAIT, td);
error = VOP_FSYNC(ump->um_devvp, MNT_WAIT, td);
VOP_UNLOCK(ump->um_devvp, 0, td);
return (error);
}
@ -1044,10 +1043,9 @@ ffs_statfs(mp, sbp, td)
* Note: we are always called with the filesystem marked `MPBUSY'.
*/
int
ffs_sync(mp, waitfor, cred, td)
ffs_sync(mp, waitfor, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct thread *td;
{
struct vnode *nvp, *vp, *devvp;
@ -1100,7 +1098,7 @@ ffs_sync(mp, waitfor, cred, td)
goto loop;
continue;
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
if ((error = VOP_FSYNC(vp, waitfor, td)) != 0)
allerror = error;
VOP_UNLOCK(vp, 0, td);
vrele(vp);
@ -1128,7 +1126,7 @@ ffs_sync(mp, waitfor, cred, td)
if (waitfor != MNT_LAZY &&
(bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0)) {
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY | LK_INTERLOCK, td);
if ((error = VOP_FSYNC(devvp, cred, waitfor, td)) != 0)
if ((error = VOP_FSYNC(devvp, waitfor, td)) != 0)
allerror = error;
VOP_UNLOCK(devvp, 0, td);
if (allerror == 0 && waitfor == MNT_WAIT) {

View File

@ -805,7 +805,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
return (error);
if (tvp != NULL)
VOP_UNLOCK(tvp, 0, td);
error = VOP_FSYNC(dvp, td->td_ucred, MNT_WAIT, td);
error = VOP_FSYNC(dvp, MNT_WAIT, td);
if (tvp != NULL)
vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, td);
return (error);

View File

@ -835,7 +835,7 @@ vm_object_page_clean(vm_object_t object, vm_pindex_t start, vm_pindex_t end, int
}
vm_page_unlock_queues();
#if 0
VOP_FSYNC(vp, NULL, (pagerflags & VM_PAGER_PUT_SYNC)?MNT_WAIT:0, curproc);
VOP_FSYNC(vp, (pagerflags & VM_PAGER_PUT_SYNC)?MNT_WAIT:0, curproc);
#endif
vm_object_clear_flag(object, OBJ_CLEANING);