osdc/ObjectCacher: return ENOENT

If we are given a single ObjectExtent, and the object doesn't exist,
and we don't have any dirty|tx buffers, return ENOENT to the caller.

This lets librbd's layering logic do its thing.

Signed-off-by: Sage Weil <sage@inktank.com>
osdc/ObjectCacher: trigger copy-on-write before read

If we are trying to read from an object, and it doesn't exist, but we have
dirty buffers, and a write could trigger copy-on-write, then flush our
write first to trigger the copy-on-write before we proceed with the read.
This ensures that a pattern like

CLONE
WRITE 0~10  (into cache)
READ  10~20

will flush the write and trigger a cow so that the read will see parent
data.

Signed-off-by: Sage Weil <sage@inktank.com>
test_librbd: add additoinal clone test

Test that reads will trigger a cow both when overlapping and not
overlapping with buffered writes.

Signed-off-by: Sage Weil <sage@inktank.com>
osdc/ObjectCacher: wake all rx waiters on ENOENT

If we discover an object doesn't exist, wake all rx waiters at the same
time.  This prevents a situation like:

- read extent A
- read extent B
- reply from A, ENOENT, exists=false
- read extent B (again), immediately tell caller ENOENT
- reply from B, ENOENT, tell caller ENOENT

Fixes: #3435
Signed-off-by: Sage Weil <sage@inktank.com>
librbd: better debug output

Signed-off-by: Sage Weil <sage@inktank.com>
test script for s3 tests
Signed-off-by: tamil <tamil.muthamizhan@inktank.com>
os/chain_xattr: move chained xattr helpers into separate file/module

* Rename do_* -> chain_*.
* Move #defines to a header.
* Fix *Index users
* Implement both *xattr() and f*xattr() variants for get, set, list,
  remove.

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use f*xattr() methods to test xattr support

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: add _fgetattr(), _fgetattrs() helpers

Introduce new fd-based getattr[s] helpers.

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use _fgetattrs() for GETATTRS op

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use _fgetattrs() for CLONE

We have the src fd.

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use _fgetattrs() for _setattrs()

If we're using omap for spillover, we need to load the xattrs so that
they can be removed if necessary.

Note that we subtly change the failure behavior here to be more
strict: if we can't open the file, we fail, whereas before we did not.

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use _fgetattrs() from _rmattrs()

Note that we subtly change failure handling to be more strict: if we
fail to open the file, we error out; before we ignored errors from
_getattr().

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use _fgetattrs() from collection_getattr()

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: remove unused _getattrs() methods

We are now using the _fgetattrs() variant everywhere instead.

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use _fgetattr() from getattr()

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: use new helpers from collection_{get,set,rm}attr[s]

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: drop _getattr() helpers

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: recast _setattrs() on top of chain_f* methods

This lets us open an fd once and use that.

Signed-off-by: Sage Weil <sage@inktank.com>
os/FileStore: recast _rmattr on top of chain_f*

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