summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-12-10 17:08:26 -0800
committerSage Weil <sage@inktank.com>2012-12-10 17:08:26 -0800
commit331c25046ecd99ec10c5835e8e674ca819e6168a (patch)
tree5ae7898d7058770aa587822cb6343152dbf97bc3
parent2e7cba7bca7f09d9f8dbde74eec24f25b44a85f7 (diff)
parente4d0aeace187afee6313d803511ba595e91dd7ed (diff)
downloadceph-331c25046ecd99ec10c5835e8e674ca819e6168a.tar.gz
Merge remote-tracking branch 'gh/next'
-rw-r--r--ceph.spec.in91
-rw-r--r--configure.ac11
-rw-r--r--debian/ceph-test.install57
-rw-r--r--debian/ceph.postinst48
-rw-r--r--debian/control12
-rwxr-xr-xdebian/rules2
-rw-r--r--src/Makefile.am93
-rw-r--r--src/auth/AuthMethodList.cc7
-rw-r--r--src/auth/Crypto.cc8
-rw-r--r--src/client/Client.cc21
-rw-r--r--src/client/Client.h4
-rw-r--r--src/common/config_opts.h10
-rw-r--r--src/crush/CrushWrapper.h8
-rw-r--r--src/include/cephfs/libcephfs.h20
-rw-r--r--src/include/encoding.h2
-rw-r--r--src/init-ceph.in2
-rw-r--r--src/libcephfs.cc14
-rw-r--r--src/mds/Locker.cc7
-rw-r--r--src/mds/MDS.cc12
-rw-r--r--src/messages/MGetPoolStatsReply.h2
-rw-r--r--src/mon/AuthMonitor.cc1
-rw-r--r--src/mon/Elector.cc1
-rw-r--r--src/mon/MonClient.cc26
-rw-r--r--src/mon/Monitor.cc8
-rw-r--r--src/mon/OSDMonitor.cc8
-rw-r--r--src/mon/OSDMonitor.h11
-rw-r--r--src/os/FileStore.cc6
-rw-r--r--src/os/JournalingObjectStore.cc53
-rw-r--r--src/os/JournalingObjectStore.h13
-rw-r--r--src/osd/OSD.cc12
-rw-r--r--src/osd/osd_types.cc11
-rw-r--r--src/osd/osd_types.h4
-rw-r--r--src/test/common/ObjectContents.h2
-rw-r--r--src/test/encoding/types.h2
-rw-r--r--src/test/libcephfs/caps.cc139
35 files changed, 582 insertions, 146 deletions
diff --git a/ceph.spec.in b/ceph.spec.in
index 940ac5c6705..3a369cf5359 100644
--- a/ceph.spec.in
+++ b/ceph.spec.in
@@ -166,6 +166,26 @@ Requires: libcephfs1 = %{version}-%{release}
This package contains Python libraries for interacting with Cephs RADOS
object storage.
+%package -n rest-bench
+Summary: RESTful benchmark
+Group: System Environment/Libraries
+License: LGPL-2.0
+Requires: librados2 = %{version}-%{release}
+Requires: librbd1 = %{version}-%{release}
+Requires: libcephfs1 = %{version}-%{release}
+%description -n rest-bench
+RESTful bencher that can be used to benchmark radosgw performance.
+
+%package -n ceph-test
+Summary: Ceph benchmarks and test tools
+Group: System Environment/Libraries
+License: LGPL-2.0
+Requires: librados2 = %{version}-%{release}
+Requires: librbd1 = %{version}-%{release}
+Requires: libcephfs1 = %{version}-%{release}
+%description -n ceph-test
+This package contains Ceph benchmarks and test tools.
+
# Enable building of debug package on distributions that don't automatically
# build it.
@@ -197,6 +217,8 @@ export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e 's/i386/i486/'`
--without-hadoop \
--with-nss \
--without-cryptopp \
+ --with-rest-bench \
+ --with-debug \
$MY_CONF_OPT \
%{?_with_ocf} \
%{?with_tcmalloc:--with-tcmalloc} %{!?with_tcmalloc:--without-tcmalloc} \
@@ -428,4 +450,73 @@ fi
%{python_sitelib}/rados.py*
%{python_sitelib}/rbd.py*
+#################################################################################
+%files -n rest-bench
+%defattr(-,root,root,-)
+%{_bindir}/rest-bench
+
+#################################################################################
+%files -n ceph-test
+%defattr(-,root,root,-)
+%{_bindir}/bench_log
+%{_bindir}/dupstore
+%{_bindir}/kvstorebench
+%{_bindir}/multi_stress_watch
+%{_bindir}/omapbench
+%{_bindir}/psim
+%{_bindir}/radosacl
+%{_bindir}/rest-bench
+%{_bindir}/rgw_jsonparser
+%{_bindir}/rgw_multiparser
+%{_bindir}/scratchtool
+%{_bindir}/scratchtoolpp
+%{_bindir}/smalliobench
+%{_bindir}/smalliobenchdumb
+%{_bindir}/smalliobenchfs
+%{_bindir}/streamtest
+%{_bindir}/test_cfuse_cache_invalidate
+%{_bindir}/test_cls_lock
+%{_bindir}/test_cls_rbd
+%{_bindir}/test_cls_refcount
+%{_bindir}/test_cls_rgw
+%{_bindir}/test_filejournal
+%{_bindir}/test_filestore
+%{_bindir}/test_filestore_idempotent
+%{_bindir}/test_filestore_idempotent_sequence
+%{_bindir}/test_filestore_workloadgen
+%{_bindir}/test_ioctls
+%{_bindir}/test_keyvaluedb_atomicity
+%{_bindir}/test_keyvaluedb_iterators
+%{_bindir}/test_libcephfs
+%{_bindir}/test_librbd
+%{_bindir}/test_librbd_fsx
+%{_bindir}/test_mon_workloadgen
+%{_bindir}/test_mutate
+%{_bindir}/test_object_map
+%{_bindir}/test_objectcacher_stress
+%{_bindir}/test_rados_api_aio
+%{_bindir}/test_rados_api_cls
+%{_bindir}/test_rados_api_io
+%{_bindir}/test_rados_api_list
+%{_bindir}/test_rados_api_misc
+%{_bindir}/test_rados_api_pool
+%{_bindir}/test_rados_api_snapshots
+%{_bindir}/test_rados_api_stat
+%{_bindir}/test_rados_api_watch_notify
+%{_bindir}/test_rewrite_latency
+%{_bindir}/test_stress_watch
+%{_bindir}/test_trans
+%{_bindir}/testcrypto
+%{_bindir}/testkeys
+%{_bindir}/testmsgr
+%{_bindir}/testrados
+%{_bindir}/testrados_delete_pools_parallel
+%{_bindir}/testrados_list_parallel
+%{_bindir}/testrados_open_pools_parallel
+%{_bindir}/testrados_watch_notify
+%{_bindir}/testsignal_handlers
+%{_bindir}/testtimers
+%{_bindir}/tpbench
+%{_bindir}/xattr_bench
+
%changelog
diff --git a/configure.ac b/configure.ac
index 0620f6cf3be..ebaec0f57ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,11 @@ AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
+# Compiler flags
+
+AC_SUBST(AM_CXXFLAGS)
+AM_CXXFLAGS="${AM_CXXFLAGS}"
+
# Checks for compiler warning types
# AC_CHECK_CC_FLAG(FLAG_TO_TEST, VARIABLE_TO_SET_IF_SUPPORTED)
@@ -133,14 +138,16 @@ if test "x$have_cryptopp" = "xyes"; then
AC_MSG_NOTICE([using cryptopp for cryptography])
AC_DEFINE([USE_CRYPTOPP], [1], [Define if using CryptoPP.])
AC_SUBST([CRYPTO_CFLAGS], [$CRYPTOPP_CFLAGS])
- AC_SUBST([CRYPTO_CXXFLAGS], [$CRYPTOPP_CXXFLAGS])
+ #AC_SUBST([CRYPTO_CXXFLAGS], [$CRYPTOPP_CXXFLAGS])
+ AM_CXXFLAGS="${AM_CXXFLAGS} ${CRYPTOPP_CXXFLAGS}"
AC_SUBST([CRYPTO_LIBS], [$CRYPTOPP_LIBS])
elif test "x$have_nss" = "xyes"; then
AC_MSG_NOTICE([using nss for cryptography])
AC_DEFINE([USE_NSS], [1], [Define if using NSS.])
AC_SUBST([CRYPTO_CFLAGS], [$NSS_CFLAGS])
# this needs CFLAGS too in practise to get the includes right. ugly.
- AC_SUBST([CRYPTO_CXXFLAGS], [$NSS_CFLAGS $NSS_CXXFLAGS])
+ #AC_SUBST([CRYPTO_CXXFLAGS], [$NSS_CFLAGS $NSS_CXXFLAGS])
+ AM_CXXFLAGS="${AM_CXXFLAGS} ${NSS_CFLAGS} ${NSS_CXXFLAGS}"
AC_SUBST([CRYPTO_LIBS], [$NSS_LIBS])
else
AC_MSG_FAILURE([no suitable crypto library found])
diff --git a/debian/ceph-test.install b/debian/ceph-test.install
new file mode 100644
index 00000000000..46c4ec882ed
--- /dev/null
+++ b/debian/ceph-test.install
@@ -0,0 +1,57 @@
+usr/bin/bench_log
+usr/bin/dupstore
+usr/bin/kvstorebench
+usr/bin/multi_stress_watch
+usr/bin/omapbench
+usr/bin/psim
+usr/bin/radosacl
+usr/bin/rest-bench
+usr/bin/rgw_multiparser
+usr/bin/scratchtool
+usr/bin/scratchtoolpp
+usr/bin/smalliobench
+usr/bin/smalliobenchdumb
+usr/bin/smalliobenchfs
+usr/bin/streamtest
+usr/bin/test_cfuse_cache_invalidate
+usr/bin/test_cls_lock
+usr/bin/test_cls_rbd
+usr/bin/test_cls_refcount
+usr/bin/test_cls_rgw
+usr/bin/test_filejournal
+usr/bin/test_filestore
+usr/bin/test_filestore_idempotent
+usr/bin/test_filestore_idempotent_sequence
+usr/bin/test_filestore_workloadgen
+usr/bin/test_ioctls
+usr/bin/test_keyvaluedb_atomicity
+usr/bin/test_keyvaluedb_iterators
+usr/bin/test_libcephfs
+usr/bin/test_librbd
+usr/bin/test_librbd_fsx
+usr/bin/test_mutate
+usr/bin/test_object_map
+usr/bin/test_rados_api_aio
+usr/bin/test_rados_api_cls
+usr/bin/test_rados_api_io
+usr/bin/test_rados_api_list
+usr/bin/test_rados_api_misc
+usr/bin/test_rados_api_pool
+usr/bin/test_rados_api_snapshots
+usr/bin/test_rados_api_stat
+usr/bin/test_rados_api_watch_notify
+usr/bin/test_rewrite_latency
+usr/bin/test_stress_watch
+usr/bin/test_trans
+usr/bin/testcrypto
+usr/bin/testkeys
+usr/bin/testmsgr
+usr/bin/testrados
+usr/bin/testrados_delete_pools_parallel
+usr/bin/testrados_list_parallel
+usr/bin/testrados_open_pools_parallel
+usr/bin/testrados_watch_notify
+usr/bin/testsignal_handlers
+usr/bin/testtimers
+usr/bin/tpbench
+usr/bin/xattr_bench
diff --git a/debian/ceph.postinst b/debian/ceph.postinst
new file mode 100644
index 00000000000..1f9469d8f6c
--- /dev/null
+++ b/debian/ceph.postinst
@@ -0,0 +1,48 @@
+#!/bin/sh
+# postinst script for ceph
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#
+# postinst configure <most-recently-configured-version>
+# old-postinst abort-upgrade <new-version>
+# conflictor's-postinst abort-remove in-favour <package> <new-version>
+# postinst abort-remove
+# deconfigured's-postinst abort-deconfigure in-favour <failed-install-package> <version> [<removing conflicting-package> <version>]
+#
+# The current action is to simply remove the mistakenly-added
+# /etc/init/ceph.conf file; this could be done in any of these cases,
+# although technically it will leave the system in a different state
+# than the original install that included that file. So instead we
+# only remove on "configure", since that's the only time we know we're
+# successful in installing a newer package than the erroneous version.
+
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ rm -f /etc/init/ceph.conf
+ ;;
+ abort-upgrade|abort-remove|abort-deconfigure)
+ :
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/control b/debian/control
index 45030953a98..2f0c311225f 100644
--- a/debian/control
+++ b/debian/control
@@ -308,6 +308,18 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ceph-common, xml2, curl
Description: RESTful bencher that can be used to benchmark
radosgw performance.
+Package: ceph-test
+Architecture: linux-any
+Depends: ${shlibs:Depends}, ${misc:Depends}, ceph-common, xml2, curl
+Description: Ceph test and benchmarking tools.
+
+Package: ceph-test-dbg
+Architecture: linux-any
+Section: debug
+Priority: extra
+Depends: ${shlibs:Depends}, ${misc:Depends}, ceph-common, xml2, curl
+Description: Ceph test and benchmarking tools.
+
Package: python-ceph
Architecture: linux-any
Section: python
diff --git a/debian/rules b/debian/rules
index 6d6138559e9..32380a41850 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,6 +21,7 @@ endif
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
extraopts += --with-ocf --with-rest-bench --with-nss
+extraopts += --with-debug
extraopts += --enable-cephfs-java
ifeq ($(DEB_HOST_ARCH), armel)
@@ -126,6 +127,7 @@ binary-arch: build install
dh_strip -plibcephfs1 --dbg-package=libcephfs1-dbg
dh_strip -pradosgw --dbg-package=radosgw-dbg
dh_strip -prest-bench --dbg-package=rest-bench-dbg
+ dh_strip -pceph-test --dbg-package=ceph-test-dbg
dh_compress
dh_fixperms
diff --git a/src/Makefile.am b/src/Makefile.am
index aa4f00bfb48..6408af0adf0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -71,8 +71,6 @@ SUBDIRS += leveldb
LEVELDB_INCLUDE = -I$(top_srcdir)/src/leveldb/include
endif
-
-
# monitor
ceph_mon_SOURCES = ceph_mon.cc
ceph_mon_LDFLAGS = $(AM_LDFLAGS)
@@ -84,7 +82,7 @@ bin_PROGRAMS += ceph-mon
ceph_osd_SOURCES = ceph_osd.cc objclass/class_debug.cc \
objclass/class_api.cc
ceph_osd_LDADD = libosd.a $(LIBOS_LDA) $(LIBGLOBAL_LDA)
-ceph_osd_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} $(LEVELDB_INCLUDE)
+ceph_osd_CXXFLAGS = ${AM_CXXFLAGS} $(LEVELDB_INCLUDE)
bin_PROGRAMS += ceph-osd
if LINUX
@@ -123,7 +121,7 @@ rgw_dencoder_src = rgw/rgw_dencoder.cc \
rgw/rgw_acl.cc
ceph_dencoder_SOURCES = test/encoding/ceph_dencoder.cc ${rgw_dencoder_src}
-ceph_dencoder_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+ceph_dencoder_CXXFLAGS = ${AM_CXXFLAGS}
ceph_dencoder_LDADD = $(LIBGLOBAL_LDA) libcls_lock_client.a libcls_rgw_client.a libosd.a libmds.a $(LIBOS_LDA) libmon.a
bin_PROGRAMS += ceph-dencoder
@@ -295,7 +293,7 @@ noinst_LIBRARIES =
libcephfs_la_SOURCES = \
libcephfs.cc
libcephfs_la_CFLAGS= ${CRYPTO_CFLAGS} ${AM_CFLAGS}
-libcephfs_la_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+libcephfs_la_CXXFLAGS= ${AM_CXXFLAGS}
libcephfs_la_LIBADD = libclient.la
libcephfs_la_LDFLAGS = $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) \
${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '^ceph_.*'
@@ -318,7 +316,7 @@ librados_SOURCES = \
osdc/Striper.cc
librados_la_SOURCES = ${librados_SOURCES}
librados_la_CFLAGS = ${CRYPTO_CFLAGS} ${AM_CFLAGS}
-librados_la_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+librados_la_CXXFLAGS = ${AM_CXXFLAGS}
librados_la_LIBADD = libcommon.la $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS)
librados_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0 -export-symbols-regex '^rados_.*'
lib_LTLIBRARIES += librados.la
@@ -350,7 +348,7 @@ librgw_a_SOURCES = \
rgw/rgw_multi_del.cc \
rgw/rgw_env.cc
librgw_a_CFLAGS = ${CRYPTO_CFLAGS} ${AM_CFLAGS}
-librgw_a_CXXFLAGS = -Woverloaded-virtual ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+librgw_a_CXXFLAGS = -Woverloaded-virtual ${AM_CXXFLAGS}
noinst_LIBRARIES += librgw.a
my_radosgw_ldadd = \
@@ -369,16 +367,16 @@ radosgw_SOURCES = \
rgw/rgw_swift_auth.cc \
rgw/rgw_main.cc
radosgw_LDADD = $(my_radosgw_ldadd) -lfcgi -lresolv
-radosgw_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+radosgw_CXXFLAGS = ${AM_CXXFLAGS}
bin_PROGRAMS += radosgw
radosgw_admin_SOURCES = rgw/rgw_admin.cc
-radosgw_admin_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+radosgw_admin_CXXFLAGS = ${AM_CXXFLAGS}
radosgw_admin_LDADD = $(my_radosgw_ldadd)
bin_PROGRAMS += radosgw-admin
rgw_multiparser_SOURCES = rgw/rgw_multiparser.cc
-rgw_multiparser_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+rgw_multiparser_CXXFLAGS = ${AM_CXXFLAGS}
rgw_multiparser_LDADD = $(my_radosgw_ldadd)
bin_DEBUGPROGRAMS += rgw_multiparser
@@ -405,7 +403,7 @@ librbd_la_SOURCES = \
cls/lock/cls_lock_types.cc \
cls/lock/cls_lock_ops.cc
librbd_la_CFLAGS = ${AM_CFLAGS} ${CRYPTO_CFLAGS}
-librbd_la_CXXFLAGS = ${AM_CXXFLAGS} ${CRYPTO_CXXFLAGS}
+librbd_la_CXXFLAGS = ${AM_CXXFLAGS}
librbd_la_LIBADD = librados.la
librbd_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 \
-export-symbols-regex '^rbd_.*' $(PTHREAD_LIBS) $(EXTRALIBS)
@@ -450,7 +448,7 @@ endif
testcrypto_SOURCES = testcrypto.cc
testcrypto_LDADD = $(LIBGLOBAL_LDA)
-testcrypto_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+testcrypto_CXXFLAGS = ${AM_CXXFLAGS}
bin_DEBUGPROGRAMS += testcrypto
testkeys_SOURCES = testkeys.cc
@@ -706,7 +704,7 @@ check_PROGRAMS += unittest_bufferlist
unittest_crypto_SOURCES = test/crypto.cc
unittest_crypto_LDFLAGS = ${CRYPTO_LDFLAGS} ${AM_LDFLAGS}
unittest_crypto_LDADD = ${LIBGLOBAL_LDA} ${UNITTEST_LDADD}
-unittest_crypto_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
+unittest_crypto_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
check_PROGRAMS += unittest_crypto
unittest_perf_counters_SOURCES = test/perf_counters.cc
@@ -724,7 +722,7 @@ check_PROGRAMS += unittest_admin_socket
unittest_ceph_crypto_SOURCES = test/ceph_crypto.cc
unittest_ceph_crypto_LDFLAGS = ${CRYPTO_LDFLAGS} ${AM_LDFLAGS}
unittest_ceph_crypto_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA)
-unittest_ceph_crypto_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
+unittest_ceph_crypto_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
check_PROGRAMS += unittest_ceph_crypto
unittest_utf8_SOURCES = test/utf8.cc
@@ -922,7 +920,7 @@ test_rados_api_misc_LDADD = librados.la ${UNITTEST_STATIC_LDADD}
test_rados_api_misc_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
bin_DEBUGPROGRAMS += test_rados_api_misc
-test_libcephfs_SOURCES = test/libcephfs/test.cc test/libcephfs/readdir_r_cb.cc
+test_libcephfs_SOURCES = test/libcephfs/test.cc test/libcephfs/readdir_r_cb.cc test/libcephfs/caps.cc
test_libcephfs_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS}
test_libcephfs_LDADD = ${UNITTEST_STATIC_LDADD} libcephfs.la
test_libcephfs_CXXFLAGS = $(AM_CXXFLAGS) ${UNITTEST_CXXFLAGS}
@@ -944,7 +942,7 @@ bin_DEBUGPROGRAMS += test_filestore_workloadgen
test_filestore_idempotent_SOURCES = test/filestore/test_idempotent.cc test/filestore/FileStoreTracker.cc test/common/ObjectContents.cc
test_filestore_idempotent_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA)
-test_filestore_idempotent_CXXFLAGS = ${CRYPTO_CXXFLAGS} $(LEVELDB_INCLUDE)
+test_filestore_idempotent_CXXFLAGS = $(AM_CXXFLAGS) $(LEVELDB_INCLUDE)
bin_DEBUGPROGRAMS += test_filestore_idempotent
test_filestore_idempotent_sequence_SOURCES = \
@@ -1043,7 +1041,9 @@ ${WARN_TYPE_LIMITS} ${WARN_IGNORED_QUALIFIERS} -Winit-self -Wpointer-arith \
-fno-strict-aliasing
AM_CFLAGS = $(AM_COMMON_FLAGS)
-AM_CXXFLAGS = $(AM_COMMON_FLAGS) \
+AM_CXXFLAGS = \
+ @AM_CXXFLAGS@ \
+ $(AM_COMMON_FLAGS) \
-DCEPH_LIBDIR=\"${libdir}\" \
-Wnon-virtual-dtor \
-Wno-invalid-offsetof \
@@ -1165,7 +1165,7 @@ clean-local:
libcommon_la_SOURCES = $(libcommon_files)
libcommon_la_CFLAGS= ${CRYPTO_CFLAGS} ${AM_CFLAGS}
-libcommon_la_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+libcommon_la_CXXFLAGS= ${AM_CXXFLAGS}
libcommon_la_LDFLAGS = -lrt
noinst_LTLIBRARIES += libcommon.la
@@ -1175,7 +1175,7 @@ libglobal_la_SOURCES = \
global/pidfile.cc \
global/signal_handler.cc
libglobal_la_CFLAGS= ${CRYPTO_CFLAGS} ${AM_CFLAGS}
-libglobal_la_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+libglobal_la_CXXFLAGS= ${AM_CXXFLAGS}
libglobal_la_LIBADD= libcommon.la
noinst_LTLIBRARIES += libglobal.la
@@ -1312,7 +1312,7 @@ libmon_a_SOURCES = \
mon/AuthMonitor.cc \
mon/Elector.cc \
mon/MonitorStore.cc
-libmon_a_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+libmon_a_CXXFLAGS= ${AM_CXXFLAGS}
noinst_LIBRARIES += libmon.a
libmds_a_SOURCES = \
@@ -1357,7 +1357,7 @@ libos_a_SOURCES = \
os/FlatIndex.cc \
os/DBObjectMap.cc \
os/LevelDBStore.cc
-libos_a_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} $(LEVELDB_INCLUDE)
+libos_a_CXXFLAGS= ${AM_CXXFLAGS} $(LEVELDB_INCLUDE)
noinst_LIBRARIES += libos.a
libosd_a_SOURCES = \
@@ -1369,7 +1369,7 @@ libosd_a_SOURCES = \
osd/Watch.cc \
osd/ClassHandler.cc \
osd/OpRequest.cc
-libosd_a_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+libosd_a_CXXFLAGS= ${AM_CXXFLAGS}
noinst_LIBRARIES += libosd.a
libosdc_la_SOURCES = \
@@ -1377,7 +1377,7 @@ libosdc_la_SOURCES = \
osdc/ObjectCacher.cc \
osdc/Filer.cc \
osdc/Striper.cc
-libosdc_la_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+libosdc_la_CXXFLAGS= ${AM_CXXFLAGS}
libosdc_la_LIBADD = libcommon.la
noinst_LTLIBRARIES += libosdc.la
@@ -1882,20 +1882,39 @@ noinst_HEADERS = \
test/osd/TestOpStat.h\
global/pidfile.h\
common/sync_filesystem.h \
- test/encoding/types.h \
- test/kv_store_bench.h \
- test/omap_bench.h \
- test/system/cross_process_sem.h \
- test/system/st_rados_create_pool.h \
- test/system/st_rados_list_objects.h \
- test/system/st_rados_delete_objs.h \
- test/system/st_rados_delete_pool.h \
- test/system/st_rados_notify.h \
- test/system/st_rados_watch.h \
- test/system/systest_runnable.h \
- test/system/systest_settings.h \
- test/librados/test.h \
- test/unit.h \
+ test/bench/distribution.h \
+ test/bench/rados_backend.h \
+ test/bench/bencher.h \
+ test/bench/backend.h \
+ test/bench/dumb_backend.h \
+ test/bench/stat_collector.h \
+ test/bench/detailed_stat_collector.h \
+ test/bench/filestore_backend.h \
+ test/common/ObjectContents.h \
+ test/encoding/types.h \
+ test/filestore/DeterministicOpSequence.h \
+ test/filestore/FileStoreTracker.h \
+ test/filestore/FileStoreDiff.h \
+ test/filestore/TestFileStoreState.h \
+ test/filestore/workload_generator.h \
+ test/kv_store_bench.h \
+ test/librados/test.h \
+ test/ObjectMap/KeyValueDBMemory.h \
+ test/omap_bench.h \
+ test/osd/Object.h \
+ test/osd/RadosModel.h \
+ test/osd/TestOpStat.h \
+ test/osdc/FakeWriteback.h \
+ test/system/cross_process_sem.h \
+ test/system/st_rados_create_pool.h \
+ test/system/st_rados_list_objects.h \
+ test/system/st_rados_delete_objs.h \
+ test/system/st_rados_delete_pool.h \
+ test/system/st_rados_notify.h \
+ test/system/st_rados_watch.h \
+ test/system/systest_runnable.h \
+ test/system/systest_settings.h \
+ test/unit.h \
os/ObjectMap.h \
os/DBObjectMap.h \
os/KeyValueDB.h \
diff --git a/src/auth/AuthMethodList.cc b/src/auth/AuthMethodList.cc
index e23ac40fa90..dc181f92041 100644
--- a/src/auth/AuthMethodList.cc
+++ b/src/auth/AuthMethodList.cc
@@ -26,7 +26,11 @@ AuthMethodList::AuthMethodList(CephContext *cct, string str)
{
list<string> sup_list;
get_str_list(str, sup_list);
+ if (sup_list.empty()) {
+ lderr(cct) << "WARNING: empty auth protocol list" << dendl;
+ }
for (list<string>::iterator iter = sup_list.begin(); iter != sup_list.end(); ++iter) {
+ ldout(cct, 5) << "adding auth protocol: " << *iter << dendl;
if (iter->compare("cephx") == 0) {
auth_supported.push_back(CEPH_AUTH_CEPHX);
} else if (iter->compare("none") == 0) {
@@ -35,6 +39,9 @@ AuthMethodList::AuthMethodList(CephContext *cct, string str)
lderr(cct) << "WARNING: unknown auth protocol defined: " << *iter << dendl;
}
}
+ if (auth_supported.empty()) {
+ auth_supported.push_back(CEPH_AUTH_CEPHX);
+ }
}
bool AuthMethodList::is_supported_auth(int auth_type)
diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc
index 1bfc2814f4f..821995a2910 100644
--- a/src/auth/Crypto.cc
+++ b/src/auth/Crypto.cc
@@ -320,8 +320,10 @@ int CryptoKey::set_secret(CephContext *cct, int type, bufferptr& s)
created = ceph_clock_now(cct);
CryptoHandler *h = cct->get_crypto_handler(type);
- if (!h)
+ if (!h) {
+ lderr(cct) << "ERROR: cct->get_crypto_handler(type=" << type << ") returned NULL" << dendl;
return -EOPNOTSUPP;
+ }
int ret = h->validate_secret(s);
if (ret < 0)
@@ -338,8 +340,10 @@ int CryptoKey::create(CephContext *cct, int t)
created = ceph_clock_now(cct);
CryptoHandler *h = cct->get_crypto_handler(type);
- if (!h)
+ if (!h) {
+ lderr(cct) << "ERROR: cct->get_crypto_handler(type=" << type << ") returned NULL" << dendl;
return -EOPNOTSUPP;
+ }
return h->create(secret);
}
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 55e826bf763..0ca174b4536 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -6083,7 +6083,27 @@ int Client::rmsnap(const char *relpath, const char *name)
return _rmdir(snapdir, name);
}
+// =============================
+// expose caps
+
+int Client::get_caps_issued(int fd) {
+
+ Mutex::Locker lock(client_lock);
+ Fh *f = get_filehandle(fd);
+ return f->inode->caps_issued();
+}
+
+int Client::get_caps_issued(const char *path) {
+
+ Mutex::Locker lock(client_lock);
+ filepath p(path);
+ Inode *in;
+ int r = path_walk(p, &in, true);
+ if (r < 0)
+ return r;
+ return in->caps_issued();
+}
// =========================================
// low level
@@ -7394,3 +7414,4 @@ void Client::clear_filer_flags(int flags)
assert(flags == CEPH_OSD_FLAG_LOCALIZE_READS);
objecter->clear_global_op_flag(flags);
}
+
diff --git a/src/client/Client.h b/src/client/Client.h
index ae75d2df9fe..9512a2d8861 100644
--- a/src/client/Client.h
+++ b/src/client/Client.h
@@ -670,6 +670,10 @@ public:
int mksnap(const char *path, const char *name);
int rmsnap(const char *path, const char *name);
+ // expose caps
+ int get_caps_issued(int fd);
+ int get_caps_issued(const char *path);
+
// low-level interface
int ll_lookup(vinodeno_t parent, const char *name, struct stat *attr, int uid = -1, int gid = -1);
bool ll_forget(vinodeno_t vino, int count);
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index ec201eee022..d312ef28e0c 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -154,7 +154,7 @@ OPTION(paxos_min_wait, OPT_DOUBLE, 0.05) // min time to gather updates for afte
OPTION(clock_offset, OPT_DOUBLE, 0) // how much to offset the system clock in Clock.cc
OPTION(auth_cluster_required, OPT_STR, "cephx") // required of mon, mds, osd daemons
OPTION(auth_service_required, OPT_STR, "cephx") // required by daemons of clients
-OPTION(auth_client_required, OPT_STR, "") // what clients require of daemons
+OPTION(auth_client_required, OPT_STR, "cephx, none") // what clients require of daemons
OPTION(auth_supported, OPT_STR, "") // deprecated; default value for above if they are not defined.
OPTION(cephx_require_signatures, OPT_BOOL, false) // If true, don't talk to Cephx partners if they don't support message signing; off by default
OPTION(cephx_sign_messages, OPT_BOOL, true) // Default to signing session messages if supported
@@ -280,7 +280,7 @@ OPTION(osd_auto_upgrade_tmap, OPT_BOOL, true)
OPTION(osd_tmapput_sets_uses_tmap, OPT_BOOL, false)
// Maximum number of backfills to or from a single osd
-OPTION(osd_max_backfills, OPT_U64, 5)
+OPTION(osd_max_backfills, OPT_U64, 10)
// Refuse backfills when OSD full ratio is above this value
OPTION(osd_backfill_full_ratio, OPT_FLOAT, 0.85)
@@ -335,8 +335,8 @@ OPTION(osd_default_data_pool_replay_window, OPT_INT, 45)
OPTION(osd_preserve_trimmed_log, OPT_BOOL, false)
OPTION(osd_auto_mark_unfound_lost, OPT_BOOL, false)
OPTION(osd_recovery_delay_start, OPT_FLOAT, 15)
-OPTION(osd_recovery_max_active, OPT_INT, 5)
-OPTION(osd_recovery_max_chunk, OPT_U64, 1<<20) // max size of push chunk
+OPTION(osd_recovery_max_active, OPT_INT, 20)
+OPTION(osd_recovery_max_chunk, OPT_U64, 8<<20) // max size of push chunk
OPTION(osd_recovery_forget_lost_objects, OPT_BOOL, false) // off for now
OPTION(osd_max_scrubs, OPT_INT, 1)
OPTION(osd_scrub_load_threshold, OPT_FLOAT, 0.5)
@@ -374,7 +374,7 @@ OPTION(osd_target_transaction_size, OPT_INT, 300) // to adjust various trans
* 1..63.
*/
OPTION(osd_client_op_priority, OPT_INT, 63)
-OPTION(osd_recovery_op_priority, OPT_INT, 30)
+OPTION(osd_recovery_op_priority, OPT_INT, 10)
OPTION(filestore, OPT_BOOL, false)
OPTION(filestore_debug_omap_check, OPT_BOOL, 0) // Expensive debugging check on sync
diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h
index 5f5da0ca02c..f77991cc314 100644
--- a/src/crush/CrushWrapper.h
+++ b/src/crush/CrushWrapper.h
@@ -556,8 +556,12 @@ private:
// get the parent bucket
crush_bucket *parent_bucket = get_bucket(parent_id);
- // remove the bucket from the parent
- crush_bucket_remove_item(parent_bucket, item);
+ if (!IS_ERR(parent_bucket)) {
+ // remove the bucket from the parent
+ crush_bucket_remove_item(parent_bucket, item);
+ } else if (PTR_ERR(parent_bucket) != -ENOENT) {
+ return PTR_ERR(parent_bucket);
+ }
// check that we're happy
int test_weight = 0;
diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h
index 71bf25f6aed..9cf66049d4d 100644
--- a/src/include/cephfs/libcephfs.h
+++ b/src/include/cephfs/libcephfs.h
@@ -937,6 +937,26 @@ int ceph_get_local_osd(struct ceph_mount_info *cmount);
/** @} default_filelayout */
+/**
+ * Get the capabilities currently issued to the client.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param fd the file descriptor to get issued
+ * @returns the current capabilities issued to this client
+ * for the open file
+ */
+int ceph_debug_get_fd_caps(struct ceph_mount_info *cmount, int fd);
+
+/**
+ * Get the capabilities currently issued to the client.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param the path to the file
+ * @returns the current capabilities issued to this client
+ * for the file
+ */
+int ceph_debug_get_file_caps(struct ceph_mount_info *cmount, const char *path);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/include/encoding.h b/src/include/encoding.h
index db5d19658cf..eb445e3b070 100644
--- a/src/include/encoding.h
+++ b/src/include/encoding.h
@@ -159,7 +159,7 @@ WRITE_INTTYPE_ENCODER(int16_t, le16)
// string
-inline void encode(const std::string& s, bufferlist& bl)
+inline void encode(const std::string& s, bufferlist& bl, uint64_t features=0)
{
__u32 len = s.length();
encode(len, bl);
diff --git a/src/init-ceph.in b/src/init-ceph.in
index 1c9e0270d5d..788d7172979 100644
--- a/src/init-ceph.in
+++ b/src/init-ceph.in
@@ -300,7 +300,7 @@ for name in $what; do
[ -n "$fs_opt" ] && fs_opt="-o $fs_opt"
[ -n "$pre_mount" ] && do_cmd "$pre_mount"
- if [ "$fs_type" == "btrfs" ]; then
+ if [ "$fs_type" = "btrfs" ]; then
echo Mounting Btrfs on $host:$fs_path
do_root_cmd "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path' /proc/mounts || mount -t btrfs $fs_opt $first_dev $fs_path"
else
diff --git a/src/libcephfs.cc b/src/libcephfs.cc
index 02cf0864972..c33f6284afc 100644
--- a/src/libcephfs.cc
+++ b/src/libcephfs.cc
@@ -802,3 +802,17 @@ extern "C" CephContext *ceph_get_mount_context(struct ceph_mount_info *cmount)
{
return cmount->get_ceph_context();
}
+
+extern "C" int ceph_debug_get_fd_caps(struct ceph_mount_info *cmount, int fd)
+{
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ return cmount->get_client()->get_caps_issued(fd);
+}
+
+extern "C" int ceph_debug_get_file_caps(struct ceph_mount_info *cmount, const char *path)
+{
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ return cmount->get_client()->get_caps_issued(path);
+}
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index ee4799e18f8..a8ec19f765e 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -4027,13 +4027,16 @@ void Locker::file_eval(ScatterLock *lock, bool *need_issue)
dout(20) << " is excl" << dendl;
int loner_issued, other_issued, xlocker_issued;
in->get_caps_issued(&loner_issued, &other_issued, &xlocker_issued, CEPH_CAP_SFILE);
-
+ dout(7) << "file_eval loner_issued=" << gcap_string(loner_issued)
+ << " other_issued=" << gcap_string(other_issued)
+ << " xlocker_issued=" << gcap_string(xlocker_issued)
+ << dendl;
if (!((loner_wanted|loner_issued) & (CEPH_CAP_GEXCL|CEPH_CAP_GWR|CEPH_CAP_GBUFFER)) ||
(other_wanted & (CEPH_CAP_GEXCL|CEPH_CAP_GWR|CEPH_CAP_GRD)) ||
(in->inode.is_dir() && in->multiple_nonstale_caps())) { // FIXME.. :/
dout(20) << " should lose it" << dendl;
// we should lose it.
- if (((other_wanted|loner_wanted) & (CEPH_CAP_GRD|CEPH_CAP_GWR)) ||
+ if (((other_wanted|loner_wanted) & CEPH_CAP_GWR) ||
lock->is_waiter_for(SimpleLock::WAIT_WR))
scatter_mix(lock, need_issue);
else if (!lock->is_wrlocked()) // let excl wrlocks drain first
diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc
index 9b2417bdfde..d71405643f4 100644
--- a/src/mds/MDS.cc
+++ b/src/mds/MDS.cc
@@ -90,13 +90,13 @@ MDS::MDS(const std::string &n, Messenger *m, MonClient *mc) :
mds_lock("MDS::mds_lock"),
timer(m->cct, mds_lock),
authorize_handler_cluster_registry(new AuthAuthorizeHandlerRegistry(m->cct,
- m->cct->_conf->auth_cluster_required.length() ?
- m->cct->_conf->auth_cluster_required :
- m->cct->_conf->auth_supported)),
+ m->cct->_conf->auth_supported.length() ?
+ m->cct->_conf->auth_supported :
+ m->cct->_conf->auth_cluster_required)),
authorize_handler_service_registry(new AuthAuthorizeHandlerRegistry(m->cct,
- m->cct->_conf->auth_service_required.length() ?
- m->cct->_conf->auth_service_required :
- m->cct->_conf->auth_supported)),
+ m->cct->_conf->auth_supported.length() ?
+ m->cct->_conf->auth_supported :
+ m->cct->_conf->auth_service_required)),
name(n),
whoami(-1), incarnation(0),
standby_for_rank(MDSMap::MDS_NO_STANDBY_PREF),
diff --git a/src/messages/MGetPoolStatsReply.h b/src/messages/MGetPoolStatsReply.h
index 26f9e13ab70..719d5b80e0e 100644
--- a/src/messages/MGetPoolStatsReply.h
+++ b/src/messages/MGetPoolStatsReply.h
@@ -42,7 +42,7 @@ public:
void encode_payload(uint64_t features) {
paxos_encode();
::encode(fsid, payload);
- ::encode(pool_stats, payload);
+ ::encode(pool_stats, payload, features);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc
index aec2ba04d86..84585912be5 100644
--- a/src/mon/AuthMonitor.cc
+++ b/src/mon/AuthMonitor.cc
@@ -346,6 +346,7 @@ bool AuthMonitor::prep_auth(MAuth *m, bool paxos_writable)
type = mon->auth_service_required.pick(supported);
s->auth_handler = get_auth_service_handler(type, g_ceph_context, &mon->key_server);
if (!s->auth_handler) {
+ dout(1) << "client did not provide supported auth type" << dendl;
ret = -ENOTSUP;
goto reply;
}
diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc
index 85e145b1a52..e2ffa6bd571 100644
--- a/src/mon/Elector.cc
+++ b/src/mon/Elector.cc
@@ -69,6 +69,7 @@ void Elector::start()
dout(5) << "start -- can i be leader?" << dendl;
acked_me.clear();
+ init();
// start by trying to elect me
if (epoch % 2 == 0)
diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc
index b705b3def00..6ffe8e8d6da 100644
--- a/src/mon/MonClient.cc
+++ b/src/mon/MonClient.cc
@@ -269,13 +269,13 @@ int MonClient::init()
if (r == -ENOENT) {
// do we care?
string method;
- if (entity_name.get_type() == CEPH_ENTITY_TYPE_MDS ||
- entity_name.get_type() == CEPH_ENTITY_TYPE_OSD)
+ if (cct->_conf->auth_supported.length() != 0)
+ method = cct->_conf->auth_supported;
+ else if (entity_name.get_type() == CEPH_ENTITY_TYPE_MDS ||
+ entity_name.get_type() == CEPH_ENTITY_TYPE_OSD)
method = cct->_conf->auth_cluster_required;
else
method = cct->_conf->auth_client_required;
- if (method.length() == 0)
- method = cct->_conf->auth_supported;
AuthMethodList supported(cct, method);
if (!supported.is_supported_auth(CEPH_AUTH_CEPHX)) {
ldout(cct, 2) << "cephx auth is not supported, ignoring absence of keyring" << dendl;
@@ -294,14 +294,16 @@ int MonClient::init()
schedule_tick();
string method;
- if (entity_name.get_type() == CEPH_ENTITY_TYPE_OSD ||
- entity_name.get_type() == CEPH_ENTITY_TYPE_MDS ||
- entity_name.get_type() == CEPH_ENTITY_TYPE_MON)
- method = cct->_conf->auth_cluster_required;
- else
- method = cct->_conf->auth_client_required;
- auth_supported = new AuthMethodList(cct, method.length() ? method : cct->_conf->auth_supported);
- ldout(cct, 10) << "auth_supported " << auth_supported->get_supported_set() << dendl;
+ if (cct->_conf->auth_supported.length() != 0)
+ method = cct->_conf->auth_supported;
+ else if (entity_name.get_type() == CEPH_ENTITY_TYPE_OSD ||
+ entity_name.get_type() == CEPH_ENTITY_TYPE_MDS ||
+ entity_name.get_type() == CEPH_ENTITY_TYPE_MON)
+ method = cct->_conf->auth_cluster_required;
+ else
+ method = cct->_conf->auth_client_required;
+ auth_supported = new AuthMethodList(cct, method);
+ ldout(cct, 10) << "auth_supported " << auth_supported->get_supported_set() << " method " << method << dendl;
initialized = true;
return 0;
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index bb8ae1b3c12..c5d3b5ebca3 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -115,11 +115,11 @@ Monitor::Monitor(CephContext* cct_, string nm, MonitorStore *s, Messenger *m, Mo
clog(cct_, messenger, monmap, LogClient::FLAG_MON),
key_server(cct, &keyring),
auth_cluster_required(cct,
- cct->_conf->auth_cluster_required.length() ?
- cct->_conf->auth_cluster_required : cct->_conf->auth_supported),
+ cct->_conf->auth_supported.length() ?
+ cct->_conf->auth_supported : cct->_conf->auth_cluster_required),
auth_service_required(cct,
- cct->_conf->auth_service_required.length() ?
- cct->_conf->auth_service_required : cct->_conf->auth_supported),
+ cct->_conf->auth_supported.length() ?
+ cct->_conf->auth_supported : cct->_conf->auth_service_required),
store(s),
state(STATE_PROBING),
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index c845c2b600c..3186c4d6bc3 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -2979,7 +2979,6 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m)
return prepare_pool_op_auid(m);
}
- bufferlist *blp = NULL;
int ret = 0;
bool changed = false;
@@ -2990,6 +2989,8 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m)
else
pp = *osdmap.get_pg_pool(m->pool);
+ bufferlist reply_data;
+
// pool snaps vs unmanaged snaps are mutually exclusive
switch (m->op) {
case POOL_OP_CREATE_SNAP:
@@ -3029,10 +3030,9 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m)
case POOL_OP_CREATE_UNMANAGED_SNAP:
{
- blp = new bufferlist();
uint64_t snapid;
pp.add_unmanaged_snap(snapid);
- ::encode(snapid, *blp);
+ ::encode(snapid, reply_data);
changed = true;
}
break;
@@ -3055,7 +3055,7 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m)
}
out:
- paxos->wait_for_commit(new OSDMonitor::C_PoolOp(this, m, ret, pending_inc.epoch, blp));
+ paxos->wait_for_commit(new OSDMonitor::C_PoolOp(this, m, ret, pending_inc.epoch, &reply_data));
propose_pending();
return false;
}
diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h
index a82f5f0faf4..4faa90e2902 100644
--- a/src/mon/OSDMonitor.h
+++ b/src/mon/OSDMonitor.h
@@ -240,16 +240,19 @@ private:
MPoolOp *m;
int replyCode;
int epoch;
- bufferlist *reply_data;
- C_PoolOp(OSDMonitor * osd, MPoolOp *m_, int rc, int e, bufferlist *rd=NULL) :
- osdmon(osd), m(m_), replyCode(rc), epoch(e), reply_data(rd) {}
+ bufferlist reply_data;
+ C_PoolOp(OSDMonitor * osd, MPoolOp *m_, int rc, int e, bufferlist *rd=NULL) :
+ osdmon(osd), m(m_), replyCode(rc), epoch(e) {
+ if (rd)
+ reply_data = *rd;
+ }
void finish(int r) {
if (r == -ECANCELED) {
if (m)
m->put();
return;
}
- osdmon->_pool_op_reply(m, replyCode, epoch, reply_data);
+ osdmon->_pool_op_reply(m, replyCode, epoch, &reply_data);
}
};
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc
index 2c66a5ea7db..98ee811e586 100644
--- a/src/os/FileStore.cc
+++ b/src/os/FileStore.cc
@@ -3301,6 +3301,7 @@ void FileStore::sync_entry()
fin.swap(sync_waiters);
lock.Unlock();
+ op_tp.pause();
if (apply_manager.commit_start()) {
utime_t start = ceph_clock_now(g_ceph_context);
uint64_t cp = apply_manager.get_committing_seq();
@@ -3352,6 +3353,7 @@ void FileStore::sync_entry()
snaps.push_back(cp);
apply_manager.commit_started();
+ op_tp.unpause();
// wait for commit
dout(20) << " waiting for transid " << async_args.transid << " to complete" << dendl;
@@ -3383,10 +3385,12 @@ void FileStore::sync_entry()
snaps.push_back(cp);
apply_manager.commit_started();
+ op_tp.unpause();
}
} else
{
apply_manager.commit_started();
+ op_tp.unpause();
if (btrfs) {
dout(15) << "sync_entry doing btrfs SYNC" << dendl;
@@ -3446,6 +3450,8 @@ void FileStore::sync_entry()
sync_entry_timeo_lock.Lock();
timer.cancel_event(sync_entry_timeo);
sync_entry_timeo_lock.Unlock();
+ } else {
+ op_tp.unpause();
}
lock.Lock();
diff --git a/src/os/JournalingObjectStore.cc b/src/os/JournalingObjectStore.cc
index b1aee62eca8..b91b6dc207c 100644
--- a/src/os/JournalingObjectStore.cc
+++ b/src/os/JournalingObjectStore.cc
@@ -109,28 +109,8 @@ int JournalingObjectStore::journal_replay(uint64_t fs_op_seq)
uint64_t JournalingObjectStore::ApplyManager::op_apply_start(uint64_t op)
{
Mutex::Locker l(apply_lock);
- // if we ops are blocked, or there are already people (left) in
- // line, get in line.
- if (op > max_applying_seq &&
- (blocked || !ops_apply_blocked.empty())) {
- Cond cond;
- ops_apply_blocked.push_back(&cond);
- dout(10) << "op_apply_start " << op << " blocked (getting in back of line)" << dendl;
- // sleep until we are not blocked AND we are at the front of line
- while (blocked || ops_apply_blocked.front() != &cond)
- cond.Wait(apply_lock);
- dout(10) << "op_apply_start " << op << " woke (at front of line)" << dendl;
- ops_apply_blocked.pop_front();
- if (!ops_apply_blocked.empty()) {
- dout(10) << "op_apply_start " << op << " ...and kicking next in line" << dendl;
- ops_apply_blocked.front()->Signal();
- }
- }
- dout(10) << "op_apply_start " << op << " open_ops " << open_ops << " -> " << (open_ops+1)
- << ", max_applying_seq " << max_applying_seq << " -> " << MAX(op, max_applying_seq) << dendl;
-
- if (op > max_applying_seq)
- max_applying_seq = op;
+ dout(10) << "op_apply_start " << op << " open_ops " << open_ops << " -> " << (open_ops+1) << dendl;
+ assert(!blocked);
assert(op > committed_seq);
open_ops++;
return op;
@@ -141,11 +121,10 @@ void JournalingObjectStore::ApplyManager::op_apply_finish(uint64_t op)
Mutex::Locker l(apply_lock);
dout(10) << "op_apply_finish " << op << " open_ops " << open_ops
<< " -> " << (open_ops-1)
- << ", max_applying_seq " << max_applying_seq
<< ", max_applied_seq " << max_applied_seq << " -> " << MAX(op, max_applied_seq)
<< dendl;
- if (--open_ops == 0)
- open_ops_cond.Signal();
+ --open_ops;
+ assert(open_ops >= 0);
// there can be multiple applies in flight; track the max value we
// note. note that we can't _read_ this value and learn anything
@@ -159,20 +138,18 @@ uint64_t JournalingObjectStore::SubmitManager::op_submit_start()
lock.Lock();
uint64_t op = ++op_seq;
dout(10) << "op_submit_start " << op << dendl;
- ops_submitting.push_back(op);
return op;
}
void JournalingObjectStore::SubmitManager::op_submit_finish(uint64_t op)
{
dout(10) << "op_submit_finish " << op << dendl;
- if (op != ops_submitting.front()) {
- dout(0) << "op_submit_finish " << op << " expected "
- << ops_submitting.front()
+ if (op != op_submitted + 1) {
+ dout(0) << "op_submit_finish " << op << " expected " << (op_submitted + 1)
<< ", OUT OF ORDER" << dendl;
assert(0 == "out of order op_submit_finish");
}
- ops_submitting.pop_front();
+ op_submitted = op;
lock.Unlock();
}
@@ -192,30 +169,22 @@ bool JournalingObjectStore::ApplyManager::commit_start()
{
Mutex::Locker l(apply_lock);
- dout(10) << "commit_start max_applying_seq " << max_applying_seq
- << ", max_applied_seq " << max_applied_seq
+ dout(10) << "commit_start max_applied_seq " << max_applied_seq
+ << ", open_ops " << open_ops
<< dendl;
blocked = true;
- while (open_ops > 0) {
- dout(10) << "commit_start blocked, waiting for " << open_ops << " open ops, "
- << " max_applying_seq " << max_applying_seq << " max_applied_seq " << max_applied_seq << dendl;
- open_ops_cond.Wait(apply_lock);
- }
assert(open_ops == 0);
- assert(max_applied_seq == max_applying_seq);
dout(10) << "commit_start blocked, all open_ops have completed" << dendl;
{
Mutex::Locker l(com_lock);
if (max_applied_seq == committed_seq) {
dout(10) << "commit_start nothing to do" << dendl;
blocked = false;
- if (!ops_apply_blocked.empty())
- ops_apply_blocked.front()->Signal();
assert(commit_waiters.empty());
goto out;
}
- committing_seq = max_applying_seq;
+ committing_seq = max_applied_seq;
dout(10) << "commit_start committing " << committing_seq
<< ", still blocked" << dendl;
@@ -235,8 +204,6 @@ void JournalingObjectStore::ApplyManager::commit_started()
// allow new ops. (underlying fs should now be committing all prior ops)
dout(10) << "commit_started committing " << committing_seq << ", unblocking" << dendl;
blocked = false;
- if (!ops_apply_blocked.empty())
- ops_apply_blocked.front()->Signal();
}
void JournalingObjectStore::ApplyManager::commit_finish()
diff --git a/src/os/JournalingObjectStore.h b/src/os/JournalingObjectStore.h
index ae74c32cd25..338ac87ec21 100644
--- a/src/os/JournalingObjectStore.h
+++ b/src/os/JournalingObjectStore.h
@@ -28,17 +28,17 @@ protected:
class SubmitManager {
Mutex lock;
uint64_t op_seq;
- list<uint64_t> ops_submitting;
+ uint64_t op_submitted;
public:
SubmitManager() :
lock("JOS::SubmitManager::lock", false, true, false, g_ceph_context),
- op_seq(0)
+ op_seq(0), op_submitted(0)
{}
uint64_t op_submit_start();
void op_submit_finish(uint64_t op);
void set_op_seq(uint64_t seq) {
Mutex::Locker l(lock);
- op_seq = seq;
+ op_submitted = op_seq = seq;
}
uint64_t get_op_seq() {
return op_seq;
@@ -53,15 +53,11 @@ protected:
bool blocked;
Cond blocked_cond;
int open_ops;
- Cond open_ops_cond;
- uint64_t max_applying_seq;
uint64_t max_applied_seq;
Mutex com_lock;
map<version_t, vector<Context*> > commit_waiters;
uint64_t committing_seq, committed_seq;
- list<uint64_t> ops_submitting;
- list<Cond*> ops_apply_blocked;
public:
ApplyManager(Journal *&j, Finisher &f) :
@@ -69,7 +65,6 @@ protected:
apply_lock("JOS::ApplyManager::apply_lock", false, true, false, g_ceph_context),
blocked(false),
open_ops(0),
- max_applying_seq(0),
max_applied_seq(0),
com_lock("JOS::ApplyManager::com_lock", false, true, false, g_ceph_context),
committing_seq(0), committed_seq(0) {}
@@ -99,7 +94,7 @@ protected:
}
{
Mutex::Locker l(apply_lock);
- max_applying_seq = max_applied_seq = fs_op_seq;
+ max_applied_seq = fs_op_seq;
}
}
} apply_manager;
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 6018587cacc..e7a1022d7ab 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -696,13 +696,13 @@ OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger,
osd_lock("OSD::osd_lock"),
timer(external_messenger->cct, osd_lock),
authorize_handler_cluster_registry(new AuthAuthorizeHandlerRegistry(external_messenger->cct,
- cct->_conf->auth_cluster_required.length() ?
- cct->_conf->auth_cluster_required :
- cct->_conf->auth_supported)),
+ cct->_conf->auth_supported.length() ?
+ cct->_conf->auth_supported :
+ cct->_conf->auth_cluster_required)),
authorize_handler_service_registry(new AuthAuthorizeHandlerRegistry(external_messenger->cct,
- cct->_conf->auth_service_required.length() ?
- cct->_conf->auth_service_required :
- cct->_conf->auth_supported)),
+ cct->_conf->auth_supported.length() ?
+ cct->_conf->auth_supported :
+ cct->_conf->auth_service_required)),
cluster_messenger(internal_messenger),
client_messenger(external_messenger),
monc(mc),
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc
index 4a1b3fcf2ef..e8db13e50db 100644
--- a/src/osd/osd_types.cc
+++ b/src/osd/osd_types.cc
@@ -1152,8 +1152,17 @@ void pool_stat_t::dump(Formatter *f) const
f->dump_unsigned("ondisk_log_size", ondisk_log_size);
}
-void pool_stat_t::encode(bufferlist &bl) const
+void pool_stat_t::encode(bufferlist &bl, uint64_t features) const
{
+ if ((features & CEPH_FEATURE_OSDENC) == 0) {
+ __u8 v = 4;
+ ::encode(v, bl);
+ ::encode(stats, bl);
+ ::encode(log_size, bl);
+ ::encode(ondisk_log_size, bl);
+ return;
+ }
+
ENCODE_START(5, 5, bl);
::encode(stats, bl);
::encode(log_size, bl);
diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
index da2b2abf319..c1e5aa26585 100644
--- a/src/osd/osd_types.h
+++ b/src/osd/osd_types.h
@@ -941,11 +941,11 @@ struct pool_stat_t {
}
void dump(Formatter *f) const;
- void encode(bufferlist &bl) const;
+ void encode(bufferlist &bl, uint64_t features) const;
void decode(bufferlist::iterator &bl);
static void generate_test_instances(list<pool_stat_t*>& o);
};
-WRITE_CLASS_ENCODER(pool_stat_t)
+WRITE_CLASS_ENCODER_FEATURES(pool_stat_t)
/**
diff --git a/src/test/common/ObjectContents.h b/src/test/common/ObjectContents.h
index f7b97a6c538..8ca410bd335 100644
--- a/src/test/common/ObjectContents.h
+++ b/src/test/common/ObjectContents.h
@@ -43,7 +43,7 @@ public:
}
void seek_to(uint64_t _pos) {
if (pos > _pos ||
- iter != parent->seeds.end() && _pos >= iter->first) {
+ (iter != parent->seeds.end() && _pos >= iter->first)) {
iter = parent->seeds.upper_bound(_pos);
--iter;
current_state = iter->second;
diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h
index 2c717cb9337..e3b7e305140 100644
--- a/src/test/encoding/types.h
+++ b/src/test/encoding/types.h
@@ -41,7 +41,7 @@ TYPE_FEATUREFUL(pg_pool_t)
TYPE(object_stat_sum_t)
TYPE(object_stat_collection_t)
TYPE(pg_stat_t)
-TYPE(pool_stat_t)
+TYPE_FEATUREFUL(pool_stat_t)
TYPE(pg_history_t)
TYPE(pg_info_t)
TYPE(pg_interval_t)
diff --git a/src/test/libcephfs/caps.cc b/src/test/libcephfs/caps.cc
new file mode 100644
index 00000000000..5a421ea410c
--- /dev/null
+++ b/src/test/libcephfs/caps.cc
@@ -0,0 +1,139 @@
+// -*- 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) 2011 New Dream Network
+ *
+ * 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.
+ *
+ */
+
+#include "gtest/gtest.h"
+#include "include/cephfs/libcephfs.h"
+#include <linux/types.h>
+#include <inttypes.h>
+#include "include/ceph_fs.h"
+#include <errno.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <sys/xattr.h>
+#include <signal.h>
+
+void do_sigusr1(int s) {}
+
+// wait_and_suspend() forks the process, waits for the
+// child to signal SIGUSR1, suspends the child with SIGSTOP
+// sleeps for s seconds, and then unsuspends the child,
+// waits for the child to exit, and then returns the exit code
+// of the child
+static int _wait_and_suspend(int s) {
+
+ int fpid = fork();
+ if (fpid != 0) {
+ // wait for child to signal
+ signal(SIGUSR1, &do_sigusr1);
+ sigset_t set;
+ sigaddset(&set, SIGUSR1);
+ int sig;
+ sigwait(&set, &sig);
+
+ // fork and suspend child, sleep for 20 secs, and resume
+ kill(fpid, SIGSTOP);
+ sleep(s);
+ kill(fpid, SIGCONT);
+ int status;
+ wait(&status);
+ if (WIFEXITED(status))
+ return WEXITSTATUS(status);
+ return 1;
+ }
+ return -1;
+}
+
+// signal_for_suspend sends the parent the SIGUSR1 signal
+// and sleeps for 1 second so that it can be suspended at the
+// point of the call
+static void _signal_for_suspend() {
+ kill(getppid(), SIGUSR1);
+}
+
+TEST(Caps, ReadZero) {
+
+ int w = _wait_and_suspend(20);
+ if (w >= 0) {
+ ASSERT_EQ(0, w);
+ return;
+ }
+
+ pid_t mypid = getpid();
+ struct ceph_mount_info *cmount;
+ ASSERT_EQ(0, ceph_create(&cmount, NULL));
+ ASSERT_EQ(0, ceph_conf_read_file(cmount, NULL));
+ ASSERT_EQ(0, ceph_mount(cmount, "/"));
+
+ ASSERT_EQ(0, ceph_conf_set(cmount, "client_cache_size", "10"));
+
+ int i = 0;
+ for(; i < 30; ++i) {
+
+ char c_path[1024];
+ sprintf(c_path, "/caps_rzfile_%d_%d", mypid, i);
+ int fd = ceph_open(cmount, c_path, O_CREAT|O_TRUNC|O_WRONLY, 0644);
+ ASSERT_LT(0, fd);
+
+ int expect = CEPH_CAP_FILE_EXCL | CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER;
+ int caps = ceph_debug_get_fd_caps(cmount, fd);
+
+ ASSERT_EQ(expect, caps & expect);
+ ASSERT_EQ(0, ceph_close(cmount, fd));
+
+ caps = ceph_debug_get_file_caps(cmount, c_path);
+ ASSERT_EQ(expect, caps & expect);
+
+ char cw_path[1024];
+ sprintf(cw_path, "/caps_wzfile_%d_%d", mypid, i);
+ int wfd = ceph_open(cmount, cw_path, O_CREAT|O_TRUNC|O_WRONLY, 0644);
+ ASSERT_LT(0, wfd);
+
+ char wbuf[4096];
+ ASSERT_EQ(4096, ceph_write(cmount, wfd, wbuf, 4096, 0));
+
+ ASSERT_EQ(0, ceph_close(cmount, wfd));
+
+ struct stat st;
+ ASSERT_EQ(0, ceph_stat(cmount, c_path, &st));
+
+ caps = ceph_debug_get_file_caps(cmount, c_path);
+ ASSERT_EQ(expect, caps & expect);
+ }
+
+ _signal_for_suspend();
+
+ for(i = 0; i < 30; ++i) {
+
+ char c_path[1024];
+ sprintf(c_path, "/caps_rzfile_%d_%d", mypid, i);
+
+ int fd = ceph_open(cmount, c_path, O_RDONLY, 0);
+ ASSERT_LT(0, fd);
+ char buf[256];
+
+ int expect = CEPH_CAP_FILE_RD | CEPH_STAT_CAP_SIZE | CEPH_CAP_FILE_CACHE;
+ int caps = ceph_debug_get_fd_caps(cmount, fd);
+ ASSERT_EQ(expect, caps & expect);
+ ASSERT_EQ(0, ceph_read(cmount, fd, buf, 256, 0));
+
+ caps = ceph_debug_get_fd_caps(cmount, fd);
+ ASSERT_EQ(expect, caps & expect);
+ ASSERT_EQ(0, ceph_close(cmount, fd));
+
+ }
+ ceph_shutdown(cmount);
+}