mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-30 16:49:29 +00:00
util: prevent a panic when creating an fscrypt protector failed
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
72cfaaf3fc
commit
003e0b36a6
@ -217,12 +217,14 @@ func initializeAndUnlock(
|
||||
}
|
||||
|
||||
protector, err := fscryptactions.CreateProtector(fscryptContext, protectorName, keyFn, owner)
|
||||
if err != nil {
|
||||
if err != nil && protector != nil {
|
||||
log.ErrorLog(ctx, "fscrypt: protector name=%s create failed: %v. reverting.", protectorName, err)
|
||||
if revertErr := protector.Revert(); revertErr != nil {
|
||||
return revertErr
|
||||
}
|
||||
|
||||
return err
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user