Project

General

Profile

Actions

Bug #83301

open
YS

mon: "osd pool set fingerprint_algorithm/dedup_chunk_algorithm none" is rejected, while invalid values are accepted

Bug #83301: mon: "osd pool set fingerprint_algorithm/dedup_chunk_algorithm none" is rejected, while invalid values are accepted

Added by yulong shi 15 days ago. Updated 8 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Monitor
Target version:
-
Due date:
% Done:

0%

Source:
Community (dev)
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

Summary

ceph osd pool set <pool> fingerprint_algorithm none is rejected, while setting fingerprint_algorithm to an arbitrary string succeeds and stores it in the pool. dedup_chunk_algorithm behaves the same way.

Steps to reproduce

$ ceph osd pool create test
$ ceph osd pool set test fingerprint_algorithm none
Error EINVAL: unrecognized fingerprint_algorithm 'none'
$ ceph osd pool set test fingerprint_algorithm foo
set pool 1 fingerprint_algorithm to foo

$ ceph osd pool set test dedup_chunk_algorithm none
Error EINVAL: unrecognized fingerprint_algorithm 'none'
$ ceph osd pool set test dedup_chunk_algorithm foo
set pool 1 dedup_chunk_algorithm to foo

The error for dedup_chunk_algorithm also names the wrong option ("unrecognized fingerprint_algorithm").

Root cause

pg_pool_t::get_fingerprint_from_str() and pg_pool_t::get_dedup_chunk_algorithm_from_str() return 0 (TYPE_FINGERPRINT_NONE / TYPE_DEDUP_CHUNK_NONE) for "none", and -1 for an unknown value. OSDMonitor::prepare_command_pool_set() checks the result with if (!alg), so the check is inverted: "none" is rejected and every unknown value is accepted.

Impact

  • "none" cannot be set explicitly; only unset clears the option.
  • An invalid value is stored in the pool. pg_pool_t::get_fingerprint_type() then returns -1, which PrimaryLogPG::get_fpoid_from_chunk() does not treat as TYPE_FINGERPRINT_NONE, so it reaches the default: branch of its switch, which is assert(0).

YS Updated by yulong shi 15 days ago Actions #1

  • Pull request ID set to 74038

KS Updated by Kamoltat (Junior) Sirivadhna 8 days ago Actions #2

fix under review

Actions

Also available in: PDF Atom