VxFS quota not working on Solaris

Mike Gerdts Michael.Gerdts at usa.alcatel.com
Wed Jan 16 11:09:42 GMT 2002


On Wed, 2002-01-16 at 10:45, gdoucet at csc.com wrote:
> I saw in the TODO (http://us1.samba.org/samba/TODO.html) they want to
> rewrite quota as a VFS module. VFS module maybe not a good think, but
> something similar. Like having a struct with the filesystem type and a
> callback . Check the filesystem type (vxfs, ufs, nfs.. etc.) and then call
> the apopriate callback.
> 
> For my problem I will send a bug repport with the change in
> include/include.h and smbd/qoutas.c

I have run across several things that could benefit from abstracting the
quota interface.  These include Samba, rquotad, and various
administrative tools that I have written over time.

I have often thought about writing such an abstract system that can use
file system plugins that are appropriate for the file system.  I had
thought of writing it so that a generic entry point figures out the file
system type and calls the appropriate interface, if available.  Callable
functions in this library would be along the lines of:

Data structures:

struct quota {
	size_t	byte_hard_limit;
	size_t	byte_soft_limit;
	size_t	byte_usage;
	time_t	byte_expiretime;
	time_t	byte_grace;
	int	file_hard_limit;
	int	file_soft_limit;
	int	file_usage;
	time_t	file_expiretime;
	time_t	file_grace;
}

#define QUOTA_BYTE_HARD		(1 << 0)
#define QUOTA_BYTE_SOFT		(1 << 1)
#define QUOTA_BYTE_USAGE	(1 << 2)
#define QUOTA_BYTE_EXPIRETIME	(1 << 3)
#define QUOTA_BYTE_GRACE	(1 << 4)

#define QUOTA_FILE_HARD		(1 << 8)
#define QUOTA_FILE_SOFT		(1 << 9)
#define QUOTA_FILE_USAGE	(1 << 10)
#define QUOTA_FILE_EXPIRETIME	(1 << 11)
#define QUOTA_FILE_GRACE	(1 << 12)

#define QUOTA_USER_QUOTA	(1 << 16)
#define QUOTA_GROUP_QUOTA	(1 << 17)

#define QUOTA_GET_CAPABILITIES	(1 << 24)

Get the quotas for the particular path.  Only those fields requested in
mask are returned.  If one or more requested fields is not available an
error is returned and omask has the bit(s) set saying which field(s)
caused the error.  Either QUOTA_USER_QUOTA or QUOTA_GROUP_QUOTA must be
in the mask.

int quota_get(char *path /* in */,
		uid_t uid /* in */,
		int mask /* in */,
		int *omask /* out */,
		struct quota *q /* out */)

Set the quotas for the given path.  Only those fields requested in mask
are set.  If one or more requested fields cannot be set, an error is
returned and the field(s) that caused the error are set in omask. 
Either QUOTA_USER_QUOTA or QUOTA_GROUP_QUOTA must be in the mask.

int quota_set(char *path /* in */,
		uid_t uid /* in */,
		int mask /* in */,
		int omask /* out */,
		struct quota *q /* in */)

In each case "an error is returned" means that a non-zero number
corresponding to a particular error condition is returned.

A plugin for each supported filesystem (quota_<fstype>.so?) would then
be responsible for implementing the portions that can be implemented.

Potential issues:

There is most definitely some quota system that doesn't fit this model. 
I just don't know of it right now.

Returning quotas in bytes can quickly cause problems if size_t is not
64-bit.  The alternative of returning quotas in blocks is problematic
because it encourages application developers to display results in
blocks, which confuses users.


Thoughts?

Mike





More information about the samba-technical mailing list