backfs
backfs copied to clipboard
Infinite loop caused by cache disk space reserved for root
To reproduce:
- Make a cache filesystem image using ext2 with default parameters, and mount the cache somewhere like normal.
- Run backfs as a non-root user, using the cache fs, and specifying to use the whole cache device (which is the default)
- Fill the cache by loading files.
Ext2 and friends reserve a small percentage of space for UID 0 (root). What happens is, the cache filesystem fills up with non-root owned files, to the point where only the space reserved is left. backfs chokes on this as make_space_available
looks at how much space is available, sees that there is plenty, and does nothing. This causes cache_add
to go into an infinite loop inside while (bytes_written != len)
.
A temporary workaround is to either create the cache with no reserve space by passing -m 0
to mkfs.ext2
, or by running backfs as root.