[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#969223: Can't rm directory on overlayfs in userns



On Wed 03 Mar 2021 17:33:16 GMT Shengjing Zhu write:
> 
> On Wed, Mar 3, 2021 at 3:40 PM Nicolas Schier <nicolas@fjasle.eu> wrote:
> > > [2]: https://lore.kernel.org/linux-unionfs/CAJfpegsiuf8ib5cvVrr=zHZ+Xu7BMMTT2eYapsEUdmPcRBUiwQ@mail.gmail.com/T/#t
> >
> > The overlay fs patchset [2] has been merged and with v5.10.13 (tested
> > on linux-image-5.10.0-3-arm64) the issue is no more reproducible for
> > me.  Might you want to re-check on your site?
> >
> 
> If I understand correctly, the upstream patch is merged into the v5.11 tree.

Sorry.  Yes, you're right.

> And I still can reproduce the error on the Debian v5.10 kernel.

That confuses me quite a bit.  I did it once again on an ext4 mount 
(still the 5.10.0-3-arm64 kernel):

  nsc@lillesand:/tmp$ cat /sys/module/overlay/parameters/permit_mounts_in_userns 
  Y
  nsc@lillesand:/tmp$ mkdir -p test/lower/a test/merged test/upper test/work
  nsc@lillesand:/tmp$ uname -a | tee test/lower/a/a
  Linux lillesand 5.10.0-3-arm64 #1 SMP Debian 5.10.13-1 (2021-02-06) aarch64 GNU/Linux
  nsc@lillesand:/tmp$ unshare -m -U -r
  root@lillesand:/tmp# mount -t overlay -o rw,lowerdir=/tmp/test/lower,upperdir=/tmp/test/upper,workdir=/tmp/test/work overlay /tmp/test/merged
  root@lillesand:/tmp# rm -rf test/merged/a
  root@lillesand:/tmp# find test -ls
    1597776      4 drwxr-xr-x   6 root     root         4096 mars  3 08:24 test
    1973978      4 drwxr-xr-x   2 root     root         4096 mars  3 08:27 test/upper
    2099881      0 c---------   1 root     root       0,   0 mars  3 08:27 test/upper/a
    1973978      4 drwxr-xr-x   1 root     root         4096 mars  3 08:27 test/merged
    1714388      4 drwxr-xr-x   3 root     root         4096 mars  3 08:24 test/lower
    1714389      4 drwxr-xr-x   2 root     root         4096 mars  3 08:27 test/lower/a
    1714393      4 -rw-r--r--   1 root     root           86 mars  3 10:48 test/lower/a/a
    1973979      4 drwxr-xr-x   3 root     root         4096 mars  3 10:48 test/work
    2099880      4 d---------   2 root     root         4096 mars  3 10:48 test/work/work
  root@lillesand:/tmp# 

Do you see any kernel log message from overlay fs?  Might it depend on 
the underlying filesystem? Can you create a white-out char dev node 
manually?

> And another thing is that the upstream patch introduces a new mount
> option, userxattr, instead of module parameter.

The 'permit_mounts_in_userns' module parameter becomes superfluous with 
v5.11 as overlay fs mounts will then always be enabled in userspace 
namespace.

Kind regards,
Nicolas

-- 
epost: nicolas@fjasle.eu               irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

Attachment: signature.asc
Description: PGP signature


Reply to: