Date: Thu, 11 Mar 2021 01:55:06 +0530 From: Arif Khan <mohdarif.khan@gmail.com> To: freebsd-fs@freebsd.org Subject: Data corruption with freebsd VM resets Message-ID: <CA%2BhH4baL7XKjBpK5fCcNShgwENYykR_1ad9vePDDCCJr%2Bq%2BaHg@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi All, I am facing a strange issue with freebsd 11.4. The sync() or O_SYNC flag not working if we reset the box (un graceful shutdown) within 45 seconds. The data written to file is lost. However the same thing works in 8.4 atleast initial few lines are written. main(*int* argc, *char* **argv) { *int* sz; *int* i; *int* count = atoi(argv[*1*]); *int* fd_sync = open(*"foo_sync"*, O_CREAT|O_RDWR | O_APPEND| O_SYNC, *0* *644*); *int* fd_nosync = open(*"foo_nosync"*, O_CREAT|O_RDWR | O_APPEND, *0**644*); *if* (fd_sync < *0* || fd_nosync < *0*) { perror(*"r1"*); exit(*1*); } *for* (i=*0*; i < count;i++) { sz = write(fd_sync, *"hello geeks**\n**"*, strlen(*"hello geeks**\n**"* )); sz = write(fd_nosync, *"hello geeks**\n**"*, strlen(*"hello geeks**\n**"* )); } close(fd_sync); close(fd_nosync); } This work effectively if we have kern.cam.ada.write_cache: 0 Is there a way I can get some few lines written when running sync(). -- thanks & regards Arif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhH4baL7XKjBpK5fCcNShgwENYykR_1ad9vePDDCCJr%2Bq%2BaHg>