[Samba] Unix Extensions + ext3 quotas + df

Juan José Villaplana Querol villapla at si.uji.es
Wed Jul 1 10:52:34 GMT 2009


Hi,

Some time ago, I reported an issue (1) regarding to the "disk free"
to Quotas mapping when Unix Extensions are enabled.

The issue still persists in RHEL 5.3 (samba-3.0.33-3.7.el5).

In the meanwhile I have found a workaround via the attached *ugly*
patch, but an official solution would be appreciated.


Best regards,
                Juanjo

(1) https://bugzilla.samba.org/show_bug.cgi?id=5395

-- 
Juan José Villaplana Querol/Servei d'Informàtica/Universitat Jaume I
Powered by Mutt [http://www.mutt.org/]
Dilbert: ... and starting today, all passwords must contain letters,
         numbers, doodles, sign language and squirrel noises.
-------------- next part --------------
*** source/smbd/trans2.c.orig	2008-11-18 16:37:41.000000000 +0100
--- source/smbd/trans2.c	2009-07-01 12:17:16.000000000 +0200
***************
*** 2583,2612 ****
--- 2583,2642 ----
  					CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP)));
  			break;
  
  		case SMB_QUERY_POSIX_FS_INFO:
  		{
  			int rc;
  			vfs_statvfs_struct svfs;
  
  			if (!lp_unix_extensions()) {
  				return ERROR_NT(NT_STATUS_INVALID_LEVEL);
  			}
  
  			rc = SMB_VFS_STATVFS(conn, ".", &svfs);
  
  			if (!rc) {
+ 
+ 				{
+ 					SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
+ 
+ 					if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) != (SMB_BIG_UINT)-1) {
+ 						block_size = lp_block_size(snum);
+ 						if (bsize < block_size) {
+ 							SMB_BIG_UINT factor = block_size/bsize;
+ 							bsize = block_size; 
+ 							dsize /= factor;
+ 							dfree /= factor;
+ 						}
+ 						if (bsize > block_size) {
+ 							SMB_BIG_UINT factor = bsize/block_size;
+ 							bsize = block_size; 
+ 							dsize *= factor;
+ 							dfree *= factor;
+ 						}
+ 						bytes_per_sector = 512;
+ 						sectors_per_unit = bsize/bytes_per_sector;
+ 
+ 						svfs.BlockSize = bsize;
+ 						svfs.TotalBlocks = dsize;
+ 						svfs.BlocksAvail = dfree;
+ 						svfs.UserBlocksAvail = dfree;
+ 						svfs.TotalFileNodes = 0;
+ 						svfs.FreeFileNodes = 0;
+ 					}
+ 				}
+ 
  				data_len = 56;
  				SIVAL(pdata,0,svfs.OptimalTransferSize);
  				SIVAL(pdata,4,svfs.BlockSize);
  				SBIG_UINT(pdata,8,svfs.TotalBlocks);
  				SBIG_UINT(pdata,16,svfs.BlocksAvail);
  				SBIG_UINT(pdata,24,svfs.UserBlocksAvail);
  				SBIG_UINT(pdata,32,svfs.TotalFileNodes);
  				SBIG_UINT(pdata,40,svfs.FreeFileNodes);
  				SBIG_UINT(pdata,48,svfs.FsIdentifier);
  				DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_POSIX_FS_INFO succsessful\n"));
  #ifdef EOPNOTSUPP
  			} else if (rc == EOPNOTSUPP) {
  				return ERROR_NT(NT_STATUS_INVALID_LEVEL);
  #endif /* EOPNOTSUPP */
  			} else {


More information about the samba mailing list