Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2000 03:24:08 +0200 (CEST)
From:      Cyrille Lefevre <root@gits.dyndns.org>
To:        freebsd-fs@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG
Cc:        peter@FreeBSD.ORG
Subject:   quota/mount commands inconsistency
Message-ID:  <200006080124.DAA02649@gits.dyndns.org>

next in thread | raw e-mail | index | archive | help
Hi,

recently, I have tried to setup quotas as usual. the first
things I tries where the "rq" option then the "quota" option. 
ok, the "quota" option isn't supported under FreeBSD, as well
as the "rq" option while the later is a little documented in
fstab(5) :

     #define FSTAB_RQ        "rq"    /* read/write with quotas */               

so, I use the FreeBSD "userquota" and "groupquota" options.

here is my configuration (/disk0 is my fallback root partition):

# egrep 'disk|\B/\B' /etc/fstab
/dev/ad0s3  /disk0 ufs rw,userquota,groupquota,noauto 1 1
/dev/da0s1a /      ufs rw,userquota,groupquota 1 1
/dev/da1s1c /disk2 ufs rw,userquota,groupquota 1 2
/dev/da2s1a /disk1 ufs rw,userquota,groupquota 1 2
/dev/da3s1a /disk4 ufs rw,userquota,groupquota 1 2
# df -k
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/da0s1a   1904559  1255135   497060    72%    /
/dev/da1s1c   2031922  1372446   496923    73%    /disk2
/dev/da2s1a   1904559  1662507    89688    95%    /disk1
/dev/da3s1a   1904559  1751524      671   100%    /disk4

as I already says, the "rq" option seems to no be supported any
more while mounting an ufs filesystem and the userquota and
groupquota options aren't checked as well to turn quota on while
an ufs filesystem is mounted.  you have to turn on quota manually
using quotaon. huh!

# mount -o rq /dev/ad0s3a /disk0
mount: -o rq: option not supported
(well)
# mount -v /disk0
/dev/ad0s3 on /disk0 (ufs, local, soft-updates, writes: sync 2 async 0, reads: s
ync 1 async 0)
(humm... quota are not enabled at mount time!)
# mount | grep /disk1
/dev/da2s1a on /disk1 (ufs, local, with quotas, writes: sync 34 async 110, reads: sync 43 async 5)
(while there are at boot time)
# cat /tmp/c.c
#include <sys/param.h>
#include <sys/mount.h>

int
main () {
	char *path = "/disk0";
	struct statfs buf;

	if (statfs (path, &buf) < 0) {
		perror ("statfs");
		return (1);
	}

	printf ("%s: %s", path, (buf.f_flags & MNT_RDONLY) ? "ro" : "rw");
/* ufs stuffs */
	if (buf.f_flags & MNT_SYNCHRONOUS)    printf (",%s", "sync");
	if (buf.f_flags & MNT_NOEXEC)         printf (",%s", "noexec");
	if (buf.f_flags & MNT_NOSUID)         printf (",%s", "nosuid");
	if (buf.f_flags & MNT_NODEV)          printf (",%s", "nodev");
	if (buf.f_flags & MNT_UNION)          printf (",%s", "union");
	if (buf.f_flags & MNT_ASYNC)          printf (",%s", "async");
	if (buf.f_flags & MNT_NOATIME)        printf (",%s", "noatime");
	if (buf.f_flags & MNT_NOCLUSTERR)     printf (",%s", "noclusterr");
	if (buf.f_flags & MNT_NOCLUSTERW)     printf (",%s", "noclusterw");
	if (buf.f_flags & MNT_NOSYMFOLLOW)    printf (",%s", "nosymfollow");
	if (buf.f_flags & MNT_SUIDDIR)        printf (",%s", "suiddir");
	if (buf.f_flags & MNT_SOFTDEP)        printf (",%s", "soft-updates");
/* misc stuffs */
	if (buf.f_flags & MNT_LOCAL)          printf (",%s", "local");
	if (buf.f_flags & MNT_QUOTA)          printf (",%s", "quota");
	if (buf.f_flags & MNT_ROOTFS)         printf (",%s", "rootfs");
	if (buf.f_flags & MNT_USER)           printf (",%s", "user");
	if (buf.f_flags & MNT_IGNORE)         printf (",%s", "ignore");
/* nfs stuffs */
	if (buf.f_flags & MNT_EXPORTED) {
	printf (" nfs: %s", (buf.f_flags & MNT_EXRDONLY) ? "ro" : "rw");
	if (buf.f_flags & MNT_DEFEXPORTED)    printf (",%s", "world");
	if (buf.f_flags & MNT_EXPORTANON)     printf (",%s", "maproot");
	if (buf.f_flags & MNT_EXKERB)         printf (",%s", "kerb");
	if (buf.f_flags & MNT_EXPUBLIC)       printf (",%s", "webnfs");
	}

	printf ("\n");

	return (0);
}
# make /tmp/c
cc -O -pipe  /tmp/c.c  -o /tmp/c                                                
# /tmp/c
/disk0: rw,soft-updates,local                                                   
# quotaon -a
(oops, panic! checking for core dump...savecore: no core dump)
(reboot, then same things until quotaon -a)
# quotaon /disk0
# mount | grep /disk0
/dev/da0s1a on / (ufs, local, with quotas, soft-updates, writes: sync 173 async 2939, reads: sync 1779 async 180)
(ok... quota are now enabled)
# /tmp/c
/disk0: rw,soft-updates,local,quota                                             
# umount /disk0
(goto first mount :)

also, if a filesystem isn't mounted at boot time and quotacheck is
requested, quota files are created w/ hole in the mount point of
that filesystem. other quota commands just create an empty file.
so, quotacheck lacks to check if the filesystem is mounted before
to do anything as well as every other quota commands.

# quotacheck -a
(doesn't complain about unmounted /disk0 which is ok)
# ls -l /disk0
total 80
-rw-r-----  1 root  operator  2097120 Jun  5 22:09 quota.group
-rw-r-----  1 root  operator  2097120 Jun  5 22:09 quota.user

kernel panic seems to arrive when multiple quotaon -a are done
and/or doing quotaoff -a, then quotaon -a.

questions are here :

why did you get rid of the "rq" option ?

if the "userquota" and "groupquota" options are not given, but
"rq" is, isn't it possible to use the same behaviour than other
systems, which is to turn on quota at mount time and not at boot
time and defaulting to userquota to /disk0/quotas in my case ?

of course, more control needs to be done in every quota commands
such as, don't create a quota file if the filesystem isn't mounted.

and mount needs to be completed to activate quotas at mount time.

so, I am right to make these modifications and more if needed,
but before, I want to be sure I'm not wrong somewhere ? and before
to send a bug-report, I'm asking you.

PS : there is a lot of quota PRs which are not assigned right now.

Regards,

Cyrille Lefevre.
--
home: mailto:clefevre@citeweb.net work: mailto:Cyrille.Lefevre@edf.fr


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006080124.DAA02649>