Project

General

Profile

Bug #2948

rbd: fails to close image on error

Added by Josh Durgin over 11 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
High
Assignee:
Target version:
-
% Done:

0%

Source:
Q/A
Tags:
Backport:
argonaut
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

calling exit() doesn't run the Image destructor, which leads to the watch on the header sticking around. After that, you can't delete the image for 30 seconds until the watch times out.

The rbd calls exit(1) on almost any error, so this is easy to trigger.

Associated revisions

Revision fed8aea6 (diff)
Added by Dan Mick over 11 years ago

rbd: force all exiting paths through main()/return
This properly destroys objects. In the process, remove usage_exit();
also kill error-handling in set_conf_param (never relevant for rbd.cc,
and if you call it with both pointers NULL, well...)
Also switch to EXIT_FAILURE for consistency.

Signed-off-by: Dan Mick <>
Reviewed-by: Josh Durgin <>
Fixes: #2948

Revision 54788d0d (diff)
Added by Dan Mick over 11 years ago

rbd: force all exiting paths through main()/return

This properly destroys objects. In the process, remove usage_exit();
also kill error-handling in set_conf_param (never relevant for rbd.cc,
and if you call it with both pointers NULL, well...)
Also switch to EXIT_FAILURE for consistency.

Backported from fed8aea662bf919f35a5a72e4e2a2a685af2b2ed.

Signed-off-by: Dan Mick <>
Reviewed-by: Josh Durgin <>
Fixes: #2948

History

#1 Updated by Josh Durgin over 11 years ago

  • Status changed from 12 to 7
  • Assignee changed from Josh Durgin to Dan Mick

#2 Updated by Dan Mick over 11 years ago

This affects operations that fail partway through. One example is:

rbd export <image> <existing-file>
export error: (17) File exists
rbd rm <image>
Removing image: 0% complete...failed.
delete error: image still has watchers
This means the image is still open or the client using it crashed. Try again after closing/unmapping it or waiting 30s for the crashed client to timeout.
2012-08-16 16:46:11.956283 7f8ab8dfc780 -1 librbd: error removing header: (16) Device or resource busy

The fix is to make main() always exit through return(), which will
destroy automatic objects (which properly calls ImageCtx.close()).

#3 Updated by Dan Mick over 11 years ago

  • Status changed from 7 to Resolved

commit:fed8aea662bf919f35a5a72e4e2a2a685af2b2ed in master

Also available in: Atom PDF