public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Why does df fail to stat CIFS shares?
Date: Wed, 27 Aug 2014 15:37:00 -0000	[thread overview]
Message-ID: <20140827153700.GL20700@calimero.vinschen.de> (raw)
In-Reply-To: <20140827151536.GK20700@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 3008 bytes --]

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 #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-08-27 15:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 14:36 Alexander Schwab
2014-07-03  9:41 ` Corinna Vinschen
2014-07-03 10:11   ` Alexander Schwab
2014-07-03 10:25     ` Corinna Vinschen
2014-07-03 11:14       ` Alexander Schwab
2014-07-03 11:33       ` Alexander Schwab
2014-08-26  9:15   ` Achim Gratz
2014-08-26 12:46     ` Corinna Vinschen
2014-08-26 15:01       ` Achim Gratz
2014-08-26 15:07         ` Corinna Vinschen
2014-08-26 17:01           ` Achim Gratz
2014-08-27  9:24           ` Achim Gratz
2014-08-27  9:57             ` Corinna Vinschen
2014-08-27 10:10               ` Achim Gratz
2014-08-27 15:06       ` Achim Gratz
2014-08-27 15:15         ` Corinna Vinschen
2014-08-27 15:37           ` Corinna Vinschen [this message]
2014-08-27 16:28             ` Achim Gratz
2014-08-27 17:04               ` Corinna Vinschen
2014-08-27 17:07                 ` Corinna Vinschen
2014-08-28 14:58                 ` Achim Gratz
2014-08-28 15:12                   ` Corinna Vinschen
2014-08-28 12:31               ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140827153700.GL20700@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).