scsi: sync cache on write
authorCaleb Connolly <caleb.connolly@linaro.org>
Wed, 26 Mar 2025 12:24:09 +0000 (13:24 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 10 Apr 2025 20:21:41 +0000 (14:21 -0600)
commitffe4e6ab42d2534302be825e49a2d085acf80f30
treee786e6585db16861b4de337185e493dc454944ad
parent0cd3c1e7d0201cf9e4dbcac1e0179604f4461062
scsi: sync cache on write

We don't have a mechanism to safely shutdown block devices prior to a
baord reset or driver removal. Prevent data loss by synchronizing the
SCSI cache after every write.

In particular this solves the issue of capsule updates looping on some
devices because the board resets immediately after deleting the capsule
file and this write wouldn't be flushed in time.

This may impact NAND wear, but should be negligible given the usecases
for disk write in U-Boot.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
drivers/scsi/scsi.c