delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/03/13:22:47

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
X-USANET-Source: 165.212.120.254 IN aeolus AT electric-cloud DOT com s1hub2.EXCHPROD.USA.NET
X-USANET-MsgId: XID705oicRwf7634Xo2
From: John Carey <aeolus AT electric-cloud DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Date: Fri, 3 Sep 2010 17:19:26 +0000
Subject: 1.7.7: Cannot unmount certain user bind mounts
Message-ID: <3C031C390CBF1E4A8CE1F74DE7ECAF3A158EDA702F@MBX8.EXCHPROD.USA.NET>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 AT 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
>=20
> build AT 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
>=20
> # This is default anyway:
> # none /cygdrive cygdrive binary,posix=3D0,user 0 0
> none / cygdrive binary,posix=3D0,user 0 0
>=20
> build AT aeolus-w764c17 ~
> $ mount -m
> none / cygdrive binary,posix=3D0,user 0 0
>=20
> build AT 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=3D0,user,noumount,auto)
>=20
> build AT aeolus-w764c17 ~
> $ mkdir /aaa /bbb /ccc /ddd /eee /fff
>=20
> build AT aeolus-w764c17 ~
> $ mount -o bind /aaa /bbb
>=20
> build AT aeolus-w764c17 ~
> $ umount /bbb
> umount: /bbb: Operation not permitted
>=20
> build AT aeolus-w764c17 ~
> $ mount -o bind,text /ccc /ddd
>=20
> build AT aeolus-w764c17 ~
> $ umount /ddd
>=20
> build AT aeolus-w764c17 ~
> $ mount c:/ /eee
>=20
> build AT aeolus-w764c17 ~
> $ mount -o bind /eee /fff
>=20
> build AT aeolus-w764c17 ~
> $ umount /fff
>=20
> build AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019