From aa37726b8d43d08b495d55dc2aef93854e9539c5 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 23 Apr 2013 09:18:30 -0700 Subject: [PATCH] rbd: only set STRIPINGV2 feature when needed Only set the STRIPINGV2 feature if the striping parameters are non-default. Specifically, fix the case where the passed-in size and count are == 0. Fixes: #4710 Signed-off-by: Sage Weil (cherry picked from commit 5926ffa576e9477324ca00eaec731a224195e7db) Conflicts: src/rbd.cc --- src/rbd.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rbd.cc b/src/rbd.cc index 42973d1286b7b..30686b4144fca 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -293,9 +293,12 @@ static int do_create(librbd::RBD &rbd, librados::IoCtx& io_ctx, if (features == 0) { features = RBD_FEATURE_LAYERING; } - if (stripe_unit != (1ull << *order) && stripe_count != 1) + if ((stripe_unit || stripe_count) && + (stripe_unit != (1ull << *order) && stripe_count != 1)) { features |= RBD_FEATURE_STRIPINGV2; - r = rbd.create3(io_ctx, imgname, size, features, order, stripe_unit, stripe_count); + } + r = rbd.create3(io_ctx, imgname, size, features, order, + stripe_unit, stripe_count); } if (r < 0) return r; -- 2.39.5