Subject: Re: does vfs.generic.usermount work with mount_union?
To: Blair Sadewitz <blair.sadewitz@gmail.com>
From: Oliver Gould <ogould@olix0r.net>
List: current-users
Date: 07/30/2007 17:32:56
Blair, Current-users-

I am running into an annoying issue with mount_union (on 4.99.20).  I
see that Blair described the same problem back in January, though:

On 2007-01-06 16:36 -0500, Blair Sadewitz wrote:
> $ ls -ld /u/git
> drwxrwxr-x  11 blair  wsrc  512 Jan  5 18:49 /u/git
> $ ls -ld build
> drwxr-xr-x  2 blair  users  8704 Jan  4 14:38 build
> $ pwd
> /home/blair
> $ ls -ld .
> drwxr-xr-x  22 blair  users  1536 Jan  6 16:26 .
> $ mount -t union -o -b /u/git build
> mount_union: /u/git on /home/blair/build: Operation not permitted
> 
> $ sysctl vfs.generic.usermount
> vfs.generic.usermount = 1
> 
> Am I missing something here?  I thought that this was supposed to be 
> allowed ...
> 
>  7713      1 mount_union __lstat30("/u", 0x7f7fffffdfa0) = 0
>  7713      1 mount_union __lstat30("/u/git", 0x7f7fffffdfa0) = 0
>  7713      1 mount_union __lstat30("/home", 0x7f7fffffdfa0) = 0
>  7713      1 mount_union __lstat30("/home/blair", 0x7f7fffffdfa0) = 0
>  7713      1 mount_union __lstat30("/home/blair/build", 0x7f7fffffdfa0) = 0
>  7713      1 mount_union mount(0x40117f, 0x7f7fffffe470, 0, 0x7f7fffffec70) 
>  Err
> #1 EPERM
>  7713      1 mount_union write(0x2, 0x7f7fffffd3f0, 0xd) = 13
> 
> Why is this returning EPERM?

I don't see EPERM anywhere in sys/fs/union, so I'm guessing it's one of
the (few) EPERM conditions in sys/kern/vfs_syscalls.c -- that's just an
uninformed guess, though.

> I am using LFS, but I thought since its a UFS filesystem that doesn't 
> matter.

I am trying this on ffs with softdeps enabled, so it's not LFS-specific.

Was there an off-list explanation of this?  Is it PR-worthy?

  - Oliver