diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2013-02-12 16:55:32 -0800 |
---|---|---|
committer | Josh Durgin <josh.durgin@inktank.com> | 2013-02-12 16:55:32 -0800 |
commit | 0fec0fde4239e8410ed0103726d8db5a9768dad4 (patch) | |
tree | 5818165f17c74fd6d30b49920a83e9cc57c8e039 | |
parent | 188f3ea6867eeb6e950f6efed18d53ff17522bbc (diff) | |
parent | fe283813b44a7c45def6768ea0788a3a0635957e (diff) | |
download | ceph-0fec0fde4239e8410ed0103726d8db5a9768dad4.tar.gz |
Merge branch 'next'
Conflicts:
src/include/ceph_features.h
-rwxr-xr-x | qa/workunits/misc/mkpool_layout_vxattrs.sh | 13 | ||||
-rw-r--r-- | src/include/ceph_features.h | 4 | ||||
-rw-r--r-- | src/librbd/ImageCtx.cc | 13 | ||||
-rw-r--r-- | src/librbd/ImageCtx.h | 1 | ||||
-rw-r--r-- | src/librbd/internal.cc | 13 | ||||
-rw-r--r-- | src/mds/MDCache.cc | 1 | ||||
-rw-r--r-- | src/mds/MDS.cc | 4 | ||||
-rw-r--r-- | src/mds/MDS.h | 2 | ||||
-rw-r--r-- | src/mds/Mutation.h | 12 | ||||
-rw-r--r-- | src/mds/Server.cc | 24 | ||||
-rw-r--r-- | src/osd/OSD.cc | 11 | ||||
-rw-r--r-- | src/test/cli/ceph/help.t | 1 | ||||
-rw-r--r-- | src/tools/ceph.cc | 1 |
13 files changed, 91 insertions, 9 deletions
diff --git a/qa/workunits/misc/mkpool_layout_vxattrs.sh b/qa/workunits/misc/mkpool_layout_vxattrs.sh new file mode 100755 index 00000000000..16b3cdfe517 --- /dev/null +++ b/qa/workunits/misc/mkpool_layout_vxattrs.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +touch foo.$$ +rados mkpool foo.$$ +poolid=$(ceph osd dump | grep "^pool" | awk '{print $2}' | tail -n 1) +ceph mds add_data_pool ${poolid} +setfattr -n ceph.file.layout.pool -v foo.$$ foo.$$ + +# cleanup +rados rmpool foo.$$ foo.$$ --yes-i-really-really-mean-it +rm foo.$$ diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index 242e239c667..c9ff72c15f9 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -32,7 +32,8 @@ #define CEPH_FEATURE_CRUSH_TUNABLES2 (1<<25) #define CEPH_FEATURE_CREATEPOOLID (1<<26) #define CEPH_FEATURE_REPLY_CREATE_INODE (1<<27) -#define CEPH_FEATURE_MDSENC (1<<28) +#define CEPH_FEATURE_OSD_HBMSGS (1<<28) +#define CEPH_FEATURE_MDSENC (1<<29) /* * Features supported. Should be everything above. @@ -66,6 +67,7 @@ CEPH_FEATURE_CRUSH_TUNABLES2 | \ CEPH_FEATURE_CREATEPOOLID | \ CEPH_FEATURE_REPLY_CREATE_INODE | \ + CEPH_FEATURE_OSD_HBMSGS | \ CEPH_FEATURE_MDSENC) #define CEPH_FEATURES_SUPPORTED_DEFAULT CEPH_FEATURES_ALL diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index cffc556c1d4..7909f8c620c 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -332,6 +332,19 @@ namespace librbd { return -ENOENT; } + int ImageCtx::is_snap_unprotected(string in_snap_name, + bool *is_unprotected) const + { + assert(snap_lock.is_locked()); + map<string, SnapInfo>::const_iterator it = snaps_by_name.find(in_snap_name); + if (it != snaps_by_name.end()) { + *is_unprotected = + (it->second.protection_status == RBD_PROTECTION_STATUS_UNPROTECTED); + return 0; + } + return -ENOENT; + } + int ImageCtx::get_snap_size(string in_snap_name, uint64_t *out_size) const { assert(snap_lock.is_locked()); diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index ed03846fcde..b24639906b2 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -104,6 +104,7 @@ namespace librbd { int get_parent_spec(snapid_t snap_id, parent_spec *pspec); int get_snap_size(std::string in_snap_name, uint64_t *out_size) const; int is_snap_protected(string in_snap_name, bool *is_protected) const; + int is_snap_unprotected(string in_snap_name, bool *is_unprotected) const; uint64_t get_current_size() const; uint64_t get_object_size() const; diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 663556e49a3..fdadf6f6753 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -585,12 +585,12 @@ namespace librbd { if (snap_id == CEPH_NOSNAP) return -ENOENT; - bool is_protected; - r = ictx->is_snap_protected(snap_name, &is_protected); + bool is_unprotected; + r = ictx->is_snap_unprotected(snap_name, &is_unprotected); if (r < 0) return r; - if (!is_protected) + if (is_unprotected) return -EINVAL; r = cls_client::set_protection_status(&ictx->md_ctx, @@ -662,7 +662,12 @@ reprotect_and_return_err: return r; Mutex::Locker l(ictx->snap_lock); - return ictx->is_snap_protected(snap_name, is_protected); + bool is_unprotected; + r = ictx->is_snap_unprotected(snap_name, &is_unprotected); + // consider both PROTECTED or UNPROTECTING to be 'protected', + // since in either state they can't be deleted + *is_protected = !is_unprotected; + return r; } int create_v1(IoCtx& io_ctx, const char *imgname, uint64_t bid, diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 2c48d375af8..da5ac0663ed 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -10581,6 +10581,7 @@ C_MDS_RetryRequest::C_MDS_RetryRequest(MDCache *c, MDRequest *r) void C_MDS_RetryRequest::finish(int r) { + mdr->retry++; cache->dispatch_request(mdr); mdr->put(); } diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 80afa241356..75dcf9e6dba 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -690,6 +690,10 @@ void MDS::handle_mds_beacon(MMDSBeacon *m) m->put(); } +void MDS::request_osdmap(Context *c) { + objecter->wait_for_new_map(c, osdmap->get_epoch()); +} + /* This function DOES put the passed message before returning*/ void MDS::handle_command(MMonCommand *m) { diff --git a/src/mds/MDS.h b/src/mds/MDS.h index f61ad8ddac5..50555e831d9 100644 --- a/src/mds/MDS.h +++ b/src/mds/MDS.h @@ -394,6 +394,8 @@ class MDS : public Dispatcher { void beacon_send(); void handle_mds_beacon(MMDSBeacon *m); + void request_osdmap(Context *c); + // messages bool _dispatch(Message *m); diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index bb5f1f6febc..313edef30d8 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -188,6 +188,12 @@ struct MDRequest : public Mutation { // -- i am an internal op int internal_op; + // indicates how may retries of request have been made + int retry; + + // indicator for vxattr osdmap update + bool waited_for_osdmap; + // break rarely-used fields into a separately allocated structure // to save memory for most ops struct More { @@ -241,6 +247,8 @@ struct MDRequest : public Mutation { alloc_ino(0), used_prealloc_ino(0), snap_caps(0), did_early_reply(false), slave_request(0), internal_op(-1), + retry(0), + waited_for_osdmap(false), _more(0) { in[0] = in[1] = 0; } @@ -252,6 +260,8 @@ struct MDRequest : public Mutation { alloc_ino(0), used_prealloc_ino(0), snap_caps(0), did_early_reply(false), slave_request(0), internal_op(-1), + retry(0), + waited_for_osdmap(false), _more(0) { in[0] = in[1] = 0; } @@ -263,6 +273,8 @@ struct MDRequest : public Mutation { alloc_ino(0), used_prealloc_ino(0), snap_caps(0), did_early_reply(false), slave_request(0), internal_op(-1), + retry(0), + waited_for_osdmap(false), _more(0) { in[0] = in[1] = 0; } diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 36850307697..ac51e60d0a9 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3531,7 +3531,7 @@ int Server::parse_layout_vxattr(string name, string value, ceph_file_layout *lay int64_t pool = mds->osdmap->lookup_pg_pool_name(value); if (pool < 0) { dout(10) << " unknown pool " << value << dendl; - return -EINVAL; + return -ENOENT; } layout->fl_pg_pool = pool; } @@ -3589,6 +3589,17 @@ void Server::handle_set_vxattr(MDRequest *mdr, CInode *cur, rest = name.substr(name.find("layout")); int r = parse_layout_vxattr(rest, value, &dlayout->layout); if (r < 0) { + if (r == -ENOENT) { + if (!mdr->waited_for_osdmap) { + // send request to get latest map, but don't wait if + // we don't get anything newer than what we have + mdr->waited_for_osdmap = true; + mds->request_osdmap( + new C_MDS_RetryRequest(mdcache, mdr)); + return; + } + r = -EINVAL; + } reply_request(mdr, r); return; } @@ -3608,6 +3619,17 @@ void Server::handle_set_vxattr(MDRequest *mdr, CInode *cur, rest = name.substr(name.find("layout")); int r = parse_layout_vxattr(rest, value, &layout); if (r < 0) { + if (r == -ENOENT) { + if (!mdr->waited_for_osdmap) { + // send request to get latest map, but don't wait if + // we don't get anything newer than what we have + mdr->waited_for_osdmap = true; + mds->request_osdmap( + new C_MDS_RetryRequest(mdcache, mdr)); + return; + } + r = -EINVAL; + } reply_request(mdr, r); return; } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 243eccf8048..25bc48c4550 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3422,7 +3422,8 @@ bool OSD::heartbeat_dispatch(Message *m) break; default: - return false; + dout(0) << "dropping unexpected message " << *m << " from " << m->get_source_inst() << dendl; + m->put(); } return true; @@ -4683,8 +4684,12 @@ bool OSD::require_same_or_newer_map(OpRequestRef op, epoch_t epoch) int from = m->get_source().num(); if (!osdmap->have_inst(from) || osdmap->get_cluster_addr(from) != m->get_source_inst().addr) { - dout(0) << "from dead osd." << from << ", dropping, sharing map" << dendl; - send_incremental_map(epoch, m->get_connection()); + if (m->get_connection()->has_feature(CEPH_FEATURE_OSD_HBMSGS)) { + dout(10) << "from dead osd." << from << ", dropping, sharing map" << dendl; + send_incremental_map(epoch, m->get_connection()); + } else { + dout(10) << "from dead osd." << from << ", but it lacks OSD_HBMSGS feature, not sharing map" << dendl; + } return false; } } diff --git a/src/test/cli/ceph/help.t b/src/test/cli/ceph/help.t index eac011dc814..9f84986f02e 100644 --- a/src/test/cli/ceph/help.t +++ b/src/test/cli/ceph/help.t @@ -20,6 +20,7 @@ METADATA SERVER (MDS) COMMANDS ceph mds stat ceph mds tell <mds-id or *> injectargs '--<switch> <value> [--<switch> <value>...]' + ceph mds add_data_pool <pool-id> MONITOR (MON) COMMANDS ceph mon add <name> <ip>[:<port>] diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc index a1f8024cfe3..d8686d5cb17 100644 --- a/src/tools/ceph.cc +++ b/src/tools/ceph.cc @@ -63,6 +63,7 @@ static void usage() cout << "METADATA SERVER (MDS) COMMANDS\n"; cout << " ceph mds stat\n"; cout << " ceph mds tell <mds-id or *> injectargs '--<switch> <value> [--<switch> <value>...]'\n"; + cout << " ceph mds add_data_pool <pool-id>\n"; cout << "\n"; cout << "MONITOR (MON) COMMANDS\n"; cout << " ceph mon add <name> <ip>[:<port>]\n"; |