OpenSolaris

Printable Version Enter a New Search
Bug ID 6663585
Synopsis 'zfs unshare' & 'zfs unmount' should only support 'filesystem' or 'mountpoint' as argument
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:zfs
Keywords
Responsible Engineer Sachin Gaikwad
Reported Against
Duplicate Of
Introduced In solaris_nevada
Commit to Fix snv_98
Fixed In snv_98
Release Fixed solaris_nevada(snv_98) , solaris_10u8(s10u8_01) (Bug ID:2176166)
Related Bugs 6663566 , 6663593
Submit Date 15-February-2008
Last Update Date 22-April-2009
Description
I must admit 'zfs unshare' and 'zfs unmount' is very powerful, 
it could accept the exising directory/file as the parameter and continue with the operation

# zfs create tank/fs
# touch /tank/fs/file.0
# zfs mount
tank                            /tank
tank/fs                         /tank/fs
# zfs unmount /tank/fs/file.0
# zfs mount
tank                            /tank

It determine the location of the given file, and lookup until some mountpoint founded,
and try unmount from that mountpoint.

It's quite powerful and might be abused, such as in zfs root filesystem. (b05)

# zfs mount
rootpool/BE/zfs1                /
rootpool/BE/zfs1/usr            /usr
rootpool/BE/zfs1/opt            /opt
rootpool/BE/zfs1/var            /var
rootpool                        /rootpool
rootpool/BE                     /rootpool/BE

# mkdir /a
# touch /a/file.0
# zfs unmount /a/file.0
cannot unmount /var: Devicy busy

It report cannot unmount /var, is actually means it intends to unmount '/', and all the sub-filesystem as '/var', '/usr', '/opt'.

That sounds weird, for my purpose is only to unmount an existing file/dir, it could return an error for it's not a valid mountpoint, but I'm not want to unmount '/'...

The worse thing is, 'zfs unmount -f /a/file.0' could eventuall unmount '/',
just as type this command directly.

# zfs unmount -f /
cannot unmount '/'
Feb 14 23:32:25 svc.startd[7]: Could not log for svc:/system/console-login:default: open(/var/svc/log//system-console-login:default.log) failed with No such file or directory.
Feb 14 23:32:25 svc.startd[851]: makeutx failed, retrying: No such file or directory

(system dead there...)

And, 'zfs unshare' has a similar issue, 

# zfs set sharenfs=on tank
# touch /tank/file.0
# zfs unshare /tank/file.0
# share
-@tank          /tank   rw   ""  
# zfs unshare /tank/file.0
# echo $?
0
# zfs unshare /tank/file.1
cannot unshare '/tank/file.1': No such file or directory
# unshare /tank/file.0
/tank/file.0: bad path
# echo $?
32

Compare with the different behavior of unshare(1M) and 'zfs unshare',
'zfs unshare' also far beyond the control and may cause unexpect behavior under zfsboot.

If according to the usage of command, these 2 sub-command should only accept 
filesystem or mountpoint as the parameter, I'd like to see it follow the rules.
Work Around
N/A
Comments
N/A