Re: BTRFS constantly reports "No space left on device" even with a huge unallocated space
From: Ronan Arraes Jardim Chagas <hidden>
Date: 2016-08-30 12:50:11
Hi! Em Ter, 2016-08-30 às 10:12 +0800, Wang Xiaoguang escreveu:
For metadata, "bytes_may_use" is about 80GB, it's very big, I think this value is very abnormal. So this explains why you have huge unallocated space, you still get ENOSPC error. In kernel btrfs, there is a function should_alloc_chunk() to determine whether to allocate new chunks(new device space) num_bytes = total_bytes - bytes_readonly; it's 2147483648 num_allocated = bytes_used + bytes_reserved; it's 977354752 if num_allocated < num_bytes * 0.8, it will not allocate new device space :) even you have huge unallocated space. I think the root reason is that bytes_may_use has some computation error and is not be converted to bytes_used or bytes_reserved. I just explain why you get ENOSPC error even with huge unallocated space from codes :)
Thanks! At least we known why ENOSPC is happening.
Can you work out a reproducer for this ENOSPC error, then I can dig into codes to figure out the true reason.
Unfortunately I failed in every attempt to trigger the problem. It happens randomly and I could not figure out yet what was triggering it. First, I though it was related to a build process inside a chroot jail, but then I see the problem happening after the computer being idle for a long time (+- 1h). So, no clues yet :( Is there any workaround I can do? Best regards, Ronan Arraes