Bug 497830 - 'df' doesn't wait for automount with indirect maps that use browse option
Summary: 'df' doesn't wait for automount with indirect maps that use browse option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: coreutils
Version: 5.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ondrej Vasik
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-27 13:43 UTC by Tomas Smetana
Modified: 2018-10-20 01:56 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 09:17:24 UTC
Target Upstream Version:


Attachments (Terms of Use)
Example patch (820 bytes, patch)
2009-04-27 13:48 UTC, Tomas Smetana
no flags Details | Diff
Ian's patch rewritten according to Jim's instructions. (772 bytes, patch)
2009-04-27 15:03 UTC, Tomas Smetana
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1262 normal SHIPPED_LIVE coreutils bug fix update 2009-09-01 09:22:04 UTC

Description Tomas Smetana 2009-04-27 13:43:01 UTC
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.

Comment 1 Tomas Smetana 2009-04-27 13:48:18 UTC
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.

Comment 2 Jim Meyering 2009-04-27 14:18:46 UTC
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!

Comment 3 Jim Meyering 2009-04-27 14:33:24 UTC
Actually, O_NONBLOCK is probably best omitted in this context.

Comment 4 Tomas Smetana 2009-04-27 15:03:04 UTC
Created attachment 341439 [details]
Ian's patch rewritten according to Jim's instructions.

Comment 11 Chris Ward 2009-07-03 18:42:55 UTC
~~ 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.

Comment 14 errata-xmlrpc 2009-09-02 09:17:24 UTC
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


Note You need to log in before you can comment on or make changes to this bug.