Bug 832564

Summary: mount --bind file /proc/file doesn't work
Product: Red Hat Enterprise Linux 7 Reporter: Branislav Náter <bnater>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-13 06:53:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Branislav Náter 2012-06-15 18:26:40 UTC
Description of problem:
I have no luck with mouning file to /proc directory. I'm using this method to fake some date when testing utilities from sysstat, procps packages. This works fine on RHEL6.

Version-Release number of selected component (if applicable):
util-linux-2.21.1-1.el7

Steps to Reproduce:
1. touch file
2. mount --bind file /proc/stat
  
Actual results:
mount: mount(2) failed: No such file or directory

Expected results:
file mounted

Comment 1 Karel Zak 2012-06-18 09:07:41 UTC
I'm not able to reproduce this problem:

# cat /proc/stat > ~/mystat; mount --bind ~/mystat /proc/stat; findmnt /proc/stat; umount /proc/stat; rm -f ~/mystat;
TARGET     SOURCE                                       FSTYPE OPTIONS
/proc/stat /dev/mapper/vg_wycliff-lv_root[/root/mystat] ext4   rw,relatime,seclabel,user_xattr

util-linux-2.21.1-1.el7.x86_64
kernel 3.3.0-0.13.el7.x86_64

Comment 2 Branislav Náter 2012-06-18 09:29:04 UTC
Interesting. I was able to reproduce one more time right now. But then it starts to work...

[root@x86-64-v05 ~]# touch file
[root@x86-64-v05 ~]# mount --bind file /proc/stat
mount: mount(2) failed: No such file or directory
[root@x86-64-v05 ~]# uname -r
3.3.0-0.13.el7.x86_64
[root@x86-64-v05 ~]# mount --bind file /proc/stat
[root@x86-64-v05 ~]# umount /proc/stat

Sorry, you can close it for now. Thanks

Comment 3 Branislav Náter 2012-06-19 15:04:41 UTC
Hi,

it seems to be consequence of other issue. I'm not able to unmount <file> using its name: umount <file>

RHEL6:
# pwd
/root
# touch file
# mount --bind file /proc/stat
# umount file
#

RHEL7:
# pwd
/root
# mount --bind file /proc/stat
# umount file
umount: /root/file: not mounted

Aditional info:
RHEL6
# mount | grep stat
/root/file on /proc/stat type none (rw,bind)

RHEL7
# mount | grep stat
/dev/mapper/vg_auto--x86--64--002-lv_root on /proc/stat type ext4 (rw,relatime,seclabel,user_xattr,barrier=1,data=ordered)


So basicaly I'd like to know if this is a bug or feature (and I have to rewrite my tests).

Comment 4 Karel Zak 2012-07-12 17:31:52 UTC
(In reply to comment #3)
> RHEL6
> # mount | grep stat
> /root/file on /proc/stat type none (rw,bind)
> 
> RHEL7
> # mount | grep stat
> /dev/mapper/vg_auto--x86--64--002-lv_root on /proc/stat type ext4
> (rw,relatime,seclabel,user_xattr,barrier=1,data=ordered)

This is expected on systems without mtab file (e.g. RHEL7).

> So basicaly I'd like to know if this is a bug or feature (and I have to
> rewrite my tests).

man umount:

A file system is specified by giving the directory where it has been mounted. Giving the special device on which the file system lives may also work, but is obsolete, mainly because it will fail ... 

Please, use "umount <mountpoint>" everywhere.

Comment 5 Branislav Náter 2012-07-13 06:53:57 UTC
Thanks, closing.