From a2682edb76ceac428c686e0ac21c06511e27693e Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 28 Jun 2016 14:22:08 +0100 Subject: [PATCH 1/4] mds: remove TMAP2OMAP check and refactor Removing this check allows us to finally move the Objecter instance down into MDSRank where it belongs. Fixes: http://tracker.ceph.com/issues/15923 Signed-off-by: John Spray --- src/mds/MDSDaemon.cc | 43 +++---------------------------------------- src/mds/MDSDaemon.h | 3 --- src/mds/MDSRank.cc | 22 ++++++++++++++++++---- src/mds/MDSRank.h | 3 +-- 4 files changed, 22 insertions(+), 49 deletions(-) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index ad163372b1c17..869daaef7a92b 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -116,7 +116,6 @@ MDSDaemon::MDSDaemon(const std::string &n, Messenger *m, MonClient *mc) : name(n), messenger(m), monc(mc), - objecter(new Objecter(m->cct, m, mc, NULL, 0, 0)), log_client(m->cct, messenger, &mc->monmap, LogClient::NO_FLAGS), mds_rank(NULL), tick_event(0), @@ -130,8 +129,6 @@ MDSDaemon::MDSDaemon(const std::string &n, Messenger *m, MonClient *mc) : monc->set_messenger(messenger); mdsmap = new MDSMap; - - objecter->unset_honor_osdmap_full(); } MDSDaemon::~MDSDaemon() { @@ -139,8 +136,6 @@ MDSDaemon::~MDSDaemon() { delete mds_rank; mds_rank = NULL; - delete objecter; - objecter = NULL; delete mdsmap; mdsmap = NULL; @@ -189,9 +184,6 @@ bool MDSDaemon::asok_command(string command, cmdmap_t& cmdmap, string format, void MDSDaemon::dump_status(Formatter *f) { - const epoch_t osd_epoch = objecter->with_osdmap( - std::mem_fn(&OSDMap::get_epoch)); - f->open_object_section("status"); f->dump_stream("cluster_fsid") << monc->get_fsid(); if (mds_rank) { @@ -209,10 +201,11 @@ void MDSDaemon::dump_status(Formatter *f) } f->dump_unsigned("mdsmap_epoch", mdsmap->get_epoch()); - f->dump_unsigned("osdmap_epoch", osd_epoch); if (mds_rank) { + f->dump_unsigned("osdmap_epoch", mds_rank->get_osd_epoch()); f->dump_unsigned("osdmap_epoch_barrier", mds_rank->get_osd_epoch_barrier()); } else { + f->dump_unsigned("osdmap_epoch", 0); f->dump_unsigned("osdmap_epoch_barrier", 0); } f->close_section(); // status @@ -457,9 +450,6 @@ int MDSDaemon::init() dout(10) << sizeof(Capability) << "\tCapability " << dendl; dout(10) << sizeof(xlist::item) << "\t xlist<>::item *2=" << 2*sizeof(xlist::item) << dendl; - objecter->init(); - messenger->add_dispatcher_tail(objecter); - messenger->add_dispatcher_tail(&beacon); messenger->add_dispatcher_tail(this); @@ -505,8 +495,6 @@ int MDSDaemon::init() return -ETIMEDOUT; } - objecter->start(); - mds_lock.Lock(); if (beacon.get_want_state() == CEPH_MDS_STATE_DNE) { dout(4) << __func__ << ": terminated already, dropping out" << dendl; @@ -519,27 +507,6 @@ int MDSDaemon::init() mds_lock.Unlock(); - // verify that osds support tmap2omap - while (true) { - objecter->maybe_request_map(); - objecter->wait_for_osd_map(); - if (objecter->with_osdmap([&](const OSDMap& o) { - uint64_t osd_features = o.get_up_osd_features(); - if (osd_features & CEPH_FEATURE_OSD_TMAP2OMAP) - return true; - if (o.get_num_up_osds() > 0) { - derr << "*** one or more OSDs do not support TMAP2OMAP; upgrade " - << "OSDs before starting MDS (or downgrade MDS) ***" << dendl; - } else { - derr << "*** no OSDs are up as of epoch " << o.get_epoch() - << ", waiting" << dendl; - } - return false; - })) - break; - sleep(10); - } - // Set up admin socket before taking mds_lock, so that ordering // is consistent (later we take mds_lock within asok callbacks) set_up_admin_socket(); @@ -1010,7 +977,7 @@ void MDSDaemon::handle_mds_map(MMDSMap *m) // Did I previously not hold a rank? Initialize! if (mds_rank == NULL) { mds_rank = new MDSRankDispatcher(whoami, mds_lock, clog, - timer, beacon, mdsmap, messenger, monc, objecter, + timer, beacon, mdsmap, messenger, monc, new C_VoidFn(this, &MDSDaemon::respawn), new C_VoidFn(this, &MDSDaemon::suicide)); dout(10) << __func__ << ": initializing MDS rank " @@ -1105,10 +1072,6 @@ void MDSDaemon::suicide() if (mds_rank) { mds_rank->shutdown(); } else { - - if (objecter->initialized.read()) { - objecter->shutdown(); - } timer.shutdown(); monc->shutdown(); diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index d193dac66c216..68c60137a306f 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -45,9 +45,6 @@ class filepath; class MonClient; -class Objecter; -class Filer; - class Server; class Locker; class MDCache; diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index e662f1b1a7b7e..8aa884615edde 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -49,14 +49,13 @@ MDSRank::MDSRank( MDSMap *& mdsmap_, Messenger *msgr, MonClient *monc_, - Objecter *objecter_, Context *respawn_hook_, Context *suicide_hook_) : whoami(whoami_), incarnation(0), mds_lock(mds_lock_), clog(clog_), timer(timer_), mdsmap(mdsmap_), - objecter(objecter_), + objecter(new Objecter(g_ceph_context, msgr, monc_, nullptr, 0, 0)), server(NULL), mdcache(NULL), locker(NULL), mdlog(NULL), balancer(NULL), scrubstack(NULL), damage_table(whoami_), @@ -78,6 +77,8 @@ MDSRank::MDSRank( { hb = g_ceph_context->get_heartbeat_map()->add_worker("MDSRank", pthread_self()); + objecter->unset_honor_osdmap_full(); + finisher = new Finisher(msgr->cct); mdcache = new MDCache(this); @@ -136,10 +137,18 @@ MDSRank::~MDSRank() delete respawn_hook; respawn_hook = NULL; + + delete objecter; + objecter = nullptr; } void MDSRankDispatcher::init() { + objecter->init(); + messenger->add_dispatcher_head(objecter); + + objecter->start(); + update_log_config(); create_logger(); @@ -2553,11 +2562,10 @@ MDSRankDispatcher::MDSRankDispatcher( MDSMap *& mdsmap_, Messenger *msgr, MonClient *monc_, - Objecter *objecter_, Context *respawn_hook_, Context *suicide_hook_) : MDSRank(whoami_, mds_lock_, clog_, timer_, beacon_, mdsmap_, - msgr, monc_, objecter_, respawn_hook_, suicide_hook_) + msgr, monc_, respawn_hook_, suicide_hook_) {} bool MDSRankDispatcher::handle_command( @@ -2626,3 +2634,9 @@ bool MDSRankDispatcher::handle_command( return false; } } + +epoch_t MDSRank::get_osd_epoch() const +{ + return objecter->with_osdmap(std::mem_fn(&OSDMap::get_epoch)); +} + diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index b8ad90dd46f31..2a2ea75b2af1d 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -278,7 +278,6 @@ class MDSRank { MDSMap *& mdsmap_, Messenger *msgr, MonClient *monc_, - Objecter *objecter_, Context *respawn_hook_, Context *suicide_hook_); ~MDSRank(); @@ -355,6 +354,7 @@ class MDSRank { void set_osd_epoch_barrier(epoch_t e); epoch_t get_osd_epoch_barrier() const {return osd_epoch_barrier;} + epoch_t get_osd_epoch() const; ceph_tid_t issue_tid() { return ++last_tid; } @@ -519,7 +519,6 @@ class MDSRankDispatcher : public MDSRank MDSMap *& mdsmap_, Messenger *msgr, MonClient *monc_, - Objecter *objecter_, Context *respawn_hook_, Context *suicide_hook_); }; From c49d87b87d20969f9bd6f7ab6d678cfe1ba79c3d Mon Sep 17 00:00:00 2001 From: John Spray Date: Fri, 1 Jul 2016 00:01:09 +0100 Subject: [PATCH 2/4] mds: return error on empty command message Previously this returned 0 and an empty response, which in turn upsets the python code that calls commands. Signed-off-by: John Spray --- src/mds/MDSDaemon.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 869daaef7a92b..fa4231db80d5f 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -603,6 +603,7 @@ void MDSDaemon::handle_command(MCommand *m) ss << "permission denied"; r = -EPERM; } else if (m->cmd.empty()) { + r = -EINVAL; ss << "no command given"; outs = ss.str(); } else if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) { From c76c31d312ce7a623acd99dbdedfe471c0cd445f Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 28 Jun 2016 14:25:04 +0100 Subject: [PATCH 3/4] tools: remove legacy `cephfs` tool This has been deprecated for quite some time, in favour of using proper vxattr and libcephfs interfaces. Fixes: http://tracker.ceph.com/issues/16035 Signed-off-by: John Spray --- ceph.spec.in | 2 - debian/ceph-fs-common.install | 2 - doc/Makefile.am | 1 - doc/man/8/CMakeLists.txt | 5 - doc/man/8/cephfs.rst | 99 ----------- src/CMakeLists.txt | 5 - src/Makefile-client.am | 4 - src/cephfs.cc | 309 ---------------------------------- 8 files changed, 427 deletions(-) delete mode 100644 doc/man/8/cephfs.rst delete mode 100644 src/cephfs.cc diff --git a/ceph.spec.in b/ceph.spec.in index d1d721f3aa924..0fc8175a73158 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -753,7 +753,6 @@ rm -rf %{buildroot} %{_bindir}/ceph-run %{_bindir}/ceph-detect-init %{_bindir}/ceph-client-debug -%{_bindir}/cephfs %{_unitdir}/ceph-create-keys@.service %{_libexecdir}/systemd/system-preset/50-ceph.preset %{_sbindir}/ceph-create-keys @@ -791,7 +790,6 @@ rm -rf %{buildroot} %{_mandir}/man8/crushtool.8* %{_mandir}/man8/osdmaptool.8* %{_mandir}/man8/monmaptool.8* -%{_mandir}/man8/cephfs.8* #set up placeholder directories %attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/tmp %attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/bootstrap-osd diff --git a/debian/ceph-fs-common.install b/debian/ceph-fs-common.install index 70f6e949ab1eb..ec61f9b0ff2bb 100644 --- a/debian/ceph-fs-common.install +++ b/debian/ceph-fs-common.install @@ -1,4 +1,2 @@ usr/sbin/mount.ceph sbin -usr/bin/cephfs -usr/share/man/man8/cephfs.8 usr/share/man/man8/mount.ceph.8 diff --git a/doc/Makefile.am b/doc/Makefile.am index c4bcfc7c6f10d..7720b49e69299 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -8,7 +8,6 @@ EXTRA_DIST = \ man/8/ceph-deploy.rst \ man/8/ceph-detect-init.rst \ man/8/ceph-disk.rst \ - man/8/cephfs.rst \ man/8/ceph-fuse.rst \ man/8/ceph-mds.rst \ man/8/ceph-mon.rst \ diff --git a/doc/man/8/CMakeLists.txt b/doc/man/8/CMakeLists.txt index 9074b5bc504df..4427fbb0f7036 100644 --- a/doc/man/8/CMakeLists.txt +++ b/doc/man/8/CMakeLists.txt @@ -35,11 +35,6 @@ list(APPEND man_srcs ceph-mds.rst librados-config.rst) -if(WITH_CEPHFS) - list(APPEND man_srcs - cephfs.rst) -endif() - if(HAVE_LIBFUSE) list(APPEND man_srcs ceph-fuse.rst diff --git a/doc/man/8/cephfs.rst b/doc/man/8/cephfs.rst deleted file mode 100644 index 0ad91d045df66..0000000000000 --- a/doc/man/8/cephfs.rst +++ /dev/null @@ -1,99 +0,0 @@ -:orphan: - -============================================ - cephfs -- ceph file system options utility -============================================ - -.. program:: cephfs - -Synopsis -======== - -| **cephfs** [ *path* *command* *options* ] - - -Description -=========== - -**cephfs** is a control utility for accessing and manipulating file -layout and location data in the Ceph distributed storage system. - -.. TODO format this like a proper man page - -Choose one of the following three commands: - -- ``show_layout`` View the layout information on a file or directory -- ``set_layout`` Set the layout information on a file or directory -- ``show_location`` View the location information on a file - - -Options -======= - -Your applicable options differ depending on whether you are setting or viewing layout/location. - -Viewing options: ----------------- - -.. option:: -l --offset - - Specify an offset for which to retrieve location data - -Setting options: ----------------- - -.. option:: -u --stripe_unit - - Set the size of each stripe - -.. option:: -c --stripe_count - - Set the number of objects to stripe across - -.. option:: -s --object_size - - Set the size of the objects to stripe across - -.. option:: -p --pool - - Set the pool (by numeric value, not name!) to use - -.. option:: -o --osd - - Set the preferred OSD to use as the primary (deprecated and ignored) - - -Limitations -=========== - -When setting layout data, the specified object size must evenly divide -by the specified stripe unit. Any parameters you don't set -explicitly are left at the system defaults. - -Obviously setting the layout of a file and a directory means different -things. Setting the layout of a file specifies exactly how to place -the individual file. This must be done before writing *any* data to -it. Truncating a file does not allow you to change the layout either. - -Setting the layout of a directory sets the "default layout", which is -used to set the file layouts on any files subsequently created in the -directory (or any subdirectory). Pre-existing files do not have their -layouts changed. - -You'll notice that the layout information allows you to specify a -preferred OSD for placement. This feature is unsupported and ignored -in modern versions of the Ceph servers; do not use it. - - -Availability -============ - -**cephfs** is part of Ceph, a massively scalable, open-source, distributed storage system. Please refer -to the Ceph documentation at http://ceph.com/docs for more -information. - - -See also -======== - -:doc:`ceph `\(8) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 660e65ec06ff2..8ac73c1cc52b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1022,11 +1022,6 @@ install(TARGETS crushtool DESTINATION bin) add_subdirectory(googletest/googlemock) add_subdirectory(test) -set(cephfs_srcs cephfs.cc) -add_executable(cephfstool ${cephfs_srcs}) -target_link_libraries(cephfstool common ${EXTRALIBS}) -set_target_properties(cephfstool PROPERTIES OUTPUT_NAME cephfs) -install(TARGETS cephfstool DESTINATION bin) add_subdirectory(compressor) add_subdirectory(tools) diff --git a/src/Makefile-client.am b/src/Makefile-client.am index 07d11b543935a..59496fc9f9193 100644 --- a/src/Makefile-client.am +++ b/src/Makefile-client.am @@ -74,10 +74,6 @@ endif # WITH_FUSE if WITH_CEPHFS -cephfs_SOURCES = cephfs.cc -cephfs_LDADD = $(LIBCOMMON) -bin_PROGRAMS += cephfs - mount_ceph_SOURCES = mount/mount.ceph.c mount_ceph_LDADD = $(LIBSECRET) $(LIBCOMMON) if LINUX diff --git a/src/cephfs.cc b/src/cephfs.cc deleted file mode 100644 index e7d0e647652b3..0000000000000 --- a/src/cephfs.cc +++ /dev/null @@ -1,309 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2010 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - * Simple little program to let you: - * 1) View the layout information on a file or directory, - * 2) Modify the layout information on an empty file, - * 3) Modify the default layout on a directory - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "client/ioctl.h" -#include "common/errno.h" - -using namespace std; - - -#define CMD_SHOW_LAYOUT 1 -#define CMD_SHOW_LOC 2 -#define CMD_SET_LAYOUT 3 -#define CMD_MAP 4 - -void usage(); -int init_options(int argc, char **argv, int *fd, char **path, int *cmd, - int *stripe_unit, int *stripe_count, - int *object_size, int64_t *pool, int *file_offset, bool *dir); - -int main (int argc, char **argv) { - int fd = 0; - int err = 0; - char *path = 0; - int cmd = 0; - int stripe_unit = 0; - int stripe_count = 0; - int object_size = 0; - int64_t pool = -1; - int file_offset = 0; - bool dir = false; - - if (init_options(argc, argv, &fd, &path, &cmd, &stripe_unit, &stripe_count, - &object_size, &pool, &file_offset, &dir)){ - usage(); - if (fd >= 0) { - close(fd); - } - return 0; - } - - cerr << "WARNING: This tool is deprecated. Use the layout.* xattrs " - "to query and modify layouts." << endl; - - if (CMD_SHOW_LAYOUT == cmd) { - struct ceph_ioctl_layout layout; - memset(&layout, 0, sizeof(layout)); - err = ioctl(fd, CEPH_IOC_GET_LAYOUT, (unsigned long)&layout); - if (err) { - cerr << "Error getting layout: " << cpp_strerror(errno) << endl; - goto close_fd_exit; - } - if (layout.stripe_unit == 0) { - cerr << "layout not specified" << endl; - } else { - cout << "layout.data_pool: " << layout.data_pool << endl; - cout << "layout.object_size: " << layout.object_size << endl; - cout << "layout.stripe_unit: " << layout.stripe_unit << endl; - cout << "layout.stripe_count: " << layout.stripe_count << endl; - } - } else if (CMD_SHOW_LOC == cmd) { - struct ceph_ioctl_dataloc location; - location.file_offset = file_offset; - err = ioctl(fd, CEPH_IOC_GET_DATALOC, (unsigned long)&location); - if (err) { - cerr << "Error getting location: " << cpp_strerror(err) << endl; - goto close_fd_exit; - } - cout << "location.file_offset: " << location.file_offset << endl; - cout << "location.object_offset:" << location.object_offset << endl; - cout << "location.object_no: " << location.object_no << endl; - cout << "location.object_size: " << location.object_size << endl; - cout << "location.object_name: " << location.object_name << endl; - cout << "location.block_offset: " << location.block_offset << endl; - cout << "location.block_size: " << location.block_size << endl; - cout << "location.osd: " << location.osd << endl; -// cout << "osd address: " << location.osd_addr << endl; - } else if (CMD_SET_LAYOUT == cmd) { - struct ceph_ioctl_layout layout; - memset(&layout, 0, sizeof(layout)); - int ioctl_num = (dir ? CEPH_IOC_SET_LAYOUT_POLICY : CEPH_IOC_SET_LAYOUT); - if (pool == -1) { - cerr << "Pool not specified (use --pool )" << endl; - goto close_fd_exit; - } - layout.data_pool = pool; - layout.object_size = object_size; - layout.stripe_count = stripe_count; - layout.stripe_unit = stripe_unit; - layout.unused = -1; /* used to be preferred_osd */ - err = ioctl(fd, ioctl_num, (unsigned long)&layout); - if (err) { - cerr << "Error setting layout: " << cpp_strerror(errno) << endl; - goto close_fd_exit; - } - } else if (CMD_MAP == cmd) { - struct stat st; - err = ::fstat(fd, &st); - if (err < 0) { - cerr << "error statting file: " << cpp_strerror(errno) << endl; - goto close_fd_exit; - } - - struct ceph_ioctl_layout layout; - memset(&layout, 0, sizeof(layout)); - err = ioctl(fd, CEPH_IOC_GET_LAYOUT, (unsigned long)&layout); - if (err) { - cerr << "Error getting layout: " << cpp_strerror(errno) << endl; - goto close_fd_exit; - } - - printf("%15s %24s %12s %12s %s\n", - "FILE OFFSET", "OBJECT", "OFFSET", "LENGTH", "OSD"); - - for (long long off = 0; off < st.st_size; off += layout.stripe_unit) { - struct ceph_ioctl_dataloc location; - location.file_offset = off; - err = ioctl(fd, CEPH_IOC_GET_DATALOC, (unsigned long)&location); - if (err) { - cerr << "Error getting location: " << cpp_strerror(errno) << endl; - goto close_fd_exit; - } - printf("%15lld %24s %12lld %12lld %d\n", - off, location.object_name, (long long)location.object_offset, - (long long)location.block_size, (int)location.osd); - } - - } else { - cerr << "unknown cmd somehow set!" << endl; - usage(); - goto close_fd_exit; - } - - return 0; - -close_fd_exit: - if (fd >= 0) { - close(fd); - } - return 1; -} - - -void usage() { - cerr << "usage: cephfs path command [options]*" << endl; - cerr << "Commands:" << endl; - cerr << " show_layout -- view the layout information on a file or dir" << endl; - cerr << " set_layout -- set the layout on an empty file,\n" - << " or the default layout on a directory" << endl; - cerr << " show_location -- view the location information on a file" << endl; - cerr << " map -- display file objects, pgs, osds" << endl; - cerr << "Options:" << endl; - cerr << " Useful for setting layouts:" << endl; - cerr << " --stripe_unit, -u: set the size of each stripe" << endl; - cerr << " --stripe_count, -c: set the number of objects to stripe across" << endl; - cerr << " --object_size, -s: set the size of the objects to stripe across" << endl; - cerr << " --pool, -p: set the pool to use" << endl; - cerr << endl; - cerr << " Useful for getting location data:" << endl; - cerr << " --offset, -l: the offset to retrieve location data for" << endl; - cerr << endl; -} - -int init_options(int argc, char **argv, int *fd, char **path, int *cmd, - int *stripe_unit, int *stripe_count, - int *object_size, int64_t *pool, int *file_offset, - bool *dir) { - // look through the options, make sure they're valid, - // and set the variables from them - int i = 3; - struct stat stat_field; - - if (argc < 3) { - cerr << "not enough parameters!" << endl; - return 1; - } - - *path = argv[1]; - - *fd = open(argv[1], O_RDONLY); - if (*fd < 0) { - *fd = -errno; - cerr << "error opening path: " << cpp_strerror(*fd) << endl; - return 1; - } - - if (!strcmp(argv[2], "show_layout")) { - *cmd = CMD_SHOW_LAYOUT; - if (argc > 4) - return 1; - } else if (!strcmp(argv[2], "set_layout")) { - *cmd = CMD_SET_LAYOUT; - } else if (!strcmp(argv[2], "show_location")){ - *cmd = CMD_SHOW_LOC; - } else if (!strcmp(argv[2], "map")) { - *cmd = CMD_MAP; - } else { - cerr << "invalid command" << endl; - return 1; - } - - // okay, fill in options - while (i < argc) { - if (i == argc-1) { - // there's an option without an associated value! - cerr << "not all options are paired with a value!" << endl; - return 1; - } - - if (!strcmp(argv[i], "--stripe_unit") || argv[i][1] == 'u') { - if (*cmd != CMD_SET_LAYOUT) { - cerr << "Invalid option for command!" << endl; - return 1; - } - *stripe_unit = strtol(argv[i+1], NULL, 0); - if (!*stripe_unit) { - cerr << "invalid value for stripe unit" << endl; - return 1; - } - } else if (!strcmp(argv[i], "--stripe_count") || argv[i][1] == 'c') { - if (*cmd != CMD_SET_LAYOUT) { - cerr << "Invalid option for command!" << endl; - return 1; - } - *stripe_count = strtol(argv[i+1], NULL, 0); - if (!*stripe_count) { - cerr << "invalid value for stripe count" << endl; - return 1; - } - } else if (!strcmp(argv[i], "--object_size") || argv[i][1] == 's') { - if (*cmd != CMD_SET_LAYOUT) { - cerr << "Invalid option for command!" << endl; - return 1; - } - *object_size = strtol(argv[i+1], NULL, 0); - if (!*object_size) { - cerr << "invalid value for object size" << endl; - return 1; - } - } else if (!strcmp(argv[i], "--pool") || argv[i][1] == 'p') { - if (*cmd != CMD_SET_LAYOUT) { - cerr << "Invalid option for command!" << endl; - return 1; - } - errno = 0; - *pool= strtol(argv[i+1], NULL, 0); - if (!*pool && errno) { - cerr << "invalid value for pool" << endl; - return 1; - } - } else if (!strcmp(argv[i], "--offset") || argv[i][1] == 'l') { - if (*cmd != CMD_SHOW_LOC) { - cerr << "Invalid option for command!" << endl; - return 1; - } - errno = 0; - *file_offset = strtol(argv[i+1], NULL, 0); - if (!*file_offset && errno) { - cerr << "invalid value for offset" << endl; - return 1; - } - } - i += 2; - } - - int r = fstat (*fd, &stat_field); - if (r < 0) { - int err = errno; - cerr << "error doing stat file: " << cpp_strerror(err) << endl; - return 1; - } - - if (S_ISREG(stat_field.st_mode)) { // open read-write to set layout - close(*fd); - *fd = open(argv[1], O_RDWR); - if (*fd < 0) { - cerr << "error opening file" << endl; - return 1; - } - } else { - *dir = true; - } - - return 0; -} From 1f1ef8116d0ee5be5820084d6a30c60c8197c23c Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 7 Jul 2016 16:08:14 +0100 Subject: [PATCH 4/4] mds: don't spam log with standby_replay_restart messages Fixes: http://tracker.ceph.com/issues/16195 Signed-off-by: John Spray --- src/mds/MDSRank.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 8aa884615edde..4e9484378f229 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1069,11 +1069,9 @@ void MDSRank::_standby_replay_restart_finish(int r, uint64_t old_read_pos) inline void MDSRank::standby_replay_restart() { - dout(1) << "standby_replay_restart" - << (standby_replaying ? " (as standby)":" (final takeover pass)") - << dendl; if (standby_replaying) { /* Go around for another pass of replaying in standby */ + dout(4) << "standby_replay_restart (as standby)" << dendl; mdlog->get_journaler()->reread_head_and_probe( new C_MDS_StandbyReplayRestartFinish( this, @@ -1081,6 +1079,7 @@ inline void MDSRank::standby_replay_restart() } else { /* We are transitioning out of standby: wait for OSD map update before making final pass */ + dout(1) << "standby_replay_restart (final takeover pass)" << dendl; Context *fin = new C_OnFinisher(new C_IO_Wrapper(this, new C_MDS_BootStart(this, MDS_BOOT_PREPARE_LOG)), finisher);