canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.38k stars 931 forks source link

shiftfs on top of cifs is giving inconsistent results #6590

Closed bitranox closed 4 years ago

bitranox commented 4 years ago

Issue description

copy fails to chown files on cifs mounted volumes, bind mounted into the container, on the normal container filesystem, no problem. The file gets actually created, but errors on chown'ing them !

without shiftfs, unprivileged : works, but seldom problems as mentioned below without shiftfs, privileged : works, now testing, cannot say if there are problems, they occur very seldom with shiftfs, privileged : works, but seldom problems as mentioned below with shiftfs, unprivileged : errors as decribed below

Steps to reproduce

on the host :

# fstab
cifs Mount Parameter : //192.168.168.1/softdev /media/srv-main-softdev cifs credentials=/etc/.smb-pwd,iocharset=utf8,file_mode=0777,dir_mode=0777,uid=1000,gid=10800,vers=3.0 0 0

# bind mount in the container , see container configuration below.

lxc exec vm-pydev /bin/bash
cd media/srv-main-softdev/test

ls -la
>total 0
>drwxrwxrwx 2 srvadmin ac-softdev 0 Dec 11 18:14 .
>drwxrwxrwx 2 srvadmin ac-softdev 0 Dec 11 17:28 ..

# touch is ok 
touch ./test.txt
ls -la
> drwxrwxrwx 2 srvadmin ac-softdev 0 Dec 11 18:18 .
> drwxrwxrwx 2 srvadmin ac-softdev 0 Dec 11 17:28 ..
> -rwxrwxrwx 1 srvadmin ac-softdev 0 Dec 11 18:18 test.txt

# but copy fails - it says File exists - in fact it errors when chown the file
cp ./test.txt ./test2.txt
> cp: cannot create regular file './test2.txt': File exists

# and yes - now it exists
ls -la
> drwxrwxrwx 2 srvadmin ac-softdev 0 Dec 11 18:19 .
> drwxrwxrwx 2 srvadmin ac-softdev 0 Dec 11 17:28 ..
> -rwxrwxrwx 1 srvadmin ac-softdev 0 Dec 11 18:18 test.txt
> -rwxrwxrwx 1 srvadmin ac-softdev 0 Dec 11 18:19 test2.txt

# tried that on different hosts on different containers - everywhere the same !

Information to attach

stgraber commented 4 years ago

This isn't a LXD bug as you're not actually interacting with anything LXD controlled here.

This is a kernel bug, quite possibly in shiftfs or in cifs or some interaction of the two.

@brauner should be able to investigate this and sort it out.

bitranox commented 4 years ago

@stgraber stefan, did You pass it to @brauner, or where should i post it ?

stgraber commented 4 years ago

I pinged @brauner, I expect him to respond here. Because we close an issue doesn't mean we don't keep looking at it or track it somewhere else.

I suspect @brauner will want you to file an Ubuntu kernel bug for this at https://launchpad.net/ubuntu/+source/linux/+filebug as that's where development of the shiftfs patchset happens currently.

bitranox commented 4 years ago

@stgraber thanks Stefane, so I wait for @brauner 's requests .... thanks a lot ! Robert, Vienna

brauner commented 4 years ago

I'm looking at this.