stratis-storage / stratisd

Easy to use local storage management for Linux.
https://stratis-storage.github.io
Mozilla Public License 2.0
793 stars 56 forks source link

D-Bus notification for org.storage.stratis3.filesystem.r*.Used is missing #3634

Closed mvollmer closed 1 month ago

mvollmer commented 2 months ago

When slowing filling a filesystem with data, the value of org.storage.stratis3.filesystem.r*.Used is updated periodically (as expected), but there are no change notifications for that.

There are notifications when org.storage.stratis3.pool.r*.TotalPhysicalUsed every 10 seconds, and I would expect to get notifications for filesystem.Used at the same time.

stratisd-3.6.7-1.fc40.x86_64

Here is the output of D-Bus monitor. You can see the notifications for pool.TotalPhysicalUsed in there, bot nothing for filesystem.Used.

stratis-used.log

mulkieran commented 2 months ago

We've reproduced this behavior.

mulkieran commented 2 months ago

We have reproduced, using a test that makes use of the monitor-dbus test script:

  1. When a filesystem is added to the pool, the pool TotalPhysicalUsed property is updated.
  2. When we write 1 MiB to a file on the filesystem, using dd, and doing it iteratively, with 4096B block size + only 128 KiB at a time, we see that no signal for the filesystem Used property is sent out for the changes.
  3. After we have stopped writing to the filesystem, and we wait a while for the D-Bus to settle the updated value does appear on the D-Bus, but no signal is sent. The dbus monitor script reports the discrepancy.

Our test that automatically uses the dbus monitor script did not report any discrepancy. However, it writes the data all at once, instead of in 128KiB iterations. Since it did not report an error we can conclude that for the test either:

  1. The Used property value is not updated.
  2. The signal is sent out. I think that (1) is likely the correct explanation. (3), a bug in the invocation of the script was the correct explanation. That is now fixed: https://github.com/stratis-storage/testing/pull/268

We have an idea of why this is happening, which is that the Used property signal gets sent out generally only when the Size property signal gets sent out as well, and, of course, that property is updated less frequently. ~But that hypothesis does not explain the observed behavior of the Used property getting the correct value.~ We know why that is correct.

mulkieran commented 2 months ago

I believe the fix can be localized to the check_fs and handle_extension methods.