mirror of
https://github.com/ceph/ceph
synced 2025-03-20 17:27:01 +00:00
rbd: handle images disappearing while in ls -l
rbd.list() returns a list of names, but nothing stops them from going away before rbd.open(); check for ENOENT and ignore if that happens; warn on other errors Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
c17d628b52
commit
8103414a45
14
src/rbd.cc
14
src/rbd.cc
@ -199,7 +199,19 @@ static int do_list(librbd::RBD &rbd, librados::IoCtx& io_ctx, bool lflag)
|
||||
librbd::image_info_t info;
|
||||
librbd::Image im;
|
||||
|
||||
rbd.open(io_ctx, im, i->c_str());
|
||||
r = rbd.open(io_ctx, im, i->c_str());
|
||||
// image might disappear between rbd.list() and rbd.open(); ignore
|
||||
// that, warn about other possible errors (EPERM, say, for opening
|
||||
// an old-format image, because you need execute permission for the
|
||||
// class method)
|
||||
if (r < 0) {
|
||||
if (r != -ENOENT) {
|
||||
cerr << "rbd: error opening " << *i << ": " << cpp_strerror(r)
|
||||
<< std::endl;
|
||||
}
|
||||
// in any event, continue to next image
|
||||
continue;
|
||||
}
|
||||
|
||||
// handle second-nth trips through loop
|
||||
parent.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user