Re: [PATCH 3/6] ntfs: read initialized_size under size_lock in the iomap paths
From: Hyunchul Lee
Date: Thu Nov 26 2026 - 03:45:56 EST
> if (!(flags & IOMAP_ZERO) &&
> - iomap->type == IOMAP_MAPPED &&
> - iomap->offset < ni->initialized_size &&
> - iomap->offset + iomap->length > ni->initialized_size) {
> - iomap->length = round_up(ni->initialized_size, 1 << inode->i_blkbits) -
> - iomap->offset;
> + iomap->type == IOMAP_MAPPED) {
> + loff_t initialized_size;
> +
> + read_lock_irqsave(&ni->size_lock, irqflags);
> + initialized_size = ni->initialized_size;
> + read_unlock_irqrestore(&ni->size_lock, irqflags);
Is it safe to read the size again instead of reusing the first one?
And the size_lock is missing in ntfs_iomap_read_end_io.
--
Thanks,
Hyunchul