Project

General

Profile

Fix #18511

rbd_discard return should be ssize_t instead of int

Added by Pingkai Liu about 7 years ago. Updated almost 7 years ago.

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

0%

Spent time:
Source:
Community (dev)
Tags:
rbd discard ssize_t return type
Backport:
Reviewed:
01/12/2017
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

the rbd_discard() related functions are now returning int, but if we look at the actual implementation, we can see it should return a 64bit integer since len is returned.

int AioImageRequestWQ::discard(uint64_t off, uint64_t len) {
  CephContext *cct = m_image_ctx.cct;
  ldout(cct, 20) << "discard: ictx=" << &m_image_ctx << ", off=" << off << ", " 
                 << "len = " << len << dendl;

  m_image_ctx.snap_lock.get_read();
  int r = clip_io(util::get_image_ctx(&m_image_ctx), off, &len);
  m_image_ctx.snap_lock.put_read();
  if (r < 0) {
    lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
    return r;
  }

  C_SaferCond cond;
  AioCompletion *c = AioCompletion::create(&cond);
  aio_discard(c, off, len, false);

  r = cond.wait();
  if (r < 0) {
    return r;
  }
  return len;
}

History

#1 Updated by Jos Collin about 7 years ago

  • Status changed from New to In Progress
  • Assignee changed from Pingkai Liu to Jos Collin

The fix for this is ready with me.

#2 Updated by Jos Collin about 7 years ago

  • Status changed from In Progress to Fix Under Review
  • Tags set to rbd discard ssize_t return type

#3 Updated by Jos Collin about 7 years ago

  • Status changed from Fix Under Review to Resolved

PR#14032 is approved by badone.

#4 Updated by Jos Collin about 7 years ago

  • Status changed from Resolved to In Progress

#5 Updated by Jos Collin almost 7 years ago

The PR is approved by dillaman

#6 Updated by Jos Collin almost 7 years ago

  • Status changed from In Progress to Resolved

The PR is merged.

dillaman merged commit d366311 into ceph:master

Also available in: Atom PDF