Project

General

Profile

Actions

Bug #65744

closed
ID JM

FORMAT and CLONE_FORMAT image options accept bogus values

Bug #65744: FORMAT and CLONE_FORMAT image options accept bogus values

Added by Ilya Dryomov over 2 years ago. Updated about 1 year ago.

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

0%

Source:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Fixed In:
v19.3.0-3611-g8914b259ee
Released In:
v20.2.0~2437
Upkeep Timestamp:
2025-11-01T01:18:28+00:00

Description

In particular, for RBD_IMAGE_OPTION_CLONE_FORMAT, 1 selects clone v1 and everything else (i.e. 0, 2, 3, ...) selects clone v2.


Related issues 1 (0 open — 1 closed)

Related to rbd - Feature #65624: [pybind] expose CLONE_FORMAT and FLATTEN image optionsResolvedIlya Dryomov

Actions

ID Updated by Ilya Dryomov over 2 years ago Actions #1

  • Subject changed from FORMAT and CLONE_FORMAT accept bogus values to FORMAT and CLONE_FORMAT image options accept bogus values
  • Description updated (diff)

ID Updated by Ilya Dryomov over 2 years ago Actions #2

  • Related to Feature #65624: [pybind] expose CLONE_FORMAT and FLATTEN image options added

JM Updated by junxiang mu over 2 years ago Actions #3

It seems that it was intentionally designed like this

ID Updated by Ilya Dryomov over 2 years ago Actions #4

junxiang mu wrote in #note-3:

It seems that it was intentionally designed like this

What makes you say that?

IMO there is a difference between allowing the option to be set to a particular value and actually accepting (interpreting) that value in the API. Here, I would expect

rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_CLONE_FORMAT, 12345)

to succeed, because, in general, we don't know which API `opts` would be passed to. `rbd_image_options_t` is just a container for different image-related options -- it's not supposed to validate option values because, speaking generally again, different APIs may have different subsets of values that they can work with for the same option. But then, I would expect
rbd_clone3(p_ioctx, "parent", "snap", c_ioctx, "clone", opts)

to fail because 12345 can't be sanely interpreted as a clone format. The fact that 12345 gets coerced to 2 isn't obvious to the user and isn't documented. Also, it would be a major pain if we ever wanted to introduce a new clone format, e.g. clone v3.

JM Updated by junxiang mu over 2 years ago Actions #5

  • Assignee set to junxiang mu

so, When the value of `CLONE_FORMAT` is not equal to 1 or 2, we should return a failure instead of forcing it to 2

JM Updated by junxiang mu over 2 years ago Actions #6

Should return a failure or convert to 2 if they have not set the value of `CLONE_FORMAT`?

ID Updated by Ilya Dryomov over 2 years ago ยท Edited Actions #7

Should return a failure or convert to 2 if they have not set the value of `CLONE_FORMAT`?

If CLONE_FORMAT option isn't set, rbd_default_clone_format config option kicks in.

I think we should be validating the value that is acted on irrespective of where it came from -- anything but 1 or 2 should produce an error.

JM Updated by junxiang mu over 2 years ago Actions #8

  • Pull request ID set to 58180

JM Updated by junxiang mu over 2 years ago Actions #9

  • Status changed from New to Fix Under Review

ID Updated by Ilya Dryomov over 2 years ago Actions #10

  • Status changed from Fix Under Review to Resolved

UB Updated by Upkeep Bot over 1 year ago Actions #11

  • Merge Commit set to 8914b259eea9b14d6dff0e8466a776d13b528f53
  • Fixed In set to v19.3.0-3611-g8914b259eea
  • Upkeep Timestamp set to 2025-07-11T11:09:13+00:00

UB Updated by Upkeep Bot over 1 year ago Actions #12

  • Fixed In changed from v19.3.0-3611-g8914b259eea to v19.3.0-3611-g8914b259ee
  • Upkeep Timestamp changed from 2025-07-11T11:09:13+00:00 to 2025-07-14T23:09:11+00:00

UB Updated by Upkeep Bot about 1 year ago Actions #13

  • Released In set to v20.2.0~2437
  • Upkeep Timestamp changed from 2025-07-14T23:09:11+00:00 to 2025-11-01T01:18:28+00:00
Actions

Also available in: PDF Atom