Bug 3747 - XFS Group Quotas not being transmitted to Windows XP with Samba 3.0.22
Summary: XFS Group Quotas not being transmitted to Windows XP with Samba 3.0.22
Status: RESOLVED INVALID
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.22
Hardware: x86 Windows XP
: P3 major
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-02 20:54 UTC by Andy Liebman
Modified: 2010-04-26 03:10 UTC (History)
2 users (show)

See Also:


Attachments
Logs at Debug level 10 for smbs, nmbd and winbindd (23.79 KB, application/octet-stream)
2006-09-18 22:43 UTC, Michael Carmody
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Liebman 2006-05-02 20:54:43 UTC
With Samba 3.0.22 running under Linux,  XFS group quota information is not being passed on to Windows XP SP2 Clients. For example, if I have a 4 TB volume and in that volume I create a Samba Share that belongs exclusively to one Linux group and set the XFS group quota to 400 GB, Windows Explorer (in Properties) reports that the size of the share is 4 TB, and that the remaining space is 4 TB minus the space used in the share. This is not desireable behavior, and I have never seen Samba behave like that in the past. 

If I uninstall 3.0.22 and in its place install Samba 3.0.13, in Windows Explorer the "Properties" for the share show that the size is 400 GB -- which is the desired behavior. Similarly, applications that report on the space left on a network drive show that the remaining space is 400 GB minus space used. 

The different behaviors between Samba 3.0.13 and 3.0.22 is completely reproducible. This does not seem to be the same issue that was reported on the Samba list regarding XFS quotas and LVM. 

I doubt that it makes any difference but just in case, I'm running Mandriva 2006 with a custom 2.6.14.6 kernel.
Comment 1 Jeremy Allison 2006-07-03 18:47:45 UTC
Ok, I just tested 3.0.23 release branch with an XFS filesystem with a group quota and doing an ls on smbclient returned the correct disk free info on a SuSE Linux 9.2 box with  2.6.11.4 kernel.

So I know the code does work at least for one version of the kernel. Can you get a debug level 10 of a test group with a low quota (4000 blocks or so) showing XP doing a disk free query ?

Jeremy.
Comment 2 Michael Carmody 2006-09-18 22:42:25 UTC
I am having the sam problem with samab 3.0.22 on Ubuntu. As this bug seems to have  stalled I am submitting the requested debug logs.

I am about to compile the source to see if 3.0.23c has this fixed, but changelogs and release notes don't seem to mention it.
Comment 3 Michael Carmody 2006-09-18 22:43:41 UTC
Created attachment 2145 [details]
Logs at Debug level 10 for smbs, nmbd and winbindd
Comment 4 Andy Liebman 2006-12-01 20:33:12 UTC
I believe I have gotten to the bottom of this bug, at least for Mandriva. It seems that since 3.0.20b (when I began to see this problem), Mandriva packages have included two patches related to quotas: 

       quota.patch
       samba3-default-quota-ignore-error-01.diff

They are still included in the Mandriva 3.0.23d SRPM from Cooker, and when you build the RPMS on Mandriva 2006 or 2007, XFS Group Quotas don't work. 

When I removed these two patches and rebuilt Mandriva's 3.0.23d, XFS Quotas DO work again. I wrote to Buchan Milne, maintainer of Mandriva's Samba packages, and he said the patches were added by a user who said they were required to get XFS Quotas to Work. 

I investigated further an found that the patch that kills XFS Group Quotas was the "quota.patch" and not "samba3-default-quota-ignore-error-01.diff" (I have no idea what the latter does). Looking at "quota.patch", I see that it adds the following line of code to /source/lib/sysquotas_linux.c: 

        D.dqb_valid = QIF_LIMITS;

But looking at sysquotas_linux.c as it comes from Samba.org, it seems that line is already present in the position where the patch wants to put it, and it has been present for quite some time. 

When I ran the patch manually, it seems the line of code specified in "quota.patch" was getting inserted in the wrong place, 134 lines earlier in the sysquotas_linux.c file -- where there happens to be the exact same lines of code before and after. I don't know that much about patching, but I suppose if you don't specify otherwise, if the code in a patch already exists in the target file, "patch" will look for another appropriate place to put it. And unfortunately this file has the right combination of lines of code to provide a "second home" not too far away. I imagine having this code in the wrong place could break what it was originally meant to fix??? I hope this solves something that has been a mystery to ME for a year. 

Here are the details of what happened when I ran "patch" manually. 

patch samba-3.0.23d/source/lib/sysquotas_linux.c quota.patch
patching file samba-3.0.23d/source/lib/sysquotas_linux.c
Hunk #1 succeeded at 260 (offset -134 lines).


Starting at line 239:

/****************************************************************************
Abstract out the v2 Linux quota set calls.
****************************************************************************/
static int sys_set_linux_v2_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp)
{
   int ret = -1;
   uint32 qflags = 0;
   uint32 oldqflags = 0;
   struct v2_kern_dqblk D;
   SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;

   ZERO_STRUCT(D);

   if (bsize == dp->bsize) {
       D.dqb_bsoftlimit = dp->softlimit;
       D.dqb_bhardlimit = dp->hardlimit;
       D.dqb_ihardlimit = dp->ihardlimit;
       D.dqb_isoftlimit = dp->isoftlimit;
   } else {
       D.dqb_bsoftlimit = (dp->softlimit*dp->bsize)/bsize;
       D.dqb_bhardlimit = (dp->hardlimit*dp->bsize)/bsize;
       D.dqb_ihardlimit = (dp->ihardlimit*dp->bsize)/bsize;
       D.dqb_isoftlimit = (dp->isoftlimit*dp->bsize)/bsize;
   }
   D.dqb_valid = QIF_LIMITS;          #### NOTE:  This is the line inserted by the Mandriva patch ####

   qflags = dp->qflags;

   switch (qtype) {
       case SMB_USER_QUOTA_TYPE:
           DEBUG(10,("sys_set_linux_v2_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
               path, bdev, (unsigned)id.uid));

           ret = quotactl(QCMD(Q_V2_SETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D);
           break;

.....

Starting at line 374

****************************************************************************
Abstract out the gen Linux quota set calls.
****************************************************************************/
static int sys_set_linux_gen_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp)
{
   int ret = -1;
   uint32 qflags = 0;
   uint32 oldqflags = 0;
   struct if_dqblk D;
   SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;

   ZERO_STRUCT(D);

   if (bsize == dp->bsize) {
       D.dqb_bsoftlimit = dp->softlimit;
       D.dqb_bhardlimit = dp->hardlimit;
       D.dqb_ihardlimit = dp->ihardlimit;
       D.dqb_isoftlimit = dp->isoftlimit;
   } else {
       D.dqb_bsoftlimit = (dp->softlimit*dp->bsize)/bsize;
       D.dqb_bhardlimit = (dp->hardlimit*dp->bsize)/bsize;
       D.dqb_ihardlimit = (dp->ihardlimit*dp->bsize)/bsize;
       D.dqb_isoftlimit = (dp->isoftlimit*dp->bsize)/bsize;
   }
   D.dqb_valid = QIF_LIMITS;        ####  This is the line that is already included in the Samba.org version ####

   qflags = dp->qflags;

   switch (qtype) {
       case SMB_USER_QUOTA_TYPE:
           DEBUG(10,("sys_set_linux_gen_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n",
               path, bdev, (unsigned)id.uid));

           ret = quotactl(QCMD(Q_SETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D);
           break; 

Comment 5 Stefan Metzmacher 2010-04-26 03:10:16 UTC
Looks like a Mandriva specific bug