versity / versitygw

versity s3 gateway
https://www.versity.com/products/versitygw/
Apache License 2.0
176 stars 21 forks source link

Upload failure in posix backend when filesystem is cifs. #392

Closed rhamon closed 4 months ago

rhamon commented 8 months ago

The bug Cannot upload files to versitygw when using the posix backend on cifs mounts.

To Reproduce Setup:

$ versitygw posix /mnt/cifs_mount
No IAM service configured, enabling single account mode
 ┌───────────────────────────────────────────────────┐
 │                     versitygw                     │
 │                   Fiber v2.51.0                   │
 │               http://127.0.0.1:7070               │
 │       (bound on host 0.0.0.0 and port 7070)       │
 │                                                   │
 │ Handlers ............ 25  Processes ........... 1 │
 │ Prefork ....... Disabled  PID ............. 12345 │
 └───────────────────────────────────────────────────┘

Client:

$ aws --endpoint=http://127.0.0.1:7070 s3 mb s3://bucket
make_bucket: bucket
$ aws --endpoint=http://127.0.0.1:7070 s3 cp testfile s3://bucket/testfile
upload failed: ./upload.txt to s3://signage/upload.txt An error occurred (ExistingObjectIsDirectory) when calling the PutObject operation: Existing Object is a directory.
$ ls /mnt/cifs_mount/bucket/
drwxr-xr-x 2 root root 0 Jan  1 00:00 .
drwxr-xr-x 2 root root 0 Jan  1 00:00 ..
drwxr-xr-x 2 root root 0 Jan  1 00:00 .sgwtmp

Server output:

00:00:00 | 200 |   19.209157ms |       127.0.0.1 | PUT     | /bucket
00:00:01 | 409 |  111.251961ms |       127.0.0.1 | PUT     | /bucket/testfile

Expected behavior Client:

$ aws --endpoint=http://127.0.0.1:7070 s3 cp testfile s3://bucket/testfile
upload: ./testfile to s3://bucket/testfile
$ ls /mnt/cifs_mount/bucket/
drwxr-xr-x 3 root root 4.0K Jan  5 00:00 .
drwxr-xr-x 3 root root 4.0K Jan  2 00:00 ..
drwx------ 2 root root 4.0K Jan  2 00:00 .sgwtmp
-rw------- 1 root root    8 Feb  2 00:00 testfile

Server output:

00:00:00 | 200 |   19.209157ms |       127.0.0.1 | PUT     | /bucket
00:00:01 | 200 |  111.251961ms |       127.0.0.1 | PUT     | /bucket/testfile

Server Version Version : 0.11 Build : 8b31d6d93c76ef5d2d563047518c1e91b28d38c0 BuildTime: 2023-12-30T05:41:01Z

Additional context Debian 11.7 cifs-utils 2:6.11-3.1+deb11u1 awscli 1.19.1-1 CIFS share from Windows Server 2016

benmcclelland commented 8 months ago

@rhamon I just tested against a redhat samba server mounted with cifs on a redhat client, and this looks to work ok. I can try to setup the debian system to reproduce, but I wanted to check the cifs mount options to see if maybe my tests are different somehow. Can you check to see if there are any options set from mount | grep cifs_mount that might be relevant to these tests?

The error "ExistingObjectIsDirectory" generally means that you are trying to upload an object, but there is already a directory with this name that exists server side. I'm not seeing this in the ls output, so likely is some gateway bug but I wanted to double check that /mnt/cifs_mount/bucket/testfile is not showing up as a directory at any time during this test.

benmcclelland commented 4 months ago

Closing this as we are not able to reproduce. Can open again if we have more specifics about whats needed to reproduce this.

rhamon commented 4 months ago

I haven't tested with a Samba share on Redhat but I would assume Samba is different in features to a Microsoft Windows Server. My test was done mouting a MS Windows Server 2016 shared folder to a Debian 11 server running Versity 0.11. I can test the latest version of Versity on a Redhat type OS instead of Debian but the share has to come from a MS Windows Server for my use case.

rhamon commented 4 months ago

The mount looked like this during the initial report: //Win2k16/share/ on /mnt/cifs_mount type cifs (rw,relatime,vers=3.0,cache=strict,uid=0,noforceuid,gid=0,noforcegid,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=0)

rhamon commented 4 months ago

I'm also not able to reproduce the initial issue with the latest version of versitygw on both Debian and Redhat. Thanks and we can keep this closed. Cheers