This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

1.7.7: Cannot unmount certain user bind mounts


A user mount whose only non-default option is "bind"
cannot be unmounted if its target is a system mount;
please see the end of this email for a test case.

It looks to me as if the MOUNT_SYSTEM bit is copied from
the bind target by mount() in winsup/cygwin/mount.cc.

Perhaps the fix would be to preserve the value of the
MOUNT_SYSTEM bit in the options of the bind mount,
even when copying other options from the bind target.
(Or perhaps, because this is mount() and not
mount_info::from_fstab_line(), one could just
clear MOUNT_SYSTEM unconditionally?  Not sure.)

The test case starts with various bits of information
about the test environment, then a failure to unmount
/bbb, and then two ways to avoid such failure:
mounting /ddd with another non-default option (text)
(probably this prevents copying of mount options
from the bind target), and targeting /fff at another
user mount (/eee) (so that when mount options are
copied, the copied value of MOUNT_SYSTEM is 0):

> build@aeolus-w764c17 ~
> $ uname -a
> CYGWIN_NT-6.1-WOW64 aeolus-w764c17 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin
> 
> build@aeolus-w764c17 ~
> $ cat /etc/fstab
> # For a description of the file format, see the Users Guide
> # http://cygwin.com/cygwin-ug-net/using.html#mount-table
> 
> # This is default anyway:
> # none /cygdrive cygdrive binary,posix=0,user 0 0
> none / cygdrive binary,posix=0,user 0 0
> 
> build@aeolus-w764c17 ~
> $ mount -m
> none / cygdrive binary,posix=0,user 0 0
> 
> build@aeolus-w764c17 ~
> $ mount
> C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
> C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
> C:/cygwin on / type ntfs (binary,auto)
> C: on /c type ntfs (binary,posix=0,user,noumount,auto)
> 
> build@aeolus-w764c17 ~
> $ mkdir /aaa /bbb /ccc /ddd /eee /fff
> 
> build@aeolus-w764c17 ~
> $ mount -o bind /aaa /bbb
> 
> build@aeolus-w764c17 ~
> $ umount /bbb
> umount: /bbb: Operation not permitted
> 
> build@aeolus-w764c17 ~
> $ mount -o bind,text /ccc /ddd
> 
> build@aeolus-w764c17 ~
> $ umount /ddd
> 
> build@aeolus-w764c17 ~
> $ mount c:/ /eee
> 
> build@aeolus-w764c17 ~
> $ mount -o bind /eee /fff
> 
> build@aeolus-w764c17 ~
> $ umount /fff
> 
> build@aeolus-w764c17 ~
> $

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]