cinder/cinder/backup/drivers
Sven Wegener 0fdff12b26 Fix ceph: only close rbd image after snapshot iteration is finished
list_snaps() returns an iterator object that requires resources from the
Image object. Closing the Image object deallocates these resources.

On Ceph mimic, which contains changes to the functions being invoked,
iterating over the snapshots of a closed image results in the following
assertion being triggered:

cinder-backup[29383]: /build/ceph-13.2.2/src/common/Mutex.cc: In function 'void Mutex::Lock(bool)' thread 7f35a4812700 time 2018-12-14 10:10:49.843120
cinder-backup[29383]: /build/ceph-13.2.2/src/common/Mutex.cc: 110: FAILED assert(r == 0)
cinder-backup[29383]:  ceph version 13.2.2 (02899bfda814146b021136e9d8e80eba494e1126) mimic (stable)
cinder-backup[29383]:  1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x102) [0x7f35903440f2]
cinder-backup[29383]:  2: (()+0x3162b7) [0x7f35903442b7]
cinder-backup[29383]:  3: (Mutex::Lock(bool)+0x1de) [0x7f359031901e]
cinder-backup[29383]:  4: (()+0x8f452) [0x7f358dafc452]
cinder-backup[29383]:  5: (()+0x11280d) [0x7f358db7f80d]
cinder-backup[29383]:  6: (rbd_snap_get_namespace_type()+0x29) [0x7f358dacf549]

The lock being tried to acquire and the object that contained it have
already been destroyed by closing the image. The assertion terminates
the cinder-backup service via SIGABRT.

On Ceph luminous we've seen occasional segfaults of the cinder-backup
service, which might have the same underlying cause.

Closes-Bug: #1838691

Change-Id: If6043d82cc57d9247a290816d90b95cdf719eaac
Signed-off-by: Sven Wegener <sven.wegener@inovex.de>
(cherry picked from commit 7656967259)
(cherry picked from commit e78b220f44)
(cherry picked from commit 57b1274591)
(cherry picked from commit 9e5d33ac24)
2019-08-13 17:19:08 -03:00
..
__init__.py Removed copyright from empty files 2014-01-01 20:31:13 -07:00
ceph.py Fix ceph: only close rbd image after snapshot iteration is finished 2019-08-13 17:19:08 -03:00
glusterfs.py Add cinder backup service initialize check 2017-07-25 16:56:27 +03:00
google.py Add cinder backup service initialize check 2017-07-25 16:56:27 +03:00
nfs.py Fix permissions with NFS-backed snapshots and backups 2019-03-26 12:24:05 +00:00
posix.py Don't fail when deleting missing backup 2017-10-27 04:24:56 +00:00
swift.py Remove logging on Swift backup obj writer 2018-01-25 11:44:08 +01:00
tsm.py Merge "Add cinder backup service initialize check" 2017-07-25 22:42:57 +00:00