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.

52 lines
1.7 KiB

  1. # Error Handling and Logging
  2. ## Error Handling
  3. POSIX filesystem functions offer a single return code meaning that
  4. there is some complication regarding the handling of multiple branches
  5. as mergerfs does. It tries to handle errors in a way that would
  6. generally return meaningful values for that particular function.
  7. ### chmod, chown, removexattr, setxattr, truncate, utimens
  8. 1. if no error: return 0 (success)
  9. 2. if no successes: return first error
  10. 3. if one of the files acted on was the same as the related search function: return its value
  11. 4. return 0 (success)
  12. While doing this increases the complexity and cost of error handling,
  13. particularly step 3, this provides probably the most reasonable return
  14. value.
  15. ### unlink, rmdir
  16. 1. if no errors: return 0 (success)
  17. 2. return first error
  18. Older versions of mergerfs would return success if any success occurred
  19. but for unlink and rmdir there are downstream assumptions that, while
  20. not impossible to occur, can confuse some software.
  21. ### others
  22. For search functions, there is always a single thing acted on and as
  23. such whatever return value that comes from the single function call is
  24. returned.
  25. For create functions `mkdir`, `mknod`, and `symlink` which don't
  26. return a file descriptor and therefore can have `all` or `epall`
  27. policies it will return success if any of the calls succeed and an
  28. error otherwise.
  29. ## Logging
  30. Filesystems, and therefore mergerfs, are doing lots of small actions
  31. at high speed. It simply isn't reasonable to log all the actions of
  32. the system. That said: certain details are logged at startup and when
  33. performing mainance tasks. These are logged via `syslog` and on
  34. `systemd` based systems can be viewed by running
  35. ```
  36. journalctl -t mergerfs
  37. ```