Project

General

Profile

Bug #3379

rbd map + rbd mv: couldn't remove old source object

Added by Chris Dunlop over 11 years ago. Updated almost 11 years ago.

Status:
Won't Fix
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
No
Severity:
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

ceph @7477a081, linux-3.4.12

Using 'rbd mv' on a mapped object creates a "ghost" object that prevents
further use of the object name. E.g.:

# rbd create --size 400 xx
# rbd map xx
# rbd mv xx yy
2012-10-22 12:43:06.219088 7f0fb9205760 -1 librbd: warning: couldn't remove old source object (xx.rbd)
# rbd list
yy
# rbd showmapped
id    pool    image    snap    device
1    rbd    xx    -    /dev/rbd1
# rbd unmap /dev/rbd1
# rbd showmapped
<< empty >>
# rbd list
<< empty >>

At this point the name 'xx' is unavailable for further use, e.g.:

# rbd create --size 400 xx
create error: (17) File exists
2012-10-22 12:49:45.498121 7f897d624760 -1 librbd: rbd image xx already exists
# rbd mv yy xx
rename error: (17) File exists
2012-10-22 12:52:42.690820 7ff738c7a760 -1 librbd: rbd image xx already exists
# rbd rm yy
Removing image: 100% complete...done.
b4# rbd list    
b4# rbd create --size 400 xx
create error: (17) File exists
2012-10-22 12:53:16.729617 7fd8fd6bb760 -1 librbd: rbd image xx already exists

...aha! 'rbd rm' on the old name works:

# rbd rm xx
Removing image: 99% complete...failed.
delete error: (2) No such file or directory
2012-10-22 12:58:25.168371 7f1a0753c760 -1 librbd: error removing img from old-style directory: (2) No such file or directory
# rbd create --size 400 xx
# rbd list
xx

Perhaps 'rbd mv' should be disallowed on mapped objects as it is for 'rbd rm', e.g.:

# rbd create --size 400 xx
# rbd map xx
# rbd rm xx
Removing image: 99% 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-10-22 13:01:59.283345 7f63aca86760 -1 librbd: error removing header: (16) Device or resource busy
# rbd list
xx
# rbd showmapped
id    pool    image    snap    device
1    rbd    xx    -    /dev/rbd1
<pre>

History

#1 Updated by Alex Elder over 11 years ago

This is an inherent problem in the way original format rbd
images work, and I don't expect it will be fixed.

Format 2 images should not suffer from this problem, because
each image has a unique identifier that won't change, so
renaming an image should not lead to this scenario.

Format 2 images are just now getting support in the kernel.
They are created by adding the "--format=2" option to the
"rbd create" command.

#2 Updated by Josh Durgin over 11 years ago

Currently there's no way to determine whether an object has watchers from librados (short of deleting it). We could guard against this by adding such an interface, and verifying that there are no watchers before renaming an image (just created #3403 for the first step).

As Alex mentioned, this only affects format 1 images.

#3 Updated by Sage Weil almost 11 years ago

  • Status changed from New to Won't Fix

Also available in: Atom PDF