[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] block/crypto: Reset updating_keys on perm failure
From: |
Hanna Reitz |
Subject: |
[PATCH 3/5] block/crypto: Reset updating_keys on perm failure |
Date: |
Fri, 4 Mar 2022 16:37:27 +0100 |
When the permissions could not be changed as would be necessary for
updating the keys, reset updating_keys to false so
block_crypto_child_perms() will not continue to try claiming these
permissions.
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
block/crypto.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/crypto.c b/block/crypto.c
index 5225a68a54..9d5fecbef8 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -781,10 +781,16 @@ static int
block_crypto_amend_prepare(BlockDriverState *bs, Error **errp)
{
BlockCrypto *crypto = bs->opaque;
+ int ret;
/* apply for exclusive read/write permissions to the underlying file */
crypto->updating_keys = true;
- return bdrv_child_refresh_perms(bs, bs->file, errp);
+ ret = bdrv_child_refresh_perms(bs, bs->file, errp);
+ if (ret < 0) {
+ /* Well, in this case we will not be updating any keys */
+ crypto->updating_keys = false;
+ }
+ return ret;
}
static void
--
2.34.1
- [PATCH 0/5] block/amend: Fix failures seen in iotest 296, Hanna Reitz, 2022/03/04
- [PATCH 1/5] block/amend: Clean up job on early failure, Hanna Reitz, 2022/03/04
- [PATCH 2/5] block/amend: Always call .bdrv_amend_clean(), Hanna Reitz, 2022/03/04
- [PATCH 3/5] block/crypto: Reset updating_keys on perm failure,
Hanna Reitz <=
- [PATCH 5/5] iotests/296: Accept early failure, Hanna Reitz, 2022/03/04
- [PATCH 4/5] block/amend: Keep strong reference to BDS, Hanna Reitz, 2022/03/04
- Re: [PATCH 0/5] block/amend: Fix failures seen in iotest 296, Kevin Wolf, 2022/03/04