Patrick Donnelly [Mon, 16 Sep 2019 23:49:39 +0000 (16:49 -0700)]
Merge PR #29817 into master
* refs/pull/29817/head:
doc: document that the kcephfs mount helper will search keyring files for secrets
mount.ceph: fork a child to get info from local configuration
mount.ceph: track mon string and path inside ceph_mount_info
mount.ceph: add name and secret to ceph_mount_info
mount.ceph: add ceph_mount_info structure
mount.ceph: clean up debugging output and error messages
mount.ceph: clean up return codes
mount.ceph: add comment explaining why we need to modprobe
mount.ceph: use bools for flags
common: have read_secret_from_file return negative error codes
Reviewed-by: Kefu Chai <kchai@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Also, don't allow children to set nref (to 0). This is the more significant
change as it required fixing various code to not do this:
<reftype> ptr = new RefCountedObjectFoo(..., 0);
as a way to create a starting reference with nref==1. This is a pretty
bad code smell so I've converted all the code doing this to use the new
factory method which produces the reference safely:
auto ptr = ceph::make_ref<RefCountedObjectFoo>(...);
libradosstriper was particularly egregious in its abuse of setting the starting
nref. :(
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Patrick Donnelly [Wed, 14 Aug 2019 18:23:42 +0000 (11:23 -0700)]
include: convert FunctionContext usage to generic LambdaContext
The main motivation for this change is to avoid copies due to the use of
boost::function/std::function where captures of std::unique_ptr (in
subsequent commits) would fail to compile.
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
crimson/osd: reply if pg is absent when handling MQuery
in previous commit, the support of `MOSDPGQuery` was dropped. but
if we want to handle `MOSDPGQuery2` properly, we should take
`on_pg_absent()` into consideration when handling `MOSDPGQuery2`.
in this change, we handle `MOSDPGQuery2` by checking the boost event
against `MQuery`, so we don't need to create a new class derived from
`RemotePeeringEvent` for specializing the behavior.
chunmei Liu [Thu, 12 Sep 2019 21:01:37 +0000 (14:01 -0700)]
crimson/mon:use shared_future for waiting MauthReply
when monitor-side close the connection, msgr call MonClient
ms_handle_reset cause reply.get_future be called twice then
assert happen in promise.get_future.
promise<T...>::get_future() noexcept {
assert(!this->_future && this->_state && !this->_task);
return future<T...>(this);
}
use shared_promise instead of promise to solve it.
Signed-off-by: chunmei Liu <chunmei.liu@intel.com>
Patrick Donnelly [Fri, 13 Sep 2019 19:38:47 +0000 (12:38 -0700)]
Merge PR #28560 into master
* refs/pull/28560/head:
cephfs-shell: handle du's arguments elsewhere outside do_du()
cephfs-shell: reuse code
cephfs-shell: rewrite call to perror in do_du
pybind/cephfs: define variable for hexcode used in stat()
test_cephfs_shell: test cephfs-shell command at invocation
cephfs-shell: refactor do_du()
cephfs-shell: option -r is not for reverse
cephfs-shell: extend to_bytes()
test_cephfs_shell: test du with no args
test_cephfs_shell: test du with multiple paths in args
test_cephfs_shell: test behaviour of "du -r"
test_cephfs_shell: test du's output for softlinks
qa/cephfs: add convenience method lstat()
qa/cephfs: add option to make stat() unfollow symlinks
test_cephfs_shell: test du's output for hardlinks
test_cephfs_shell: test du's output for directories
test_cephfs_shell: test du's output for regular files
test_cephfs_shell: add a method to get command output
test_cephfs_shell: allow cmd as list too
test_cephfs_shell: rename and rewrite _cephfs_shell()
test_cephfs_shell: copy humanize() from cephfs-shell
cephfs-shell: print disk usage for non-directory files too
pybind/cephfs: add method that stats symlinks without following
cephfs-shell: Fix 'du' command error
Reviewed-by: Varsha Rao <varao@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Patrick Donnelly [Fri, 13 Sep 2019 15:36:32 +0000 (08:36 -0700)]
Merge PR #24794 into master
* refs/pull/24794/head:
mds: move BatchOp to separate translation unit
mds: use auto ref during iteration
mds: answering all pending getattr/lookups targeting the same inode in one go
Reviewed-by: Zheng Yan <zyan@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Patrick Donnelly [Fri, 13 Sep 2019 15:35:04 +0000 (08:35 -0700)]
Merge PR #28702 into master
* refs/pull/28702/head:
qa: update json format from session listing
mds: recall caps from quiescent sessions
mds: use Session::dump method uniformly
mds: use auto to deduce iterator type
mds: simplify method definition
mds: remove useless debug message
mds: use const get_request_count
mds: use session_info_t socket inst for addr
mds: refactor session lookup
mds: add explicit trim flag
mds: alphabetize tracked config keys
common: provide method to get half-life
common: correct variable name
Reviewed-by: Zheng Yan <zyan@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
tools/setup-virtualenv.sh: do not default to python2.7
This commit changes the script's behavior when run without a --python option.
Before, we were running virtualenv with "--python python2.7" in that case.
That is not a reasonable default in September 2019, given that Python 2 EOL is
coming on January 1, 2020. Also, it breaks setup-virtualenv.sh in py3-only
environments.
With this patch, the script will not pass any "--python" option to virtualenv
(i.e., it will let virtualenv do whatever it thinks is best) in this case.
Jeff Layton [Tue, 13 Aug 2019 11:32:00 +0000 (07:32 -0400)]
mount.ceph: fork a child to get info from local configuration
When a secret and/or the mon addrs are not specified by the admin,
then mmap a MAP_SHARED buffer and spawn a child process to get that
info. For safety reasons, the child drops all capabilities other than
CAP_DAC_READ_SEARCH (to ensure that it'll be able to read the keyring,
should one be found). To achieve this, we add a new dependency on
libcap-ng.
Add a new C++ file with a single routine that will create a CephContext,
get a list of monitor addresses and scrape the keyring for a secret for
the specified cephx user.
If that info is found, then it is copied to fixed-length buffers in the
MAP_SHARED area and the child exits successfully.
The parent will then vet the returned info and copy it into the
appropriate fields if they are currently blank.
Fixes: https://tracker.ceph.com/issues/16656 Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Tue, 20 Aug 2019 18:25:55 +0000 (14:25 -0400)]
mount.ceph: add name and secret to ceph_mount_info
...and move the length defines into mount.ceph.h. Note that we use a
fixed-length buffer for the secret, as it cuts down a copy when we
read_secret_from_file.
Jeff Layton [Tue, 20 Aug 2019 18:40:23 +0000 (14:40 -0400)]
mount.ceph: add ceph_mount_info structure
Add a new structure to hold current mount information. Move the options
string and the current buffer length into it, as well as the filesystem
mount flags.
Jeff Layton [Tue, 13 Aug 2019 13:28:20 +0000 (09:28 -0400)]
mount.ceph: clean up return codes
Mount helpers should return a specific mask as the return value so
that the caller can interpret what happened. These are detailed in
mount(8) and are already defined in mtab.c.
Fix the helper to return appropriate error codes for different
failure modes. Also, add a goto out target so we can ensure that we
do proper cleanup on failure.
classic OSD started to use single-pg peering ops since ce05c172, and it
switched over to these ops since octopus. and it's assumed that
crimson-osd won't be GA until octopus+2 release, so it's not needed to
support pre-octopus releases.
classic OSD started to use single-pg peering ops since ce05c172, and it
switched over to these ops since octopus. and it's assumed that
crimson-osd won't be GA until octopus+2 release, so it's not needed to
support pre-octopus releases. hence "octopus" is passed to PeeringCtx's
constructor.
Create new action class for do_du()'s args.paths and push the code that
handles arguments for do_du() in there. The intention is to keep only
the code that does some disk usage stuff in do_du().