Re: [Question] why not flush device cache at _vg_commit_raw
Demi Marie Obenour <[email protected]> Tue, 23 Jan 2024 11:42:26 -0500
| Newsgroups | dev.linux.lists.linux-lvm |
|---|---|
| Message-ID | <Za_swUm-PGHoaf1X@itl-email> |
On Mon, Jan 22, 2024 at 03:52:57PM +0100, Zdenek Kabelac wrote: > Dne 22. 01. 24 v 14:46 Anthony Iliopoulos napsal(a): > > On Mon, Jan 22, 2024 at 01:48:41PM +0100, Zdenek Kabelac wrote: > > > Dne 22. 01. 24 v 12:22 Su Yue napsal(a): > > > > Hi lvm folks, > > > > Recently We received a report about the device cache issue after vgchange —deltag. > > > > What confuses me is that lvm never calls fsync on block devices even at the end of commit phase. > > > > > > > > IIRC, it’s common operations for userspace tools to call fsync/O_SYNC/O_DSYNC while writing > > > > critical data. Yes, lvm2 opens devices with O_DIRECT if they support , but O_DIRECT doesn't > > > > provide data was persistent to storage when write returns. The data can still be in the device cache, > > > > If power failure happens in the timing, such critical metadata/data like vg metadata could be lost. > > > > > > > > Is there any particular reason not to flush data cache at VG commit time? > > > > > > > > > > Hi > > > > > > It seems the call to 'dev_flush()' function got somehow lost over the time > > > of conversion to async aio usage - I'll investigate. > > > > > > On the other hand the chance here of losing any data this way would be > > > really really very specific to some oddly behaving device. > > > > There's no guarantee that data will be persisted to storage without > > explicitly flushing the device data cache. Those are usually volatile > > write-back caches, so the data aren't really protected against power > > loss without fsyncing the blockdev. > > At technical level modern storage devices 'should' have enough energy held > internally to be able to flush out all the caches in emergency cases to the > persistent storage. So unless we deal with some 'virtual' storage that may > fake various responses to IO handling - this should not be causing major > troubles. This is only true for enterprise storage with power loss protection. The vast majority of Qubes OS users use LVM with consumer storage, which does not have power loss protection. If this is unsafe, then Qubes OS should switch to a different storage pool that flushes drive caches as needed. -- Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEdodNnxM2uiJZBxxxsoi1X/+cIsEFAmWv7MEACgkQsoi1X/+c IsH7WhAAmAw4qqQFzq0EiFL0YJmn6GClHOXJfZR0EdcpkeY1s/4wi63q17IApusV DvDRypSeE7egorGzKekSvemt0D4apWLCI2gIlnoKM/o9J6iIj9tn6hk4nZuDCemq PFLJ2Sk6mwDrpQ4QlYfxnlc7IUcoySDbJLSceXA4+4cTK723JlKdzwFsjCwqbhYW ywm3whBaMxm7/gaJrclBLiTnCd69RmdIR/XEy1AaOYaFmFLWX84PeuFHoXY83AyJ YhP9rDbACtqczmQfodfSi3XSVFTR8rAgRUDicHsgRnM/SbyHVkNT5E1S7trLKpT4 V58o3gjut6lsLIYXwIchQ7mqXxTbDiQc6XR0cn5+mLJFiJIcD1DeKoXItkU9ekAu 5mxxl/pLJAboAbUrRiJldzv9xcefs0+Q05eoYT2x/ICHaz4raRFudTCLkCV5KF81 JtF3yBApxwOyBKAjgGtPyVua8PDyczo2b6IGX98wz9K6VEIcOr2pPPzpai/KVRsc kW/wkpphRjzsx3/Pp3j2ne/sFXl3KGQyNYIXAy7lqTCIWHONwsu7zhkczD4XaHAJ eObSEjDmFvQ5fDz+74vPv91SJL4QHEebJZUytG/sQ8B6z2avlAQ683peAYBoQOO3 F0bIWcAX9+AKGb6NaLQm1T3VNvKiAC00WeW7nB/Cbgp1jFtWCVU= =Yb74 -----END PGP SIGNATURE-----