[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#699321: marked as done (libc6: statvfs() calling stat() unnecessarily (2.6.36))



Your message dated Thu, 17 Dec 2015 19:47:29 +0100
with message-id <20151217184729.GA16490@aurel32.net>
and subject line Re: Bug#699321: libc6: statvfs() calling stat() unnecessarily (2.6.36)
has caused the Debian Bug report #699321,
regarding libc6: statvfs() calling stat() unnecessarily (2.6.36)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
699321: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699321
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6
Version: 2.13-37
Severity: normal

Running statvfs() my machine still results in stat() being called, and from
what I can tell, it's being called _before_ __statvfs_getflags() is called.   I
have not yet determined where stat() is called, but strace on my C program (see
below) confirms stat() is called after statfs(), but before the fprintf() I
added in sysdeps/unix/sysv/linux/internal_statvfs.c:

  /*
   * I added the following fprintf() in my local build and confirmed
   * ST_VALID (0x20) is set here by my 3.7.5 kernel:
   */
   fprintf(stderr, "f_flags: 0x%lx\n", fsbuf->f_flags);

#ifndef __ASSUME_STATFS_F_FLAGS
  if ((fsbuf->f_flags & ST_VALID) == 0)
    /* Determining the flags is tricky.  We have to read /proc/mounts or
       the /etc/mtab file and search for the entry which matches the given
       file.  The way we can test for matching filesystem is using the
       device number.  */
    buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
  else
#endif
    buf->f_flag = fsbuf->f_flags ^ ST_VALID;

Here is my trivial C program I straced to confirm stat() being called
after statfs():
--------------------------------------------
/* gcc -o statvfs -Wall statvfs.c */
#include <sys/statvfs.h>
int main(void)
{
	struct statvfs svf;
	statvfs("/mnt", &svf);
	return 0;
}
--------------------------------------------

I do not expect stat() to be called with statvfs(), since ST_VALID helps
avoid this expensive check.  stat() also has detrimental effects on
unreachable/slow network mounts.

-- System Information:
Debian Release: 7.0
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.7.5 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6 depends on:
ii  libc-bin  2.13-37
ii  libgcc1   1:4.7.2-5

libc6 recommends no packages.

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]  1.5.49
ii  glibc-doc              2.13-37
ii  locales                2.13-37

-- debconf information excluded

--- End Message ---
--- Begin Message ---
Version: 2.21-1

On 2013-01-30 08:33, Eric Wong wrote:
> Package: libc6
> Version: 2.13-37
> Severity: normal
> 
> Running statvfs() my machine still results in stat() being called, and from
> what I can tell, it's being called _before_ __statvfs_getflags() is called.   I
> have not yet determined where stat() is called, but strace on my C program (see
> below) confirms stat() is called after statfs(), but before the fprintf() I
> added in sysdeps/unix/sysv/linux/internal_statvfs.c:
> 
>   /*
>    * I added the following fprintf() in my local build and confirmed
>    * ST_VALID (0x20) is set here by my 3.7.5 kernel:
>    */
>    fprintf(stderr, "f_flags: 0x%lx\n", fsbuf->f_flags);
> 
> #ifndef __ASSUME_STATFS_F_FLAGS
>   if ((fsbuf->f_flags & ST_VALID) == 0)
>     /* Determining the flags is tricky.  We have to read /proc/mounts or
>        the /etc/mtab file and search for the entry which matches the given
>        file.  The way we can test for matching filesystem is using the
>        device number.  */
>     buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
>   else
> #endif
>     buf->f_flag = fsbuf->f_flags ^ ST_VALID;
> 
> Here is my trivial C program I straced to confirm stat() being called
> after statfs():
> --------------------------------------------
> /* gcc -o statvfs -Wall statvfs.c */
> #include <sys/statvfs.h>
> int main(void)
> {
> 	struct statvfs svf;
> 	statvfs("/mnt", &svf);
> 	return 0;
> }
> --------------------------------------------
> 
> I do not expect stat() to be called with statvfs(), since ST_VALID helps
> avoid this expensive check.  stat() also has detrimental effects on
> unreachable/slow network mounts.

This bug has been fixed in glibc version 2.20. I am therefore closing
the bug.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

--- End Message ---

Reply to: