Bug 832564 - mount --bind file /proc/file doesn't work
mount --bind file /proc/file doesn't work
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: util-linux (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Karel Zak
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-15 14:26 EDT by Branislav Náter
Modified: 2012-07-13 02:53 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-07-13 02:53:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Branislav Náter 2012-06-15 14:26:40 EDT
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 05:07:41 EDT
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 05:29:04 EDT
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 11:04:41 EDT
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 13:31:52 EDT
(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 02:53:57 EDT
Thanks, closing.

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