John Spray [Thu, 7 May 2015 17:42:01 +0000 (18:42 +0100)]
client: fix error handling in check_pool_perm
Previously, on an error such as a pool not existing,
the caller doing the check would error out, but
anyone waiting on waiting_for_pool_perm would
block indefinitely (symptom was that reads on a
file with a bogus layout would block forever).
Fix by triggering the wait list on errors and
clear the CHECKING state so that the other callers
also perform the check and find the error.
Additionally, don't return the RADOS error code
up to filesystem users, because it can be
misleading. For example, nonexistent pool is
ENOENT, but we shouldn't give ENOENT on IO
to a file which does exist, we should give EIO.
Jason Dillaman [Tue, 21 Apr 2015 14:15:58 +0000 (10:15 -0400)]
librbd: allow updates to snapshot object maps
The modified copyup behavior will need to update snapshot object
maps when performing a copyup since the object will now exist within
all snapshots of the image.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Jason Dillaman [Mon, 20 Apr 2015 16:12:05 +0000 (12:12 -0400)]
librados_test_stub: support AIO snapshot context
AIO operations can be executed with a different snapshot
context from the IoCtx. librbd takes advantage of this
capability to perform a deep object copyup.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Jason Dillaman [Thu, 16 Apr 2015 20:27:56 +0000 (16:27 -0400)]
librbd: copyup should use empty snapshot context
This allows child object to exist through all existing
snapshots as well as HEAD. If the operation was a CoW,
issue the write ops as a separate RADOS op with the
correct snapshot context.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Jason Dillaman [Thu, 16 Apr 2015 18:15:10 +0000 (14:15 -0400)]
librbd: move copyup class method call to CopyupRequest
Move AbstractWrite's invocation of copyup to the CopyupRequest
class. The AioRequest write path will now always create a
CopyupRequest, which will now append the actual write ops to the
copyup.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Jason Dillaman [Wed, 15 Apr 2015 18:25:08 +0000 (14:25 -0400)]
librbd: add new deep-flatten RBD feature
Copy-on-read/write will now use an empty snapshot context to
deep-copy the object through all existing snapshots. With the
deep-flatten feature enabled, the flatten operation will now
disconnect a child image from its parent even if it has existing
snapshots.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Jason Dillaman [Thu, 7 May 2015 01:28:25 +0000 (21:28 -0400)]
librbd: fast diff should treat all _EXISTS objects as dirty
With the fast-diff feature enabled, if the object map marks the
object as _EXISTS, it can only occur due to a write -- otherwise
it would be _EXISTS_CLEAN. Therefore, ensure it is properly
flagged as an updated object for diff_iterate.
Fixes: #11553 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Sage Weil [Wed, 6 May 2015 21:01:34 +0000 (14:01 -0700)]
librbd: fix warning
librbd/librbd.cc: In member function 'int librbd::Image::metadata_get(const string&, std::string*)':
librbd/librbd.cc:845:76: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
Jason Dillaman [Wed, 6 May 2015 18:48:50 +0000 (14:48 -0400)]
librbd: ignore lack of support for metadata on older OSDs
If an Infernalis librbd attempts to open an image stored on a
pre-Infernalis OSD, the new config metadata operations won't
be supported. This error can be safely ignored.
Fixes: #11549 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Tim Serong [Fri, 1 May 2015 15:59:53 +0000 (01:59 +1000)]
json_spirit: use utf8 intenally when parsing \uHHHH
When the python CLI is given non-ASCII characters, it converts them to
\uHHHH escapes in JSON. json_spirit parses these internally into 16 bit
characters, which could only work if json_spirit were built to use
std::wstring, which it isn't; it's using std::string, so the high byte
ends up being zero'd, leaving the low byte which is effectively garbage.
This hack^H^H^H^H change makes json_spirit convert to utf8 internally
instead, which can be stored just fine inside a std::string.
Note that this implementation still assumes \uHHHH escapes are four hex
digits, so it'll only cope with characters in the Basic Multilingual
Plane. Still, that's rather a lot more characters than it could cope
with before ;)
(For characters outside the BMP, Python seems to generate escapes in the
form \uHHHHHHHH, i.e. 8 hex digits, which the current implementation
doesn't expect to see)
Fixes: #7387 Signed-off-by: Tim Serong <tserong@suse.com>
Zhiqiang Wang [Wed, 6 May 2015 08:14:29 +0000 (16:14 +0800)]
librbd: fix the image format detection
If the detection of the old format fails with reasons other than
-ENOENT, we should return with this error. Otherwise, if we continue the
new format detection and fail with -ENOENT, the caller will get the
missleading failure information.
Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
rados cli: add preventing using --block-size with bench seq and rand
Add handling of situation when '-b|--block-size' option is using with
'bench seq' or 'bench rand' which is erroneous according to the help message:
-b op_size
set the size of write ops for put or benchmarking
'trans_size' description from header: "size of the write/read to perform"
But really 'object_size' is used in write/read operations. 'trans_size' is used
only in ObjBencher::status_printer for calc current and average bandwidth.
As result - bad statistics in case 'trans_size' and and 'object_size' are different.
Ken Dreyer [Tue, 5 May 2015 17:25:46 +0000 (11:25 -0600)]
SubmittingPatches: clarify backport procedure
Developers should not add "Backport: " fields to Git commits, because
this data is immutable after the commits are merged. It makes more sense
to handle this information in Redmine instead.
Haomai Wang [Tue, 5 May 2015 05:58:39 +0000 (13:58 +0800)]
AsyncConnection: Avoid lockdep detect failed
Previously we used a atomic field to avoid deadlock, but it still let lockdep
detect failed. So we remove the atomic field and unlock connection firstly.
Haomai Wang [Tue, 5 May 2015 05:53:23 +0000 (13:53 +0800)]
AsyncConnection: Don't dispatch event when connection is stopped
When marking down connection, previously we will call stop which will dispatch event
regardless of the staus of the connection. If this connection is already down and
its events all has cleaned, we will hit NULL event.
Jianpeng Ma [Tue, 28 Apr 2015 05:12:47 +0000 (13:12 +0800)]
librbd: For format 2, don't forget set objectcache max objects.
For format 2, before create object_cache, it call init_layout and set
the max object for object cache.
In the later ictx_refresh, it only set for format1.
Now move set logic after creating object cache.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
Jianpeng Ma [Fri, 24 Apr 2015 06:47:28 +0000 (14:47 +0800)]
librbd: remove the perfcounter l_librbd_aio_rd/write/discard_*.
Now for non-aio read/write/discard, the internal implementation used the
related aio function. So we don't differentiate the aio perfcounter from non-aio for
read/write/discard operations.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>