mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Do not reload LUKS2 metadata when not necessary.
Following API calls trigerred LUKS2 metadata reload from storage in case of failure: crypt_convert crypt_keyslot_add_by_key crypt_keyslot_add_by_keyfile_device_offset crypt_keyslot_add_by_passphrase crypt_keyslot_change_by_passphrase crypt_reencrypt_init_by_keyring crypt_reencrypt_init_by_passphrase This patch replaces LUKS2 metadata reload with backup LUKS2 metadata copy kept in memory that is updated on each sucessfull metadata write and rolled back to it whenever needed in any of those calls listed above.
This commit is contained in:
@@ -121,6 +121,7 @@ struct luks2_hdr {
|
||||
uint8_t salt2[LUKS2_SALT_L];
|
||||
char uuid[LUKS2_UUID_L];
|
||||
void *jobj;
|
||||
void *jobj_rollback;
|
||||
};
|
||||
|
||||
struct luks2_keyslot_params {
|
||||
@@ -167,6 +168,7 @@ int LUKS2_hdr_version_unlocked(struct crypt_device *cd,
|
||||
int LUKS2_hdr_read(struct crypt_device *cd, struct luks2_hdr *hdr, int repair);
|
||||
int LUKS2_hdr_write(struct crypt_device *cd, struct luks2_hdr *hdr);
|
||||
int LUKS2_hdr_write_force(struct crypt_device *cd, struct luks2_hdr *hdr);
|
||||
int LUKS2_hdr_rollback(struct crypt_device *cd, struct luks2_hdr *hdr);
|
||||
int LUKS2_hdr_dump(struct crypt_device *cd, struct luks2_hdr *hdr);
|
||||
int LUKS2_hdr_dump_json(struct crypt_device *cd, struct luks2_hdr *hdr, const char **json);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user