radosgw-admin: fix subuser modify

Shouldn't check for empty access key when modifying swift user, also
set correct fields when updating swift keys.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: subuser creation can be idempotent

No real reason to check for existing subuser before (re)creating it.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
radosgw-admin: don't always generate access key for subusers

Only generate key for subuser if one was not specified for it, and only
when creating a subuser.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
client: try shrinking kernel inode cache when trimming session caps

Notify kernel to invalidate top level directory entries. As a side
effect, the kernel inode cache get shrinked.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: pin parent dentry of inode who has ll_ref > 0

This prevents Client:trim_dentry() from unlinking parent dentry of
directory inode referenced by fuse kernel module.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mailmap: Sandon Van Ness name normalization

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Michael Nelson affiliation

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Paul Meserve affiliation

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: make misdirected checks explicit about replicas, flags

Only allow read ops to target replicas if the necessary op flags are set.
The previous checks were very sloppy.

Fixes: #8031
Signed-off-by: Sage Weil <sage@inktank.com>
osd: drop previous interval ops even if primary happens to be the same

If we have two consecutive intervals with the same primary, the client
will not resend the op and the same_primary_since epoch will not change,
and all is well.

If, however, we have 3 intervals, and the primary changes away and then
back to a particular OSD, the OSD will currently still process the old
request (assuming the timing works out) because it is currently the
primary.  This is unnecessary because the client will resend the request.
It may even introduce a hard-to-hit ordering problem since whether or not
the OSD processes the message becomes dependent on how many subsequent
maps it has consumed when the request is processed.

Instead, simplify the minor tangle of helpers by making a single simple
check that discards requests from before same_primary_since.  We can then
avoid using the same_for_*() helpers and drop the check from
handle_misdireted_op(), which is also nice because the name is now accurate
(it *only* deals with ops that are in fact misdirected, not just slow to
arrive).

Signed-off-by: Sage Weil <sage@inktank.com>
osd: drop unused same_for_*() helpers

These were all identical and mostly served to obscure the actual logic,
which is now captured by can_discard_op() and the matching Objecter
code on the client side.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/PG: set CREATING pg state bit until we peer for the first time

We send PG state updates to the monitor while creating a PG before the
actual creation and been finalized and persisted.  Because those updates
do not include the CREATING bit, the mon will remove the pgid from it's
creating set.  If the OSD(s) crash before persisting that PG creation, the
PG will never get created.

Fix this by leaving the CREATING bit set on the primary as long as
last_epoch_started==0.  That is, until we successfully peer for the very
first time.  Only then do we clear the bit and tell the monitor it's duty
is complete.

Fixes: #8001
Signed-off-by: Sage Weil <sage@inktank.com>
remove mkcephfs

Fixes: #7552
Signed-off-by: Sage Weil <sage@inktank.com>
pipe: only read AuthSessionHandler under pipe_lock

session_security, the AuthSessionHandler for a Pipe, is deleted and
recreated while the pipe_lock is held. read_message() is called
without pipe_lock held, and examines session_security. To make this
safe, make session_security a shared_ptr and take a reference to it
while the pipe_lock is still held, and use that shared_ptr in
read_message().

This may have caused crashes like:

*** Error in `qemu-system-x86_64': invalid fastbin entry (free): 0x00007f42a4002de0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7f452f1f3a46]
/usr/lib/x86_64-linux-gnu/libnss3.so(PK11_FreeSymKey+0xa8)[0x7f452e72ff98]
/usr/lib/librados.so.2(+0x2a18cd)[0x7f453451a8cd]
/usr/lib/librados.so.2(_ZNK9CryptoKey7encryptEP11CephContextRKN4ceph6buffer4listERS4_RSs+0x71)[0x7f4534519421]
/usr/lib/librados.so.2(_Z21encode_encrypt_enc_blIN4ceph6buffer4listEEvP11CephContextRKT_RK9CryptoKeyRS2_RSs+0xfe)[0x7f453451859e]
/usr/lib/librados.so.2(_Z14encode_encryptIN4ceph6buffer4listEEiP11CephContextRKT_RK9CryptoKeyRS2_RSs+0xa2)[0x7f45345186d2]
/usr/lib/librados.so.2(_ZN19CephxSessionHandler23check_message_signatureEP7Message+0x246)[0x7f4534516866]
/usr/lib/librados.so.2(_ZN4Pipe12read_messageEPP7Message+0xdcc)[0x7f453462ecbc]
/usr/lib/librados.so.2(_ZN4Pipe6readerEv+0xa5c)[0x7f453464059c]
/usr/lib/librados.so.2(_ZN4Pipe6Reader5entryEv+0xd)[0x7f4534643ecd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7f8e)[0x7f452f543f8e]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f452f26da0d]

Partially-fixes: #6480
Backport: dumpling, emperor
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
osd: do not block when updating osdmap superblock features

We are holding osd_lock in check_osdmap_features, which means we cannot
block while waiting for filestore operations to flush/apply without
risking deadlock.

The important constraint is that we commit that the feature is enabled
before also commiting anything that utilizes sharded objects.  The normal
commit sequencing does that already; there is no reason to block here.

Fixes: #8045
Signed-off-by: Sage Weil <sage@inktank.com>
librbd: fix zero length request handling

Zero-length writes would hang because the completion was never
called. Reads would hit an assert about zero length in
Striper::file_to_exents().

Fix all of these cases by skipping zero-length extents. The completion
is created and finished when finish_adding_requests() is called. This
is slightly different from usual completions since it comes from the
same thread as the one scheduling the request, but zero-length aio
requests should never happen from things that might care about this,
like QEMU.

Writes and discards have had this bug since the beginning of
librbd. Reads might have avoided it until stripingv2 was added.

Fixes: #5469
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librados: Fix typo for read functions documentation

Signed-off-by: David Zafman <david.zafman@inktank.com>
librados: Allow rados_pool_list() to get NULL buffer if len == 0

Coverity wants a NULL check for buf, but caller should be able to
pass a NULL buf and 0 len in order to get byte count of pool list.

Signed-off-by: David Zafman <david.zafman@inktank.com>
rbd: Prevent Seg fault by checking read result in snap_read_header()

Signed-off-by: David Zafman <david.zafman@inktank.com>
mailmap: Nikola Kotur affiliation

Reviewed-by: Nikola Kotur <kotnick@gmail.com>
Signed-off-by: Loic Dachary <loic@dachary.org>