Skip to contentSkip to conversation

BTRFS w/ quotas hangs on read-write mount using all available RAM - rev2

DISCUSSION O'Brien Dave 2 participants 2 messages May 7, 2024 Btrfs file system

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines

So the only way to get rid of the situation is using the newer sysfs interface "/sys/fs/btrfs/<uuid>/qgroups/drop_subtree_treshold”.

Some lower value like 2 or 3 would be good enough to address the situation, which would automatically change qgroup to inconsistent if a larger enough subtree is dropped.

Setting the threshold to 2 or 3 didn't work - the machine ran until OOM failure in both cases - but what did work was setting it to 1 or 0. (I’m not sure which fixed it, as I set it to 1, then 0, there was a flurry of disk activity and the qgroups were immediately marked as inconsistent.)

So, after rebooting into single user mode with /home in ro:

$ vim /etc/fstab # to change /home back to the defaults
$ mount /home
$ echo "0" >/sys/fs/btrfs/<UUID>/qgroups/drop_subtree_threshold
$ cat/sys/fs/btrfs/<UUID>/qgroups/drop_subtree_threshold  # to check
$ btrfs qgroup show -pcre /home
$ btrfs quota disable /home

Thanks for your help!

#1 lore raw
Quoted 7 lines · O'Brien Dave
Quoted 6 lines

So the only way to get rid of the situation is using the newer sysfs interface "/sys/fs/btrfs/<uuid>/qgroups/drop_subtree_treshold”.

Some lower value like 2 or 3 would be good enough to address the situation, which would automatically change qgroup to inconsistent if a larger enough subtree is dropped.

Quoted 6 lines

Setting the threshold to 2 or 3 didn't work - the machine ran until OOM failure in both cases - but what did work was setting it to 1 or 0. (I’m not sure which fixed it, as I set it to 1, then 0, there was a flurry of disk activity and the qgroups were immediately marked as inconsistent.)

So, after rebooting into single user mode with /home in ro:

$ vim /etc/fstab # to change /home back to the defaults
$ mount /home

I guess there is some timing problem involved.

Normally a subtree with level 2 or 3 isn't that large (hundreds extents), and should not cause a huge problem.

But it's possible that some huge subtree is already queued for scan, thus at the time of setting drop_subtree_threshold, it's too late.

So I'd recommend to mount it RO first, setting the value, then remount it to RW, so that none of the huge subtree would be queued before setting the value.

Anyway glad to help, and I really believe we need a way to set the option in a more persistent way, so that we can avoid such inconvenience for all.

Thanks,
Qu

Quoted 6 lines
$ echo "0" >/sys/fs/btrfs/<UUID>/qgroups/drop_subtree_threshold
$ cat/sys/fs/btrfs/<UUID>/qgroups/drop_subtree_threshold  # to check
$ btrfs qgroup show -pcre /home
$ btrfs quota disable /home

Thanks for your help!