On OpenZFS 2.1.14 and 2.2.2, which enhance the implementation of the ZFS filesystem for Linux and FreeBSD, corrective releases have been generated. The updates resolve an issue in the dnode cache consistency check code that can lead to data corruption in files containing empty areas when copied after modifications are made.
Alguses prooviti probleemi lahendada versioonis 2.2.1, kuid parandamine osutus ebaefektiivseks. Viga jäi pikka aega tähelepanuta ja hakkas ilmnema muutuste järel, mis tehti utiliidile „cp” paketis coreutils 9.x. Eeldatakse, et Red Hat Enterprise Linuxis ja sellel põhinevates distributsioonides probleem ei ilmne, kuna RHEL 9 kasutab paketti coreutils 8.x, millel on erinev utiliidi „cp” toimimise loogika.
The problem occurs when using file copying utilities that can detect and optimize empty areas in files. Corruption may occur in heavily loaded filesystems when a file is copied if the operation is executed almost immediately after modification and part of the data remains only in the dirty cache and has not yet been flushed to disk.
To optimize the handling of empty areas in files, OpenZFS, starting from release 0.6.2, supports SEEK_HOLE and SEEK_DATA operations, which allow skipping empty file areas when reading from disk. Recognition of empty areas and preserving information about them occurs only after all remaining cache data associated with the file has been flushed to disk. For initiating a flush in OpenZFS, there is a check that assesses the presence of unsaved data in the cache and performs a forced flush of the information to disk necessary for using SEEK_HOLE and SEEK_DATA.
Kahjuks osutus kontroll puudulikuks ja teatud tingimustel määrati lähtestamise oleku andmed valesti, mistõttu kettale jäi vana teave faili sisust, kui päring sattus väikese ajavahemiku jooksul kahe andmete lähtestamise operatsiooni vahele. Lugemisoperatsioonid, mis optimeerivad tühjade alade laadimist, võisid sel hetkel osa andmeid lugemata jätta, pidades neid tühjaks, samas kui faili töötlev programm võis eelnevalt tühjadesse aladesse muudatusi teha. Selle tulemusena võis utiliidi „cp” kasutamine põhjustada koopia loomise, mis sisaldas tühje alasid seal, kus neid originaalfailis ei olnud.
Allikas: opennet.ru
