patch-2.1.79 linux/fs/dquot.c
Next file: linux/fs/ext2/inode.c
Previous file: linux/fs/dcache.c
Back to the patch index
Back to the overall index
- Lines: 78
- Date:
Mon Jan 12 14:46:24 1998
- Orig file:
v2.1.78/linux/fs/dquot.c
- Orig date:
Tue Dec 2 09:49:39 1997
diff -u --recursive --new-file v2.1.78/linux/fs/dquot.c linux/fs/dquot.c
@@ -23,6 +23,12 @@
* Nick Kralevich <nickkral@cal.alumni.berkeley.edu>, 21 Jul 97
* Fixed a condition where user and group quotas could get mixed up.
*
+ * Chris Rankin <rankinc@bellsouth.net>, 31 Dec 97, 2-4 Jan 98
+ * Fixed kernel API so that the user can get the quota for any
+ * group s/he belongs to. Also return useful error codes when
+ * turning quotas off, and fixed sync_dquot() so that all devices
+ * are synced when dev==NODEV.
+ *
* (C) Copyright 1994, 1995 Marco van Wieringen
*
*/
@@ -273,7 +279,7 @@
dqstats.syncs++;
for (i = 0; i < nr_dquots * 2; i++, dquot = dquot->dq_next) {
- if (dev == NODEV || dquot->dq_count == 0 || dquot->dq_dev != dev)
+ if ((dev != NODEV && dquot->dq_dev != dev) || dquot->dq_count == 0 )
continue;
if (type != -1 && dquot->dq_type != type)
continue;
@@ -592,13 +598,13 @@
}
if ((dquot = dqget(dev, id, type)) != NODQUOT) {
lock_dquot(dquot);
- if (id > 0 && ((flags & SET_QUOTA) || (flags & SET_QLIMIT))) {
+ if (id > 0 && (flags & (SET_QUOTA|SET_QLIMIT))) {
dquot->dq_bhardlimit = dq_dqblk.dqb_bhardlimit;
dquot->dq_bsoftlimit = dq_dqblk.dqb_bsoftlimit;
dquot->dq_ihardlimit = dq_dqblk.dqb_ihardlimit;
dquot->dq_isoftlimit = dq_dqblk.dqb_isoftlimit;
}
- if ((flags & SET_QUOTA) || (flags & SET_USE)) {
+ if (flags & (SET_QUOTA|SET_USE)) {
if (dquot->dq_isoftlimit &&
dquot->dq_curinodes < dquot->dq_isoftlimit &&
dq_dqblk.dqb_curinodes >= dquot->dq_isoftlimit)
@@ -917,12 +923,18 @@
struct vfsmount *vfsmnt;
short cnt;
+ if ( !(vfsmnt = lookup_vfsmnt(dev)) )
+ return -ENODEV;
+
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
if (type != -1 && cnt != type)
continue;
- if ((vfsmnt = lookup_vfsmnt(dev)) == (struct vfsmount *)NULL ||
- vfsmnt->mnt_quotas[cnt] == (struct file *)NULL)
- continue;
+ if (vfsmnt->mnt_quotas[cnt] == (struct file *)NULL)
+ {
+ if(type == -1)
+ continue;
+ return -ESRCH;
+ }
vfsmnt->mnt_sb->dq_op = (struct dquot_operations *)NULL;
reset_dquot_ptrs(dev, cnt);
invalidate_dquots(dev, cnt);
@@ -1027,7 +1039,7 @@
break;
case Q_GETQUOTA:
if (((type == USRQUOTA && current->uid != id) ||
- (type == GRPQUOTA && current->gid != id)) && !fsuser())
+ (type == GRPQUOTA && in_group_p(id))) && !fsuser())
goto out;
break;
default:
@@ -1036,7 +1048,7 @@
}
ret = -EINVAL;
- dev = 0;
+ dev = NODEV;
if (special != NULL || (cmds != Q_SYNC && cmds != Q_GETSTATS)) {
mode_t mode;
struct dentry * dentry;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov