]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rbd: find_action() should sort actions first
authorIlya Dryomov <idryomov@gmail.com>
Fri, 12 Aug 2022 09:10:45 +0000 (11:10 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 14 Aug 2022 16:30:33 +0000 (18:30 +0200)
commita9776fd652bd1c0f6de15f413e2dc7b409c4b472
treeb87d066a59e5e6f5670abef64d41892fab6efda6
parentd8f610b9643f0ffafccdb67ab38e9c66321a77ae
rbd: find_action() should sort actions first

The order in which objects with static storage duration in
different TUs are initialized is undefined.  If the compiler
chooses to initialize Shell::Action objects in action/Trash.cc
before Shell::Action objects in action/TrashPurgeSchedule.cc,
all "rbd trash purge schedule ..." commands get shadowed by
"rbd trash purge" command:

$ rbd trash purge schedule list
rbd: too many arguments

The confusing error arises because "rbd trash purge" takes a single
positional argument.  "schedule" gets interpreted as <pool-spec> and
"list" generates an error.

Fixes: https://tracker.ceph.com/issues/57107
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit e0b428a87a48f2132c825ffde4629709a57b76d6)
src/tools/rbd/Shell.cc