On 2023/12/25 10:07, Al Viro wrote:
On Mon, Dec 25, 2023 at 09:38:51AM +0800, Baokun Li wrote:
In my opinion, it doesn't make sense to call lock_two_nondirectories()
here to determine if the inode is a regular file or not, since the logic
for dealing with non-regular files comes after the locking, so calling
lock_two_inodes() directly here will suffice.
No. First of all, lock_two_inodes() is a mistake that is going to be
removed in the coming cycle.
Okay, I didn't know about this.
What's more, why the hell do you need to lock *anything* to check the
inode type? Inode type never changes, period.
Just take that check prior to lock_two_nondirectories() and be done with
that.
Since in the current logic we update the boot loader file via
swap_inode_boot_loader(), however the boot loader inode on disk
may be uninitialized and may be garbage data, so we allow to get a
bad boot loader inode and then initialize it and swap it with the boot
loader file to be set.
When reinitializing the bad boot loader inode, something like an
inode type conversion may occur.
Cheers,
Baokun