Changeset View
Changeset View
Standalone View
Standalone View
head/sys/ufs/ufs/ufs_quota.c
Show First 20 Lines • Show All 706 Lines • ▼ Show 20 Lines | again: | ||||
qvp->v_vflag &= ~VV_SYSTEM; | qvp->v_vflag &= ~VV_SYSTEM; | ||||
VOP_UNLOCK(qvp, 0); | VOP_UNLOCK(qvp, 0); | ||||
error = vn_close(qvp, FREAD|FWRITE, td->td_ucred, td); | error = vn_close(qvp, FREAD|FWRITE, td->td_ucred, td); | ||||
crfree(cr); | crfree(cr); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | |||||
quotaoff_inchange1(struct thread *td, struct mount *mp, int type) | |||||
{ | |||||
int error; | |||||
bool need_resume; | |||||
/* | /* | ||||
* mp is already suspended on unmount. If not, suspend it, to | |||||
* avoid the situation where quotaoff operation eventually | |||||
* failing due to SU structures still keeping references on | |||||
* dquots, but vnode's references are already clean. This | |||||
* would cause quota accounting leak and asserts otherwise. | |||||
* Note that the thread has already called vn_start_write(). | |||||
*/ | |||||
if (mp->mnt_susp_owner == td) { | |||||
need_resume = false; | |||||
} else { | |||||
error = vfs_write_suspend_umnt(mp); | |||||
if (error != 0) | |||||
return (error); | |||||
need_resume = true; | |||||
} | |||||
error = quotaoff1(td, mp, type); | |||||
if (need_resume) | |||||
vfs_write_resume(mp, VR_START_WRITE); | |||||
return (error); | |||||
} | |||||
/* | |||||
* Turns off quotas, assumes that ump->um_qflags are already checked | * Turns off quotas, assumes that ump->um_qflags are already checked | ||||
* and QTF_CLOSING is set to indicate operation in progress. Fixes | * and QTF_CLOSING is set to indicate operation in progress. Fixes | ||||
* ump->um_qflags and mp->mnt_flag after. | * ump->um_qflags and mp->mnt_flag after. | ||||
*/ | */ | ||||
int | int | ||||
quotaoff_inchange(struct thread *td, struct mount *mp, int type) | quotaoff_inchange(struct thread *td, struct mount *mp, int type) | ||||
{ | { | ||||
struct ufsmount *ump; | struct ufsmount *ump; | ||||
int i; | int error, i; | ||||
int error; | |||||
error = quotaoff1(td, mp, type); | error = quotaoff_inchange1(td, mp, type); | ||||
ump = VFSTOUFS(mp); | ump = VFSTOUFS(mp); | ||||
UFS_LOCK(ump); | UFS_LOCK(ump); | ||||
ump->um_qflags[type] &= ~QTF_CLOSING; | ump->um_qflags[type] &= ~QTF_CLOSING; | ||||
for (i = 0; i < MAXQUOTAS; i++) | for (i = 0; i < MAXQUOTAS; i++) | ||||
if (ump->um_quotas[i] != NULLVP) | if (ump->um_quotas[i] != NULLVP) | ||||
break; | break; | ||||
if (i == MAXQUOTAS) { | if (i == MAXQUOTAS) { | ||||
▲ Show 20 Lines • Show All 1,122 Lines • Show Last 20 Lines |