Commit Graph

25426 Commits

Author SHA1 Message Date
Sage Weil
88706ab89c rbd: send progress info to stderr, not stdout
This avoids interfering when export is sent to stdout.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
325a3372cb rbd: include 'diff' command in man page
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
64a202a7ad rbd: update man page for import-diff and export-diff
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
f67f62abab rbd: prevent import-diff if start snapshot is not already present
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
9946c69cd1 rbd: fail import-diff if end snap already exists
This will prevent a user from inadvertantly reapplying a diff twice.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
5b0c68b928 doc/dev/rbd-diff: specify that metadata records come before data
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
3694968a05 librbd: implement image.snap_exists()
This is a much more convenient way to tell if a snapshot already exists.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
c5bd978a1d librados: move snap_set_diff to librados/
This is most closely related to the librados list_snaps API; move it there.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
6af769a16f librados: cleanly define SNAP_HEAD, SNAP_DIR constants
We were using the internal CEPH_NOSNAP and CEPH_SNAPDIR constants, and
defining a clone_info_t::HEAD (with a different value).  The docs were
referrring to the internal constant names.

Instead, define librados constants (C and C++) with the same values as the
internal types.

Note that this changes the clone_info_t::HEAD value from -1 to -2 so that
it now matches the internal type.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
10dc0ad09f librados: document list_snaps
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
be8927f598 librbd: drop unused elapsed calc for diff_iterate
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
f0c9a200ec librbd: diff_iterate fromsnapname after the end snap is also invalid
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
a69532e864 librbd: document diff_iterate in header
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
d0baadb9d3 librbd: uint64_t len for diff_iterate
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
7bbaa71a56 doc/dev/rbd-diff: update incremental file format
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
44e295a3cc qa: rbd/diff_continuous.sh: use non-standard striping
Exercise the striping arithmetic by using non-standard striping that
varies between the parent and child.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
39689fea49 librbd: fix diff_iterate arithmetic for non-standard striping
This code is confusing because we are moving back and forth between
image offsets, "buffer" offsets (image offsets relative to off), and
object offsets.  Fix the math.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
f2b0880a89 qa: rbd/diff_continuous.sh: base test off a clone
Get a bit of coverage on clones by starting with a clone.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
fc3f4fda76 rbd: implement simple 'diff' command
Report extents allocated/changed, and whether they contain data or zeros.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
4d02e17f36 librbd: handle diff from clone
If we have a parent image, and the reference is from snap 0 (beginning of
time) we need to look at the diff on the parent from the beginning of time
and report that when we get an ENOENT.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
186ddda58c rbd: send import debug noise to dout, not stdout
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:41 -07:00
Sage Weil
58c2dedded qa: add rbd/diff_continuous.sh stress test
Stress test that does io on an image while we are mirroring a diff from
earlier snaps to a second copy.  At the end, verify that all snaps have
matching content.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
e7167433ae rbd: implement 'export-diff' and 'import-diff' commands
Export a diff of an image from a previous snapshot to a file (or stdout).

Import a diff and apply it to an image, and then create the ending
snapshot.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
cf7d13a7e9 rbd: add --io-pattern <seq|rand> option to bench-write
Write to random offsets instead of sequentially.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
0296c7cdae librbd: implement diff_iterate
Implement a diff_iterate() method that will iterate over an image and
report which extents vary between two snapshots (or a snapshot and the
head).  The callback gets an extent and a flag indicating whether it is
full of data or is known to be zero in the ending snapshot.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
6db5109127 librados: expose snapset seq via list_snaps
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
ebed000014 osdc/Objecter: prval optional for listsnaps
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
4ae977435c osd: fix error codes for list-snaps
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
941cfc26a0 osd: fix clone snap list for list-snaps
We need to return the list of snaps that each clone is defined for, not
the list of snaps we know may or may not exist globally over a similar
interval.  This requires looking at the clone's obc, unfortunately.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
ceee218fd5 osd: wait for all clones on SNAPDIR requests
Wait for all clones to be present.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
556d33442f osd: direct reads on SNAPDIR to either head or snapdir
The list_snaps operation needs to look at the SnapSet, and is logically
querying all revisions of the object.  Make requests to SNAPDIR be
read-only, and grab the head or snapdir obc transparently (whichever one
exists).  This allows us to list snaps when, say, the head does not
exist, but there are in fact snaps.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
b64bb5f860 osd: do not include snaps with head on list_snaps()
If there is a sequence of snaps 1, 2, 3, 4, 5, and we have a clone
2 with [1,2], and the head reflects content at snap times [3,4,5], then
the snap_list should return

 clone 2 snaps [1,2]
 head snaps
 seq 2

because it never saw a write after snap 2, and therefor has the same
content currently as it did in snaps 3,4,5.  If the SnapSet on the
object lists snaps 3,4,5, and the head exists, it actually means the
object was deleted between 2 and 3, and was recreated after 5:

 clone 2 snaps [1,2]
 head snaps []
 seq 5

The key to telling the two situations apart is the seq number on the
SnapSet (now included in the list_snaps reply) that tells us when the
last update was.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
01b74209fb osd: clean up some whitespace
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
0074228911 osd: include SnapSet seq in the list snaps response
It is important to know the latest seq that the object has seen in order
to tell if a response like

 clone 2 snaps=[1,2]
 clone head snaps=[]

was untouched before a hypothetical snap 3, or deleted prior to snap 3,
and then recreated+modified after.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
fa5206ce9b osd: make LIST_WATCHERS and LIST_SNAPS print nicely for OSDOp
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
849a45c67f strings: add 'list-watchers' to MOSDOp strings
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 23:32:40 -07:00
Sage Weil
945ead5a81 Merge remote-tracking branch 'gh/wip-cors-rebased'
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
2013-03-31 23:23:47 -07:00
Sage Weil
a2956f6f8e rgw: fix warning
On a 64-bit arch, we still want to make sure it's a 32-bit value.  Gcc is
too smart for us to just cast; it will still warn on 32-bit arch that the
comparison is always true.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 21:51:59 -07:00
Yehuda Sadeh
01779df17d rgw: add missing include file
Add missing limits.h, needed for ULONG_MAX.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-03-31 21:51:59 -07:00
Yehuda Sadeh
3c52b8bbf5 Makefile.am: change some cors rules
The cors unitest should be a standalone test (not part of the make
unitests) as it requires having a running gateway and needs input params
to run correctly.
Also update missing header files.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-03-31 21:51:59 -07:00
Yehuda Sadeh
e1a78f9827 rgw: fix a few warnings
Adjust data types

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-03-31 21:51:59 -07:00
Babu Shanmugam
d4b22f3e17 rgw: more cors fixes
Remove the check for read_cors_config in rgw_main.cc, and changes type of 'a' to unsigned from long as max_age cannot be a negative integer

Modified the type of 'a' to unsigned long and used ULONG_MAX and strtol in rgw_cors_swift.h

Signed-off-by: Babu Shanmugam <anbu@enovance.com>
2013-03-31 21:51:59 -07:00
Yehuda Sadeh
e9e86ad14a rgw: cors, style fixes, other fixes
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-03-31 21:51:59 -07:00
Babu Shanmugam
f165049cba rgw: with CORS support
With CORS test cases

1. Added license headers to the cors files
2. SIWFT POST metadata for cors will replace the old cors configuration
3. Fixed a buf in rgw_cors_swift.h

With Yehuda's review comments along with some fixes;
1. If the origin is allowed only for https, we should not approve the same host for http requests
2. Accounted for hostname situtation like www.www.org, or www.wowwww.com or www.*
3. Replaced atoi with strtol
4. Have a centralized place for parsing host names, hence avoiding duplicates

Checked certain senarios with amazon S3 and made changes accordingly

With some fixes in rgw_cors.cc and str_list.cc

Removing the whitespace auto-append to the delimiters in get_str_list(), added white spaces delimiters in is_string_in_set()
2013-03-31 21:51:48 -07:00
Sage Weil
c01e2e42f3 client: do sync read when 'client oc = false'
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 21:44:00 -07:00
Sage Weil
74c708367b client: fix use-after-free on session close and cond signals
Move the signal into the closed method, before we deallocate the
MetaSession, so that other callers catch it too.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-31 21:43:57 -07:00
Yan, Zheng
4ad35b2a83 mds: mark connection down when MDS fails
So if the MDS restarts and uses the same address, it does not get
old messages.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2013-03-31 16:57:14 +08:00
Yan, Zheng
fbcc64dffd mds: fix MDCache::adjust_bounded_subtree_auth()
There are cases that need both create new bound and swallow intervening
subtree. For example: A MDS exports subtree A with bound B and imports
subtree B with bound C at the same time. The MDS crashes, exporting
subtree A fails, but importing subtree B succeed. During recovery, the
MDS may create new bound C and swallow subtree B.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2013-03-31 16:57:14 +08:00
Yan, Zheng
573a4ae1a2 mds: process finished contexts in batch
If there are several unstable locks in an inode, current Locker::eval(CInode*,)
processes each lock's finished contexts seperately. This may cause very deep
call stack if finished contexts also call Locker::eval() on the same inode.
An extreme example is:

Locker::eval() wakes an open request(). Server::handle_client_open() starts
a log entry, then call Locker::issue_new_caps(). Locker::issue_new_caps()
calls Locker::eval() and wakes another request. The later request also tries
starting a log entry.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2013-03-31 16:57:14 +08:00
Yan, Zheng
5cbaae6648 mds: preserve subtree bounds until slave commit
When replaying an operation that rename a directory inode to non-auth subtree,
if the inode has subtree bounds, we should prevent them from being trimmed
until slave commit.

This patch also fixes a bug in ESlaveUpdate::replay(). EMetaBlob::replay()
should be called before MDCache::finish_uncommitted_slave_update().

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2013-03-31 16:57:14 +08:00