This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does df fail to stat CIFS shares?


On Aug 27 17:15, Corinna Vinschen wrote:
> On Aug 27 15:06, Achim Gratz wrote:
> > Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> > > The call to NtQueryVolumeInformationFile() in
> > > fhandler_disk_file::fstatvfs() in fhandler_disk_file.cc (line 737ff),
> > > fails with STATUS_INVALID_PARAMETER.  This is a NetApp bug, but we may
> > > be able to workaround it.
> > 
> > The bug (if there is one) is that the driver should return
> > STATUS_INVALID_INFO_CLASS since it quite obviously doesn't support that info
> > class request.  Falling back to FileFsSizeINformation does and returns
> > sensible values for all NetApp volumes.  Since at least all NetApp volumes
> > here run without quotas anyway, no information loss occurs IIUC.
> 
> -v, please.  What means "obviously" here?  Did you ask Netapp?
> 
> The FileFsFullSizeInformation class is *old*, it has been introduced
> with Windows 2000.  Did you test all combinations I asked you for?  Can
> you provide detailed results?  It might help to find a working combination.

Btw., one other hare-brained idea would be if the Netapp FS has a
somewhat different idea of the size of FILE_FS_FULL_SIZE_INFORMATION,
maybe due to a misunderstanding in alignment.  What you could try is
to make full_fsi a pointer:

  PFILE_FS_FULL_SIZE_INFORMATION full_fsi =
  	(PFILE_FS_FULL_SIZE_INFORMATION)
	alloca (2 * sizeof (FILE_FS_FULL_SIZE_INFORMATION));

and then change all "full_fsi." to "full_fsi->"

If nothing else works, try this workaround for size:

Index: fhandler_disk_file.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_disk_file.cc,v
retrieving revision 1.401
diff -u -p -r1.401 fhandler_disk_file.cc
--- fhandler_disk_file.cc	27 Aug 2014 11:42:17 -0000	1.401
+++ fhandler_disk_file.cc	27 Aug 2014 15:36:44 -0000
@@ -800,6 +800,26 @@ fhandler_disk_file::fstatvfs (struct sta
 	}
       ret = 0;
     }
+  else if (status == STATUS_INVALID_PARAMETER /* Netapp */
+	   || status == STATUS_INVALID_INFO_CLASS)
+    {
+      FILE_FS_SIZE_INFORMATION fsi;
+      status = NtQueryVolumeInformationFile (fh, &io, &fsi, sizeof fsi,
+					     FileFsSizeInformation);
+      if (NT_SUCCESS (status))
+	{
+	  sfs->f_bsize = fsi.BytesPerSector * fsi.SectorsPerAllocationUnit;
+	  sfs->f_frsize = sfs->f_bsize;
+	  sfs->f_blocks = (fsblkcnt_t) fsi.TotalAllocationUnits.QuadPart;
+	  sfs->f_bfree = sfs->f_bavail =
+	    (fsblkcnt_t) fsi.AvailableAllocationUnits.QuadPart;
+	  ret = 0;
+	}
+      else
+	debug_printf ("%y = NtQueryVolumeInformationFile"
+		      "(%S, FileFsSizeInformation)", 
+		      status, pc.get_nt_native_path ());
+    }
   else
     debug_printf ("%y = NtQueryVolumeInformationFile"
 		  "(%S, FileFsFullSizeInformation)", 


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpKLlbxsDSzM.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]