You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB

  1. # Error Handling
  2. POSIX filesystem functions offer a single return code meaning that
  3. there is some complication regarding the handling of multiple branches
  4. as mergerfs does. It tries to handle errors in a way that would
  5. generally return meaningful values for that particular function.
  6. ### chmod, chown, removexattr, setxattr, truncate, utimens
  7. 1. if no error: return 0 (success)
  8. 2. if no successes: return first error
  9. 3. if one of the files acted on was the same as the related search function: return its value
  10. 4. return 0 (success)
  11. While doing this increases the complexity and cost of error handling,
  12. particularly step 3, this provides probably the most reasonable return
  13. value.
  14. ### unlink, rmdir
  15. 1. if no errors: return 0 (success)
  16. 2. return first error
  17. Older versions of mergerfs would return success if any success occurred
  18. but for unlink and rmdir there are downstream assumptions that, while
  19. not impossible to occur, can confuse some software.
  20. ### others
  21. For search functions, there is always a single thing acted on and as
  22. such whatever return value that comes from the single function call is
  23. returned.
  24. For create functions `mkdir`, `mknod`, and `symlink` which don't
  25. return a file descriptor and therefore can have `all` or `epall`
  26. policies it will return success if any of the calls succeed and an
  27. error otherwise.