samba-in-kubernetes / samba-operator

An operator for a Samba as a service on PVCs in kubernetes
Apache License 2.0
120 stars 24 forks source link

smbtorture failure - smb2.rw.invalid #192

Open spuiuk opened 2 years ago

spuiuk commented 2 years ago

When testing against the smb-operator samba server using a rook supplied cephfs pvc, we see a failure when running the smb2.rw.invalid test.

[root@smbclient samba-integration]# /bin/smbtorture --fullname --target=samba3 --user=sambauser%samba //10.244.2.14/smbshare3  smb2.rw.invalid
smbtorture 4.15.5
Using seed 1651410917
time: 2022-05-01 13:15:17.325545
test: smb2.rw.invalid
time: 2022-05-01 13:15:17.327756
dos charset 'CP850' unavailable - using ASCII
time: 2022-05-01 13:15:17.444662
failure: smb2.rw.invalid [
../../source4/torture/smb2/read_write.c:331: status was NT_STATUS_DISK_FULL, expected NT_STATUS_OK: Incorrect status
]

The part of the code with the failure is at

        w.in.file.handle = h;    
        w.in.offset = 0xfffffff0000 - 1; /* MAXFILESIZE - 1 */
        w.in.data.data = buf;
        w.in.data.length = 1;
        status = smb2_write(tree, &w);
        if (TARGET_IS_SAMBA3(torture) || TARGET_IS_SAMBA4(torture)) {
                CHECK_STATUS(status, NT_STATUS_OK);
                CHECK_VALUE(w.out.nwritten, 1);
        } else {
                CHECK_STATUS(status, NT_STATUS_DISK_FULL);
        }

This is not seen with an ext4 underlying filesystem.

Versions: samba-4.15.6-0.fc35.x86_64

mount point: 10.111.173.90:6789,10.110.224.62:6789,10.101.104.103:6789:/volumes/csi/csi-vol-0cb59f87-c54e-11ec-ad3d-1e1dd7acb57d/ae264282-34b6-4255-a25c-6d8f60d9fc5e /mnt/dc189f61-d413-4b76-bb99-4b86beb30c0a ceph rw,relatime,name=csi-cephfs-node,secret=,acl,mds_namespace=myfs 0 0

spuiuk commented 2 years ago

Notes:

To create a new share to test on the operator:

[root@smbshare3-0 /]# mkdir /share/
mkdir: cannot create directory ‘/share/’: File exists
[root@smbshare3-0 /]# chmod 777 /share
[root@smbshare3-0 /]# net conf addshare share /share writeable=y 
[root@smbshare3-0 /]# net conf list
[global]
    disable spoolss = yes
    fileid:algorithm = fsid
    load printers = no
    printcap name = /dev/null
    printing = bsd
    smb ports = 445
    vfs objects = fileid
    netbios name = smbshare3

[smbshare3]
    path = /mnt/dc189f61-d413-4b76-bb99-4b86beb30c0a
    read only = no

[share]
    path = /share
    guest ok = no
    read only = no
spuiuk commented 2 years ago

Reproducer:

#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>

int main( int argc, char **argv )
{
        int fd;

        if( argc < 2 ){
                fprintf(stderr, "Usage %s <filename>\n\n",argv[0]);
                exit(1);
        }

        if((fd = open( argv[1], O_CREAT| O_RDWR| O_EXCL, 0777)) == -1) {
                fprintf(stderr,"Error opening file:%d: %s\n", errno, strerror(errno));
                exit(2);
        }

    if(lseek(fd, 0xfffffff0000 - 1, SEEK_SET) == -1) {
                fprintf(stderr,"Error seeking offset:%d: %s\n", errno, strerror(errno));
                exit(2);
        }
        if(write(fd, "a", 1)) {
                fprintf(stderr,"Error writing:%d: %s\n", errno, strerror(errno));
                exit(2);
        }

        fprintf(stderr, "    -- Done\n");

    return 0;
}

On the container samba within the samba-operator

First with the cephfs share

[root@smbshare3-0 /]# grep /mnt /proc/mounts
10.111.173.90:6789,10.110.224.62:6789,10.101.104.103:6789:/volumes/csi/csi-vol-0cb59f87-c54e-11ec-ad3d-1e1dd7acb57d/ae264282-34b6-4255-a25c-6d8f60d9fc5e /mnt/dc189f61-d413-4b76-bb99-4b86beb30c0a ceph rw,relatime,name=csi-cephfs-node,secret=<hidden>,acl,mds_namespace=myfs 0 0
[root@smbshare3-0 /]# /tmp/write_test /mnt/dc189f61-d413-4b76-bb99-4b86beb30c0a/test
Error seeking offset:22: Invalid argument

Then on /tmp

[root@smbshare3-0 /]# /tmp/write_test /tmp/test
    -- Done
[root@smbshare3-0 /]# ls -lh /tmp/test
-rwxr-xr-x 1 root root 16T May  1 13:51 /tmp/test
spuiuk commented 2 years ago

Reported for cephfs at https://tracker.ceph.com/issues/55510

obnoxxx commented 1 year ago

@spuiuk wrote:

https://tracker.ceph.com/issues/55510

there was a comment this is a limitation imposed by the ceph MDS by Jeff in the tracker and a suggested workaround. Not sure how applicable it is since it seems to involves a configuration change for the ceph setup ...

spuiuk commented 1 year ago

Yes. We either need to set this using the cephtool container or setup flapping.cephfs to ignore this for cephfs. We are sure to hit more such issues once we start testing cephfs with sit-test-cases.