Skip to content

Commit

Permalink
Merge remote-tracking branch 'gh/next'
Browse files Browse the repository at this point in the history
  • Loading branch information
liewegas committed May 27, 2015
2 parents 9ff69f6 + 055c0c4 commit c6f62f5
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 19 deletions.
2 changes: 1 addition & 1 deletion SubmittingPatches
Expand Up @@ -242,7 +242,7 @@ email list to ensure your submission is noticed.

When addressing review comments, can should either add additional patches to
your branch or (better yet) squash those changes into the relevant commits so
that the sequence of changes of "clean" and gets things right the first time.
that the sequence of changes is "clean" and gets things right the first time.
The 'git rebase -i' command is very helpful in this process. Once you have
updated your local branch, you can simply force-push to the existing branch
in your public repository that is referenced by the pull request with
Expand Down
23 changes: 15 additions & 8 deletions ceph.spec.in
Expand Up @@ -26,7 +26,7 @@ License: GPL-2.0
Group: System Environment/Base
URL: http://ceph.com/
Source0: http://ceph.com/download/%{name}-%{version}.tar.bz2
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
%if 0%{?fedora} || 0%{?rhel}
Patch0: init-ceph.in-fedora.patch
%endif
Requires: librbd1 = %{epoch}:%{version}-%{release}
Expand All @@ -52,7 +52,9 @@ Requires: systemd
%endif
BuildRequires: gcc-c++
BuildRequires: boost-devel
%if ! 0%{defined suse_version}
%if 0%{defined suse_version}
BuildRequires: libbz2-devel
%else
BuildRequires: bzip2-devel
%endif
BuildRequires: cryptsetup
Expand Down Expand Up @@ -86,7 +88,7 @@ BuildRequires: xfsprogs
BuildRequires: xfsprogs-devel
BuildRequires: xmlstarlet
BuildRequires: yasm
%if 0%{?rhel} || 0%{?centos} || 0%{?fedora} || 0%{?suse_version}
%if 0%{?rhel} || 0%{?fedora} || 0%{?suse_version}
BuildRequires: snappy-devel
%endif
%if 0%{?suse_version}
Expand Down Expand Up @@ -144,7 +146,12 @@ Requires: python-rados = %{epoch}:%{version}-%{release}
Requires: python-rbd = %{epoch}:%{version}-%{release}
Requires: python-cephfs = %{epoch}:%{version}-%{release}
Requires: python-requests
Requires: redhat-lsb-core
%if 0%{defined suse_version}
Requires: python-argparse
%endif
%if 0%{?rhel} || 0%{?fedora}
Requires: redhat-lsb-core
%endif
%description -n ceph-common
Common utilities to mount and interact with a ceph storage cluster.

Expand Down Expand Up @@ -201,7 +208,7 @@ managers such as Pacemaker.
Summary: RADOS distributed object store client library
Group: System Environment/Libraries
License: LGPL-2.0
%if 0%{?rhel} || 0%{?centos} || 0%{?fedora}
%if 0%{?rhel} || 0%{?fedora}
Obsoletes: ceph-libs < %{epoch}:%{version}-%{release}
%endif
%description -n librados2
Expand Down Expand Up @@ -259,7 +266,7 @@ Summary: RADOS block device client library
Group: System Environment/Libraries
License: LGPL-2.0
Requires: librados2 = %{epoch}:%{version}-%{release}
%if 0%{?rhel} || 0%{?centos} || 0%{?fedora}
%if 0%{?rhel} || 0%{?fedora}
Obsoletes: ceph-libs < %{epoch}:%{version}-%{release}
%endif
%description -n librbd1
Expand Down Expand Up @@ -294,7 +301,7 @@ block device.
Summary: Ceph distributed file system client library
Group: System Environment/Libraries
License: LGPL-2.0
%if 0%{?rhel} || 0%{?centos} || 0%{?fedora}
%if 0%{?rhel} || 0%{?fedora}
Obsoletes: ceph-libs < %{epoch}:%{version}-%{release}
Obsoletes: ceph-libcephfs
%endif
Expand Down Expand Up @@ -444,7 +451,7 @@ python-cephfs instead.
#################################################################################
%prep
%setup -q
%if 0%{?fedora} || 0%{?rhel} || 0%{?centos}
%if 0%{?fedora} || 0%{?rhel}
%patch0 -p1 -b .init
%endif

Expand Down
6 changes: 4 additions & 2 deletions debian/control
Expand Up @@ -452,7 +452,8 @@ Package: rest-bench-dbg
Architecture: linux-any
Section: debug
Priority: extra
Depends: ceph-common, curl, xml2, ${misc:Depends}, ${shlibs:Depends}
Depends: rest-bench (= ${binary:Version}), ceph-common, curl, xml2,
${misc:Depends}, ${shlibs:Depends}
Description: debugging symbols for rest-bench
radosgw performance.
.
Expand All @@ -468,7 +469,8 @@ Package: ceph-test-dbg
Architecture: linux-any
Section: debug
Priority: extra
Depends: ceph-common, curl, xml2, ${misc:Depends}, ${shlibs:Depends}
Depends: ceph-test (= ${binary:Version}), ceph-common, curl, xml2,
${misc:Depends}, ${shlibs:Depends}
Description: Ceph test and benchmarking tools
.
This package contains the debugging symbols for ceph-test.
Expand Down
6 changes: 6 additions & 0 deletions qa/workunits/mon/crush_ops.sh
Expand Up @@ -63,6 +63,12 @@ ceph osd tree | grep -c host1 | grep -q 0

expect_false ceph osd crush rm bar # not empty
ceph osd crush unlink host2

# reference foo and bar with a rule
ceph osd crush rule create-simple foo-rule foo host firstn
expect_false ceph osd crush rm foo
ceph osd crush rule rm foo-rule

ceph osd crush rm bar
ceph osd crush rm foo
ceph osd crush rm osd.$o2 host2
Expand Down
27 changes: 27 additions & 0 deletions src/crush/CrushWrapper.cc
Expand Up @@ -192,6 +192,9 @@ bool CrushWrapper::_maybe_remove_last_instance(CephContext *cct, int item, bool
if (_search_item_exists(item)) {
return false;
}
if (item < 0 && _bucket_is_in_use(cct, item)) {
return false;
}

if (item < 0 && !unlink_only) {
crush_bucket *t = get_bucket(item);
Expand Down Expand Up @@ -219,6 +222,9 @@ int CrushWrapper::remove_item(CephContext *cct, int item, bool unlink_only)
<< " items, not empty" << dendl;
return -ENOTEMPTY;
}
if (_bucket_is_in_use(cct, item)) {
return -EBUSY;
}
}

for (int i = 0; i < crush->max_buckets; i++) {
Expand Down Expand Up @@ -258,6 +264,22 @@ bool CrushWrapper::_search_item_exists(int item) const
return false;
}

bool CrushWrapper::_bucket_is_in_use(CephContext *cct, int item)
{
for (unsigned i = 0; i < crush->max_rules; ++i) {
crush_rule *r = crush->rules[i];
if (!r)
continue;
for (unsigned j = 0; j < r->len; ++j) {
if (r->steps[j].op == CRUSH_RULE_TAKE &&
r->steps[j].arg1 == item) {
return true;
}
}
}
return false;
}

int CrushWrapper::_remove_item_under(CephContext *cct, int item, int ancestor, bool unlink_only)
{
ldout(cct, 5) << "_remove_item_under " << item << " under " << ancestor
Expand Down Expand Up @@ -293,6 +315,11 @@ int CrushWrapper::remove_item_under(CephContext *cct, int item, int ancestor, bo
{
ldout(cct, 5) << "remove_item_under " << item << " under " << ancestor
<< (unlink_only ? " unlink_only":"") << dendl;

if (!unlink_only && _bucket_is_in_use(cct, item)) {
return -EBUSY;
}

int ret = _remove_item_under(cct, item, ancestor, unlink_only);
if (ret < 0)
return ret;
Expand Down
1 change: 1 addition & 0 deletions src/crush/CrushWrapper.h
Expand Up @@ -587,6 +587,7 @@ class CrushWrapper {
private:
bool _maybe_remove_last_instance(CephContext *cct, int id, bool unlink_only);
int _remove_item_under(CephContext *cct, int id, int ancestor, bool unlink_only);
bool _bucket_is_in_use(CephContext *cct, int id);
public:
int remove_item_under(CephContext *cct, int id, int ancestor, bool unlink_only);

Expand Down
11 changes: 9 additions & 2 deletions src/crush/mapper.c
Expand Up @@ -839,8 +839,15 @@ int crush_do_rule(const struct crush_map *map,

switch (curstep->op) {
case CRUSH_RULE_TAKE:
w[0] = curstep->arg1;
wsize = 1;
if ((curstep->arg1 >= 0 &&
curstep->arg1 < map->max_devices) ||
(-1-curstep->arg1 < map->max_buckets &&
map->buckets[-1-curstep->arg1])) {
w[0] = curstep->arg1;
wsize = 1;
} else {
dprintk(" bad take value %d\n", curstep->arg1);
}
break;

case CRUSH_RULE_SET_CHOOSE_TRIES:
Expand Down
9 changes: 9 additions & 0 deletions src/rgw/rgw_op.cc
Expand Up @@ -1807,6 +1807,12 @@ void RGWPutObj::execute()
*/
bool need_to_wait = (ofs == 0) && multipart;

bufferlist orig_data;

if (need_to_wait) {
orig_data = data;
}

ret = put_data_and_throttle(processor, data, ofs, (need_calc_md5 ? &hash : NULL), need_to_wait);
if (ret < 0) {
if (!need_to_wait || ret != -EEXIST) {
Expand All @@ -1816,6 +1822,9 @@ void RGWPutObj::execute()

ldout(s->cct, 5) << "NOTICE: processor->throttle_data() returned -EEXIST, need to restart write" << dendl;

/* restore original data */
data.swap(orig_data);

/* restart processing with different oid suffix */

dispose_processor(processor);
Expand Down
19 changes: 14 additions & 5 deletions src/rgw/rgw_rados.cc
Expand Up @@ -773,15 +773,24 @@ int RGWObjManifest::append(RGWObjManifest& m)
next_rule.part_size = m.obj_size - next_rule.start_ofs;
}

if (override_prefix != rule.override_prefix) {
append_rules(m, miter, &override_prefix);
break;
string rule_prefix = prefix;
if (!rule.override_prefix.empty()) {
rule_prefix = rule.override_prefix;
}

string next_rule_prefix = m.prefix;
if (!next_rule.override_prefix.empty()) {
next_rule_prefix = next_rule.override_prefix;
}

if (rule.part_size != next_rule.part_size ||
rule.stripe_max_size != next_rule.stripe_max_size ||
rule.override_prefix != next_rule.override_prefix) {
append_rules(m, miter, NULL);
rule_prefix != next_rule_prefix) {
if (next_rule_prefix != prefix) {
append_rules(m, miter, &next_rule_prefix);
} else {
append_rules(m, miter, NULL);
}
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_rest_swift.cc
Expand Up @@ -27,7 +27,7 @@ int RGWListBuckets_ObjStore_SWIFT::get_params()
}

if (l > (long)limit_max || l < 0) {
return -EINVAL;
return -ERR_PRECONDITION_FAILED;
}

limit = (uint64_t)l;
Expand Down

0 comments on commit c6f62f5

Please sign in to comment.