Project

General

Profile

Bug #4707

rbd CLI: bad error code masked by udevadm_settle

Added by Alex Elder almost 11 years ago. Updated almost 11 years ago.

Status:
Resolved
Priority:
Urgent
Assignee:
Target version:
% Done:

0%

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

Description

I found that despite my attempt to map a v2 image the rbd
CLI gave me an exit status of 0.

Looking at the code, I see this at the end of do_kernel_add():

  string add = oss.str();
  r = safe_write(fd, add.c_str(), add.size());
  close(fd);

  // let udevadm do its job before we return
  if (udevadm_settle) {
    r = system("/sbin/udevadm settle");
    if (r) {
      if (r < 0)
        cerr << "rbd: error executing udevadm as shell command!" << std::endl;
      else
        cerr << "rbd: '/sbin/udevadm settle' failed! (" << r << ")" <<std::endl;
      return r;
    }
  }

So whatever was returned by the write to /sys/bus/rbd/add gets
overwritten by the status of system("udevadm settle").

That's no good.

Associated revisions

Revision 568101fa (diff)
Added by Sage Weil almost 11 years ago

rbd: avoid clobbering return value with udevadm settle

Fixes: #4707
Signed-off-by: Sage Weil <>

History

#1 Updated by Alex Elder almost 11 years ago

It looks like the other places udevadm settle is called
do not suffer from this problem.

#2 Updated by Ian Colle almost 11 years ago

  • Priority changed from High to Urgent
  • Target version set to v0.61 - Cuttlefish

Let's try to get this into Cuttlefish.

#3 Updated by Ian Colle almost 11 years ago

  • Assignee set to Josh Durgin

#4 Updated by Sage Weil almost 11 years ago

  • Status changed from New to In Progress
  • Assignee changed from Josh Durgin to Sage Weil

#5 Updated by Sage Weil almost 11 years ago

  • Status changed from In Progress to Resolved

commit:568101fa72e29ee960fcf3d704f04edfd50bd072

Also available in: Atom PDF