OSDN Git Service

EncryptInplace: fsync cryptofd before reporting success
authorEric Biggers <ebiggers@google.com>
Thu, 5 Nov 2020 02:38:38 +0000 (18:38 -0800)
committerEric Biggers <ebiggers@google.com>
Thu, 5 Nov 2020 03:24:19 +0000 (19:24 -0800)
commit1ba8865fec2e58dc1a886c2175bea38cbac8ffee
tree97eb3931bae7402e983315b421bd37f54a29c5f4
parent91e4f1dd76ec9ca1d76ec52033bea5a0a2c20fb9
EncryptInplace: fsync cryptofd before reporting success

fsync() the cryptofd when done writing to it.  Without this, any
remaining dirty pages in the crypto_blkdev's page cache (which there
might be a lot of, even as much as all the data that was written) won't
be flushed to disk until the cryptofd is closed, which ignores I/O
errors and is also after we already reported 100% completion.

There wasn't an fsync() in the original version either, so we've been
getting by without it, but it seems it should be there.

Change-Id: Idd1be3ae67ce96ecf3946b9efb9fc57414f5805a
EncryptInplace.cpp