Changeset View
Changeset View
Standalone View
Standalone View
sys/ufs/ufs/ufs_vfsops.c
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | ufs_root(mp, flags, vpp) | ||||
*vpp = nvp; | *vpp = nvp; | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Do operations associated with quotas | * Do operations associated with quotas | ||||
*/ | */ | ||||
int | int | ||||
ufs_quotactl(mp, cmds, id, arg) | ufs_quotactl(mp, cmds, id, arg, mp_busy) | ||||
struct mount *mp; | struct mount *mp; | ||||
int cmds; | int cmds; | ||||
uid_t id; | uid_t id; | ||||
void *arg; | void *arg; | ||||
bool *mp_busy; | |||||
{ | { | ||||
#ifndef QUOTA | #ifndef QUOTA | ||||
if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON || | |||||
(cmds >> SUBCMDSHIFT) == Q_QUOTAOFF) | |||||
vfs_unbusy(mp); | |||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
#else | #else | ||||
struct thread *td; | struct thread *td; | ||||
int cmd, type, error; | int cmd, type, error; | ||||
td = curthread; | td = curthread; | ||||
cmd = cmds >> SUBCMDSHIFT; | cmd = cmds >> SUBCMDSHIFT; | ||||
type = cmds & SUBCMDMASK; | type = cmds & SUBCMDMASK; | ||||
if (id == -1) { | if (id == -1) { | ||||
switch (type) { | switch (type) { | ||||
case USRQUOTA: | case USRQUOTA: | ||||
id = td->td_ucred->cr_ruid; | id = td->td_ucred->cr_ruid; | ||||
break; | break; | ||||
case GRPQUOTA: | case GRPQUOTA: | ||||
id = td->td_ucred->cr_rgid; | id = td->td_ucred->cr_rgid; | ||||
break; | break; | ||||
default: | default: | ||||
if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) | |||||
vfs_unbusy(mp); | |||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
} | } | ||||
if ((u_int)type >= MAXQUOTAS) { | if ((u_int)type >= MAXQUOTAS) | ||||
if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) | |||||
vfs_unbusy(mp); | |||||
return (EINVAL); | return (EINVAL); | ||||
} | |||||
switch (cmd) { | switch (cmd) { | ||||
case Q_QUOTAON: | case Q_QUOTAON: | ||||
error = quotaon(td, mp, type, arg); | error = quotaon(td, mp, type, arg, mp_busy); | ||||
break; | break; | ||||
case Q_QUOTAOFF: | case Q_QUOTAOFF: | ||||
vfs_ref(mp); | vfs_ref(mp); | ||||
KASSERT(*mp_busy, | |||||
("%s called without busied mount", __func__)); | |||||
vfs_unbusy(mp); | vfs_unbusy(mp); | ||||
*mp_busy = false; | |||||
vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); | vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); | ||||
error = quotaoff(td, mp, type); | error = quotaoff(td, mp, type); | ||||
vn_finished_write(mp); | vn_finished_write(mp); | ||||
break; | break; | ||||
case Q_SETQUOTA32: | case Q_SETQUOTA32: | ||||
error = setquota32(td, mp, id, type, arg); | error = setquota32(td, mp, id, type, arg); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |