md: Whenassemble the array, consult the superblock of the freshest device
authorAlex Lyakas <alex.lyakas@zadara.com>
Wed, 13 Dec 2023 12:24:31 +0000 (14:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Feb 2024 20:14:24 +0000 (20:14 +0000)
commitc9851c6445e57db8cea1ad903c7e0cedb080ee1e
treeab382817ec9a9960f24495e94ff960ff571133cb
parent85f24d72b5a8f9db8bf3ddc24248c74fed340a69
md: Whenassemble the array, consult the superblock of the freshest device

[ Upstream commit dc1cc22ed58f11d58d8553c5ec5f11cbfc3e3039 ]

Upon assembling the array, both kernel and mdadm allow the devices to have event
counter difference of 1, and still consider them as up-to-date.
However, a device whose event count is behind by 1, may in fact not be up-to-date,
and array resync with such a device may cause data corruption.
To avoid this, consult the superblock of the freshest device about the status
of a device, whose event counter is behind by 1.

Signed-off-by: Alex Lyakas <alex.lyakas@zadara.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/1702470271-16073-1-git-send-email-alex.lyakas@zadara.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/md.c