On 4/15/2025 9:13 PM, Miklos Szeredi wrote:
[You don't often get email from miklos@xxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
On Tue, 15 Apr 2025 at 04:28, Guang Yuan Wu <gwu@xxxxxxx> wrote:
I though about this ...
Actually, FUSE_I_SIZE_UNSTABLE can be set concurrently, by truncate and other flow, and if the bit is ONLY set from truncate case, we can trust attributes, but other flow may set it as well.
FUSE_I_SIZE_UNSTABLE is set with the inode lock held exclusive. If
this wasn't the case, the FUSE_I_SIZE_UNSTABLE state could become
corrupted (i.e it doesn't nest).
Thanks.
for truncate, inode lock is acquired in do_truncate(). (not in i_op
->setattr())
others (for example, fallocate), inode lock is acquired in f_op->fallocate()
So, I think FUSE_I_SIZE_UNSTABLE check can be removed from:
if ((attr_version != 0 && fi->attr_version > attr_version) ||
test_bit(REDFS_I_SIZE_UNSTABLE, &fi->state))
/* Applying attributes, for example for fsnotify_change() */
invalidate_attr = true;
Thanks,
Miklos
Regards
Guang Yuan Wu