ceph / ceph-csi

CSI driver for Ceph
Apache License 2.0
1.29k stars 549 forks source link

rbd: `reserveSnap()` should cleanup its state in case of a failure #4945

Closed nixpanic closed 2 weeks ago

nixpanic commented 3 weeks ago

reserveSnap() could set certain attributes of rbdSnap, but can fail later on. In case of a failure, attributes set in rbdSnap may not be consistent. The function should cleanup its state in case of a failure (UndoReserveName()), and only change rbdSnap attributes on success.

https://github.com/ceph/ceph-csi/blob/d5849a4801fa9f3383cefc4f96e18fcad420dc80/internal/rbd/rbd_journal.go#L403-L421

_Originally posted by @iPraveenParihar in https://github.com/ceph/ceph-csi/pull/4502#discussion_r1814796388_