[PATCH 4/6] ubifs: Maintain a parent pointer

Richard Weinberger richard at nod.at
Tue May 23 00:16:32 PDT 2017


Hyunchul,

Am 23.05.2017 um 01:50 schrieb Hyunchul Lee:
>> I assumed that the journal does this already because we change old_inode->i_ctime
>> in this function too.
>> But checking the code showed the opposite.
>> So, if we face a power-cut the rename can succeed but we lose the ctime change.
>>
>> This needs to be addressed before we can add the parent pointer.
> 
> Is writing old_inode->i_ctime required? I guess that it is needed only when 
> IS_SYNC(old_inode) is true, otherwise we don't need to guarantee that ctime
> is synced.

Well, rename() has to be an atomic operation. When UBIFS updates ctime during this
operation it has also to be atomic. Otherwise, after a power-cut, you can end-up with
a renamed file but a not updated ctime.
Userspace can depend on this. Think of a backup program that needs to detect changes.
It won't notice the renamed file.

AFAICT POSIX does not require ctime to be updated during rename() but suggests it.
My point is, either we do it always or never.

Just checked xfs and btrfs. Both seem to update ctime of old_inode during the rename
transaction. UBIFS should do the same.

Thanks,
//richard



More information about the linux-mtd mailing list