Bug 3456 - Linux v2 quota support is broken
Summary: Linux v2 quota support is broken
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.21a
Hardware: Other Linux
: P3 normal
Target Milestone: none
Assignee: Björn Jacke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-27 07:33 UTC by Bastien Nocera
Modified: 2012-09-07 22:48 UTC (History)
1 user (show)

See Also:


Attachments
samba-unbreak-v2-quota-support.patch (452 bytes, patch)
2006-01-27 07:34 UTC, Bastien Nocera
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bastien Nocera 2006-01-27 07:33:18 UTC
When using samba after having implemented quotas:
[2006/01/18 05:50:03, 3] lib/sysquotas.c:sys_get_quota(413)
 sys_get_vfs_quota() failed for mntpath[/test] bdev[/dev/VolGroup01/testlv]
qtype[2] id[10056]: Invalid argument
[2006/01/18 05:50:03, 3] smbd/reply.c:reply_dskattr(785)
 dskattr dfree=58104
[2006/01/18 05:50:03, 5] lib/util.c:show_msg(486)
[2006/01/18 05:50:03, 5] lib/util.c:show_msg(496)

To be able to support both quota v1 and v2, samba is defined its own constants
for the cmd part of quotactl()'s QCMD. However, the v2 constants in the system
headers and samba don't match.

In source/include/samba_linux_quota.h:
#ifndef Q_V2_GETQUOTA
#define Q_V2_GETQUOTA  0x0D00
#endif #ifndef Q_V2_SETQUOTA
#define Q_V2_SETQUOTA  0x0E00
#endif

And in sys/quota.h:
# define Q_GETQUOTA 0x800007    /* get user quota structure */
# define Q_SETQUOTA 0x800008    /* set user quota structure */
Comment 1 Bastien Nocera 2006-01-27 07:34:06 UTC
Created attachment 1710 [details]
samba-unbreak-v2-quota-support.patch
Comment 2 Gerald (Jerry) Carter (dead mail address) 2006-01-27 07:58:59 UTC
The patch will break 2.4 kernels.  We probably shouldn't 
be redefining the macros anyways.  
Comment 3 Bastien Nocera 2006-01-27 08:06:33 UTC
Why would it break 2.4 kernels?
Those values shouldn't have changed, at least not for quota v2.

But if there was a change in the v2 constants in the course of the 2.4 kernels, then:

In sys/quota.h:
/*
 * Select between different incompatible quota versions.
 * Default to the version used by Linux kernel version 2.4.21
 * or earlier (in RHEL version 1 is AS2.1, version 2 is RHEL3 and later).  */

Another way is to define _LINUX_QUOTA_VERSION in source/include/samba_linux_quota.h and #define Q_V2_GETQUOTA Q_GETQUOTA
Comment 4 Lars Müller 2006-01-30 07:51:21 UTC
For a 2.4 kernel we have:
#define Q_GETQUOTA 0x0300  /* get limits and usage */
#define Q_SETQUOTA 0x0400  /* set limits and usage */

For a 2.6 kernel we have:
#define Q_GETQUOTA 0x800007   /* get user quota structure */
#define Q_SETQUOTA 0x800008   /* set user quota structure */

Therefore I suggest the following check done by configure:

a) If we have linux/include/linux/quota.h, then exract the values and use them.
b) If not, us the current Linux kernel values.
Comment 5 Bastien Nocera 2006-01-30 10:59:48 UTC
(In reply to comment #4)
> For a 2.4 kernel we have:
> #define Q_GETQUOTA 0x0300  /* get limits and usage */
> #define Q_SETQUOTA 0x0400  /* set limits and usage */
> 
> For a 2.6 kernel we have:
> #define Q_GETQUOTA 0x800007   /* get user quota structure */
> #define Q_SETQUOTA 0x800008   /* set user quota structure */

That's not the differences between kernels that you're showing, but the differences between versions of the Linux quotas.

$ grep Q_GETQUOTA /usr/include/sys/quota.h
# define Q_GETQUOTA 0x0300      /* get limits and usage */
# define Q_GETQUOTA 0x800007    /* get user quota structure */

From what I can see 0x0D00 and 0x0E00 were never values for Q_V2_GETQUOTA and Q_V2_SETQUOTA, in any of the 2 versions of the Linux quotas.
Comment 6 Björn Jacke 2012-09-05 12:30:34 UTC
Bastien: even if this is a very old bug report, can you say what exactly does not work for you? I just tested Linux quota support with ext3 with good old version 1 quota format and with version 2 (journaled) quota enabled on a 3.5 kernel. Both seems to work as expected.
Comment 7 Bastien Nocera 2012-09-05 13:38:10 UTC
(In reply to comment #6)
> Bastien: even if this is a very old bug report, can you say what exactly does
> not work for you?

Quotas don't work, I get warnings in the log messages.

> I just tested Linux quota support with ext3 with good old
> version 1 quota format and with version 2 (journaled) quota enabled on a 3.5
> kernel. Both seems to work as expected.

You would have asked me that 6 years ago, I might have been able to answer you. As it is, I don't care anymore. I'm sure the customer this was intended to has moved on, or is happy with the distribution patch.
Comment 8 Björn Jacke 2012-09-05 14:09:21 UTC
(In reply to comment #7)
> Quotas don't work, I get warnings in the log messages.

I told you that it worked for me with v1 and v2 quotas and ext3. If it doesn't for you, please describe in detail what does not work for you and attach level 10 log files.


> You would have asked me that 6 years ago, I might have been able to answer you.
> As it is, I don't care anymore. I'm sure the customer this was intended to has
> moved on, or is happy with the distribution patch.

don't blame a free community if you have unhappy customers. That's what http://www.samba.org/samba/support/ is for.
Comment 9 Bastien Nocera 2012-09-05 14:42:13 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > Quotas don't work, I get warnings in the log messages.
> 
> I told you that it worked for me with v1 and v2 quotas and ext3. If it doesn't
> for you, please describe in detail what does not work for you and attach level
> 10 log files.

6 YEARS! I'm not reinstalling RHEL3, sorry.

> > You would have asked me that 6 years ago, I might have been able to answer you.
> > As it is, I don't care anymore. I'm sure the customer this was intended to has
> > moved on, or is happy with the distribution patch.
> 
> don't blame a free community if you have unhappy customers. That's what
> http://www.samba.org/samba/support/ is for.

I don't have unhappy customers, I'm unhappy that a valid patch is getting dismissed.
Comment 10 Björn Jacke 2012-09-05 14:56:00 UTC
Bastien: stop playing a mortally offended kid and stop closing a bugs as WONTFIX that you say that are still valid, please. Instead of grousing around, please show us what is going wrong in your setup.
Comment 11 Björn Jacke 2012-09-07 22:48:58 UTC
I see no more quota issues on linux with 4.0 and upcoming 3.6. Thanks for your help.