On 2021/03/01 21:57, Guido Trentalancia wrote: > On Mon, 01/03/2021 at 12.51 +0000, Damien Le Moal wrote: >> On 2021/03/01 21:39, Guido Trentalancia wrote: >>> If the system is shut down before the sync or drive unmounting and >>> the >>> write cache is enabled, there might be the loss of data in the >>> cache, >>> but this is because of the way the drive is designed. >> >> That drive is not usable. Even the best journaling file system would >> get corrupted. > > It is usable and an ext3 filesystem has not been causing any problem > for over a year now. Yes, I believe that: your patch disables the write cache ! So no synchronize cache command, no caching, no data loss. All good. > >>> I believe the kernel should support the drive as it is - plug and >>> play >>> - without requiring cumbersome configurations. >> >> No. That would be lying to the user. The user expect things to work. >> Not data >> corruptions. > > Data corruption is what occurs with the current kernel when one of such > drives is mounted. Because the drive does not have synchronize cache while caching data, which is crazy. > With the patch the drive can be used normally and no data corruption > occurs with the drive that I have tested. Sure, because you end up with WCE=0. All good. > This is a proposed patch and nobody is lying, I can report the specific > drive model that I have tested and the tests can be easily replicated > to confirm my findings. I understand the situation perfectly. I am not doubting your result. I looked at your patch and understand it. It is sensible, but does not plug all the possible holes with such weird drive. So that is not a good solution to me. The alternative, safe this one, is a udev rule disabling your drive write cache or you setting the permanent drive config with WCE=0. That will have *exactly* the same effect as your patch: things will work just fine. Try that solution please. No need for a kernel patch. > > Guido > -- Damien Le Moal Western Digital Research