Description of problem: running df <automounted path> may not show the disk space usage as expected. Version-Release number of selected component (if applicable): coreutils-5.97-22 How reproducible: always Steps to Reproduce: 1. Export a NFS volume on a server, e.g. write something like the following to /etc/exports: /tmp *(rw) 2. On the client machine configure the autofs: Add to the /etc/auto.master (the --ghost parameter is important): /misc /etc/auto.misc --ghost And to /etc/auto.misc ('server' is the machine used in step 1): test server:/tmp 3. On the client machine run the following (make sure /misc/test is not mounted yet): df /misc/test; df /misc/test Actual results: [root@hp-dl360-02 ~]# df /misc/test; df /misc/test Filesystem 1K-blocks Used Available Use% Mounted on - 0 0 0 - /misc Filesystem 1K-blocks Used Available Use% Mounted on /tmp 15013664 7302844 6935860 52% /misc/test (i.e, the first run doesn't mount the automounted volume before getting the disk usage info) Expected results: [root@hp-dl360-02 ~]# df /misc/test; df /misc/test Filesystem 1K-blocks Used Available Use% Mounted on /tmp 15013664 7302844 6935860 52% /misc/test Filesystem 1K-blocks Used Available Use% Mounted on /tmp 15013664 7302844 6935860 52% /misc/test Additional info: According to Ian Kent who maintains autofs the problem is in the df utility which uses only stat/stafs calls that do not trigger the mount of the filesystem. He has also provided an example patch that uses diropen to mount the filesystem.
Created attachment 341431 [details] Example patch This is patch for the RHEL-5 coreutils that calls diropen() to mount the filesystem. Replacing diropen() with open() seems to work too. I'm not sure whether this is the best way to solve the problem but it looks to work OK.
Hi Tomas, It appears that automounters have changed since that part of df.c was written. Before, using "stat" was sufficient to cause the automounter to do its job. If "open" works, please use that, and then, upon success, use the resulting file descriptor in a call to fstat in place of the existing "stat" call. I.e., your patch is along the right lines, but use open instead of diropen. And declare any new variables (like int fd;) in the innermost scope possible. Please use these flags when calling open: O_RDONLY | O_NOCTTY | O_NONBLOCK It'd be great if you would submit the patch upstream, following guidelines in http://git.sv.gnu.org/cgit/coreutils.git/plain/HACKING Thanks!
Actually, O_NONBLOCK is probably best omitted in this context.
Created attachment 341439 [details] Ian's patch rewritten according to Jim's instructions.
Upstream commit: http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=dbd17157d7e693b8de9737f802db0e235ff5a3e6
~~ Attention - RHEL 5.4 Beta Released! ~~ RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner! If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity. Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value. Questions can be posted to this bug or your customer or partner representative.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2009-1262.html