[GH-ISSUE #1519] Consider changing failed chown/chmod return codes from -EIO to -EFBIG #798

Closed
opened 2026-03-04 01:48:52 +03:00 by kerem · 1 comment
Owner

Originally created by @CarstenGrohmann on GitHub (Jan 15, 2021).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1519

I run rsync to copy a 10GB file from local storage to a S3 bucket using -o nomultipart. rsync failed with "Input/output error (5)":

rsync -a /local/test/* /mnt/s3
rsync: chown "/mnt/s3/DIR1/DIR2/FILE1" failed: Input/output error (5)
^Crsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(638) [sender=3.1.2]

I spend some time to trace this issue down. It's triggered by put_headers() because the file is to big for a non-multipart attribute change according the AWS S3 standard:
github.com/s3fs-fuse/s3fs-fuse@a6563211af/src/s3fs.cpp (L726-L730)

put_headers() returns -EFBIG to s3fs_chown() and s3fs_chown() changes the result to -EIO:
github.com/s3fs-fuse/s3fs-fuse@a6563211af/src/s3fs.cpp (L1810-L1811)

Is it possible to adapt the source code to do not change from EFBIG to EIO in such cases?

Additional Information

Version of s3fs being used (s3fs --version)

release 1.88

Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse)

2.9.2

Kernel information (uname -r)

command result: 3.10.0-957.10.1.el7.x86_64

GNU/Linux Distribution, if applicable (cat /etc/os-release)

Red Hat Enterprise Linux Server 7.6 (Maipo)

s3fs command line used, if applicable

s3fs mybucket /mnt/s3 -o passwd_file=~/.passwd-s3fs -o nomultipart,notsup_compat_dir,curldbg,dbglevel=debug -d -d -f

s3fs debug logs:

unique: 11423239, opcode: SETATTR (4), nodeid: 20954, insize: 128, pid: 30713
chown /DIR1/DIR2/FILE1 1042 2084
[INF] s3fs.cpp:s3fs_chown(1741): [path=/DIR1/DIR2/FILE1][uid=1042][gid=2084]
[DBG] s3fs.cpp:check_parent_object_access(615): [path=/DIR1/DIR2/FILE1]
[DBG] s3fs.cpp:check_object_access(509): [path=/DIR1/DIR2]
[DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2]
[DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/][time=31710.003300698][hit count=452]
[DBG] s3fs.cpp:check_object_access(509): [path=/DIR1]
[DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1]
[DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/][time=31706.796275087][hit count=1746]
[DBG] s3fs.cpp:check_object_access(509): [path=/]
[DBG] s3fs.cpp:get_object_attribute(362): [path=/]
[DBG] s3fs.cpp:check_object_owner(583): [path=/DIR1/DIR2/FILE1]
[DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2/FILE1]
[DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/FILE1][time=41833.429839050][hit count=1]
[DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2/FILE1]
[DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/FILE1][time=41833.429839050][hit count=2]
[DBG] fdcache.cpp:ExistOpen(525): [path=/DIR1/DIR2/FILE1][fd=-1][ignore_existfd=true]
[DBG] fdcache.cpp:Open(445): [path=/DIR1/DIR2/FILE1][size=-1][time=-1]
[INF]     s3fs.cpp:put_headers(719): [path=/DIR1/DIR2/FILE1]
[DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2/FILE1]
[DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/FILE1][time=41833.429839050][hit count=3]
   unique: 11423239, error: -5 (Input/output error), outsize: 16
Originally created by @CarstenGrohmann on GitHub (Jan 15, 2021). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1519 I run rsync to copy a 10GB file from local storage to a S3 bucket using `-o nomultipart`. rsync failed with "Input/output error (5)": ``` rsync -a /local/test/* /mnt/s3 rsync: chown "/mnt/s3/DIR1/DIR2/FILE1" failed: Input/output error (5) ^Crsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(638) [sender=3.1.2] ``` I spend some time to trace this issue down. It's triggered by `put_headers()` because the file is to big for a non-multipart attribute change according the AWS S3 standard: https://github.com/s3fs-fuse/s3fs-fuse/blob/a6563211af91996dd091d4e40cc2d8185a600bb8/src/s3fs.cpp#L726-L730 `put_headers()` returns `-EFBIG` to `s3fs_chown()` and `s3fs_chown()` changes the result to `-EIO`: https://github.com/s3fs-fuse/s3fs-fuse/blob/a6563211af91996dd091d4e40cc2d8185a600bb8/src/s3fs.cpp#L1810-L1811 Is it possible to adapt the source code to do not change from EFBIG to EIO in such cases? ### Additional Information #### Version of s3fs being used (s3fs --version) _release 1.88_ #### Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse) _2.9.2_ #### Kernel information (uname -r) _command result: 3.10.0-957.10.1.el7.x86_64_ #### GNU/Linux Distribution, if applicable (cat /etc/os-release) _Red Hat Enterprise Linux Server 7.6 (Maipo)_ #### s3fs command line used, if applicable ``` s3fs mybucket /mnt/s3 -o passwd_file=~/.passwd-s3fs -o nomultipart,notsup_compat_dir,curldbg,dbglevel=debug -d -d -f ``` #### s3fs debug logs: ``` unique: 11423239, opcode: SETATTR (4), nodeid: 20954, insize: 128, pid: 30713 chown /DIR1/DIR2/FILE1 1042 2084 [INF] s3fs.cpp:s3fs_chown(1741): [path=/DIR1/DIR2/FILE1][uid=1042][gid=2084] [DBG] s3fs.cpp:check_parent_object_access(615): [path=/DIR1/DIR2/FILE1] [DBG] s3fs.cpp:check_object_access(509): [path=/DIR1/DIR2] [DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2] [DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/][time=31710.003300698][hit count=452] [DBG] s3fs.cpp:check_object_access(509): [path=/DIR1] [DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1] [DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/][time=31706.796275087][hit count=1746] [DBG] s3fs.cpp:check_object_access(509): [path=/] [DBG] s3fs.cpp:get_object_attribute(362): [path=/] [DBG] s3fs.cpp:check_object_owner(583): [path=/DIR1/DIR2/FILE1] [DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2/FILE1] [DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/FILE1][time=41833.429839050][hit count=1] [DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2/FILE1] [DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/FILE1][time=41833.429839050][hit count=2] [DBG] fdcache.cpp:ExistOpen(525): [path=/DIR1/DIR2/FILE1][fd=-1][ignore_existfd=true] [DBG] fdcache.cpp:Open(445): [path=/DIR1/DIR2/FILE1][size=-1][time=-1] [INF] s3fs.cpp:put_headers(719): [path=/DIR1/DIR2/FILE1] [DBG] s3fs.cpp:get_object_attribute(362): [path=/DIR1/DIR2/FILE1] [DBG] cache.cpp:GetStat(293): stat cache hit [path=/DIR1/DIR2/FILE1][time=41833.429839050][hit count=3] unique: 11423239, error: -5 (Input/output error), outsize: 16 ```
kerem closed this issue 2026-03-04 01:48:53 +03:00
Author
Owner

@gaul commented on GitHub (Jan 16, 2021):

Is it possible to adapt the source code to do not change from EFBIG to EIO in such cases?

This seems reasonable, however there is some sloppiness in how error codes are handled. For example, put_headers should return a negative errno, but it also returns the direct result of MultipartHeadRequest, which returns -1 instead of EIO or similar. We need to audit the call sites to prevent unintentionally returning -1 as EPERM.

<!-- gh-comment-id:761294714 --> @gaul commented on GitHub (Jan 16, 2021): > Is it possible to adapt the source code to do not change from EFBIG to EIO in such cases? This seems reasonable, however there is some sloppiness in how error codes are handled. For example, `put_headers` should return a negative errno, but it also returns the direct result of `MultipartHeadRequest`, which returns -1 instead of `EIO` or similar. We need to audit the call sites to prevent unintentionally returning -1 as `EPERM`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#798
No description provided.