rados.py: add aio_remove

Add aio_remove to the Python wrapper.

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
osd: bracket role changes with scrub reg/unreg

Make sure the reg/unreg calls for putting ourselves in the scrub schedule
bracket any PG role changes, or that initial reg happens after the role
has been initialized.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: only register for scrub if we are the PG primary

There is no reason to put non-primary PGs on the scrub schedule as they
will be ignored when the worker comes around.  This reduces lock
contention and is generally cleaner.

Signed-off-by: Guang Yang <yguang@yahoo-inc.com>
Signed-off-by: Sage Weil <sage@inktank.com>
Make the configuration "filestore merge threshold" can be negative which prevent it from merging, this could help:
  1. We are trying to create the PG folder up to several levels with a standalone tool to prevent it from runtime splitting, we need a configuration which prevent it from merging even there is no file within the folder.
  2. As runtime split / merge could bring latency issues, customer can use a negative merge threshold to prevent merging but only splitting.
This change is backward compatbile.
Signed-off-by: Guang Yang (yguang@yahoo-inc.com)
mds: Return EINVAL for parent lookup on root ino

This was the behaviour before 8d6b25a1, and distinguishes
the general failure to find a parent (ESTALE) from the specific
case of a node being present but being the base (EINVAL)

Signed-off-by: John Spray <john.spray@inktank.com>
client: Add lookup_parent & lookup_name

Exposing the CEPH_MDS_OP_LOOKUPPARENT and
recently added CEPH_MDS_OP_LOOKUPNAME operations.

lookup_ino and lookup_parent optionally take an Inode**
which will be populated with a reference to the
resulting inode.

Fixes: #3863

Signed-off-by: John Spray <john.spray@inktank.com>
libcephfs: add ceph_ll_lookup_inode

This is a wrapper to lookup_ino, lookup_parent
and lookup_name, to provide the
caller with the requested inode and its
dentry.  The result is suitable for traversing
the inode's path.

Fixes: #3863

Signed-off-by: John Spray <john.spray@inktank.com>
tools: Create ceph-client-debug

For exposing test/dev functionality which uses
the cephfs client interface.

Initially just provides lookup-by-ino.

Fixes: #3863

Signed-off-by: John Spray <john.spray@inktank.com>
Remove code duplication from s3 tests.

A new module, s3_utilities.pm has been created.  It contains
subroutines common to at least two of the workunits in this
directory. Code was moved here from the other pl files, and
some minor changes (paramers and scope changes) were needed.

Fixes: 7472
Signed-off-by: Warren Usui <warren.usui@inktank.com>
ReplicatedPG: disallow trans which atomically create and remove an object

There are a few problems with such a transaction:
1) We don't really have a way to represent it in the log
2) How does it affect snaps?
3) In finish_ctx, it means we cannot assume that if we are saving snaps
on a snapdir we must be creating the snapdir.

For now, we'll just disallow such a transaction.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: if !obc->obs->exists, lock snapdir obc if exists

Otherwise, backfill might slip in during a copyfrom.

Fixes: #7728
Signed-off-by: Samuel Just <sam.just@inktank.com>
mon: Properly handle errors from 'cmd_getval()' when needed

Not handling the error return from cmd_getval() may leave uninitialzied
values, which can cause issues, specially with non-string values.

Fixes: 6806

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Monitor: handle invalid 'quorum' command argument

Don't rely on client side validation of possible command arguments.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: OSDMonitor: don't rely on client-side validation for command arguments

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Merge pull request #1490 from ceph/wip-6806

mon: Properly handle errors from 'cmd_getval()' when needed

Reviewed-by: Sage Weil <sage@inktank.com>
PG::find_best_info: fix log_tail component

The previous logic should have kept the current best info if it found a
replica which best could log-recover, but p couldn't.  However, the
continue in that loop advanced the inner loop instead of the outer loop
allowing the primary case to take over in cases where best had a longer
tail.  Instead, we will prefer the longer tail regardless of the other
infos to simplify the logic.

Fixes: #7755
Signed-off-by: Samuel Just <sam.just@inktank.com>
PG::start_peering_interval: always send_notify if !primary

Otherwise, we might get into a situation where the primary
forgets about a stray pg.  This is simpler and does not
increase the number of notifies by much.

Fixes: #7733
Signed-off-by: Samuel Just <sam.just@inktank.com>
common/PrioritizedQueue: fix remove_by_class() corner case

If i is the first entry, then setting cur = begin() sets us up to point at
something that we are about to delete.  Move the check to the end to avoid
this.

Backport: emperor, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
common/PrioritizedQueue: constify a few things

Signed-off-by: Sage Weil <sage@inktank.com>
common/PrioritizedQueue: include first item's cost in dump

Signed-off-by: Sage Weil <sage@inktank.com>