On 18 Jun 2024 21:17 +0800, from j...@tls-mail.com (Jeff Peng): > I ask this b/c some commands following echo cannot run well. > > Such as, > > echo … >> dove.db > doveadm create mailbox from dove.db > > Sometimes it succeeds. Sometimes it fails. > > If I add a line like this: > > echo … >> dove.db > sleep 1 > doveadm create mailbox from dove.db > > It seems working now.
Your problem is almost certainly not related to writes not yet being committed to stable storage. Caching is used for both reads and writes. If a write syscall has finished, then even if the data is still only in a cache, a subsequent read syscall will return it. You should be able to verify this by replacing your "doveadm" invocation with, say, md5sum (or anything else which by necessity must read the file in question). If the results or output of that is consistent, then the data is being properly persisted and read back (again, even if it hasn't been written out to stable storage yet because of caching and write coalescing). So whatever your problem is, you have either (a) stumbled upon a huge bug in the kernel's I/O subsystem (unlikely), or (b) an unrelated issue. It's hard to tell from simply a "sometimes it fails" what that issue might be; maybe this "doveadm" program is doing some extra validation of some kind, and a rapid execution fails this validation? -- Michael Kjörling 🔗 https://michael.kjorling.se “Remember when, on the Internet, nobody cared that you were a dog?”