Commit Graph

29635 Commits

Author SHA1 Message Date
huangjun
bf198e673f fix the bug if we set pgp_num=-1 using "ceph osd pool set data|metadata|rbd -1"
will set the pgp_num to a hunge number.

   Signed-off-by: huangjun  <hjwsm1989@gmail.com>
2013-10-28 12:12:26 +08:00
Greg Farnum
5eb836f23a ReplicatedPG: take and drop read locks when doing backfill
All our interfaces are in place, so now we can actually take and
drop the locks.
1) Take locks in ReplicatedPG::recover_backfill. This is the entry
into the backfill code path, and covers all objects which are
added to backfills_in_flight (via prep_backfill_object_push()). If we
can't get the lock right away, we stop the backfill movement there
until we can do so.
2) Drop the locks in ReplicatedPG::on_peer_recover(), called when the
push is completed.
2b) Further drop the locks on all backfills_in_flight objects in
_clear_recovery_state(), for when we cancel peering.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-27 10:40:32 -07:00
Greg Farnum
058c74ab23 PG: switch the start_recovery_ops interface to specify work to do as a param
We previously inferred whether there was useful work to be done
by looking at the number of ops started, but with the upcoming
introduction of the rw_manager read locking on backfill, we could
start no ops while still having work to do. Switch around the
interfaces to specify these as separate pieces of information.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-27 10:40:32 -07:00
Greg Farnum
87daef76cd ReplicatedPG: implement the RWTracker mechanisms for backfill read locking
We want backfill to take read locks on the objects it's pushing. Add
a get_backfill_read(hobject_t) function, a corresponding drop_backfill_read(),
and a backfill_waiting_on_read member in ObjState. Check that member when
getting a write lock, and in put_write(). Tell callers to requeue the recovery
if necessary, and clean up the backfill block when its read lock is dropped.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-27 10:40:32 -07:00
Greg Farnum
96ed5b8c38 ReplicatedPG: separate RWTracker's waitlist from getting locks
This way we can try and get locks which aren't associated with
an OpRequest.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-27 10:40:32 -07:00
Greg Farnum
f0f67507dd common: add an hobject_t::is_min() function
Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-27 10:40:32 -07:00
Christophe Courtaut
fe30ac6ca3 rgw: Use JSONFormatter to use keystone API
Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>
2013-10-27 15:01:42 +01:00
Christophe Courtaut
5733f9cebf rgw: Use keystone password to validate token too
Adds the alternative use of password, instead of admin token,
to validate tokens.

Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>
2013-10-27 15:01:42 +01:00
Christophe Courtaut
bd04a775a8 rgw: Adds passwd alternative to keystone admin token
http://tracker.ceph.com/issues/5374 Fixes #5374

This adds options parsing to have a user, password and tenant,
to be able to ask for a token.
This token is then used to authenticate against keystone, instead
of relying on the admin token.
Otherwise, you can still use the admin token to authenticate.
This doesn't change the existing behaviour.

Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>
2013-10-27 15:01:33 +01:00
Yehuda Sadeh
5cba83855a Merge pull request #672 from liammonahan/wip-defer-to-bucket-acls
Add a configurable to allow bucket perms to be checked before key perms

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
2013-10-26 19:24:59 -07:00
Sage Weil
c2cd460950 Merge pull request #765 from ceph/wip-6635
mon: OSDMonitor: Make 'osd pool rename' idempotent

Reviewed-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-10-25 17:53:30 -07:00
Sage Weil
8282e24dd6 mon/OSDMonitor: make racing dup pool rename behave
If we get dup pool rename requests that are racing, make sure the second
one comes back with 'success' if the rename entry already exists in the
pending_inc map.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-10-25 17:45:06 -07:00
Loic Dachary
66a9fbe2c7 common: rebuild_page_aligned sometimes rebuilds unaligned
rebuild_page_aligned relies on rebuild to create memory that is aligned
according to list::is_page_aligned(). However, when the bufferlist only
contains a single ptr and that its size is not list::is_n_page_size(),
rebuild will not create the expected alligned bufferlist.

The allocation of the ptr is moved out of rebuild which is now given the
ptr as an argument. The rebuild_page_aligned function always require an
aligned ptr with buffer::create_page_aligned(_len) for consistency.

The test

    bufferlist bl;
    bufferptr ptr(buffer::create_page_aligned(2));
    ptr.set_offset(1);
    ptr.set_length(1);
    bl.append(ptr);
    EXPECT_FALSE(bl.is_page_aligned());
    bl.rebuild_page_aligned();
    EXPECT_FALSE(bl.is_page_aligned());

demonstrated the problem. It was assumed to be a feature but should have
been identified as a bug. The last ligne is replaced with

    EXPECT_TRUE(bl.is_page_aligned());

Most tests related to is_page_aligned() wrongfully assumed that

    bufferptr ptr(2);

is never page aligned. Most of the time it is not but sometime it is
when the pointer address is by chance on a CEPH_PAGE_SIZE boundary,
which triggered #6614. Non aligned ptr are created as follows instead:

    bufferptr ptr(buffer::create_page_aligned(2));
    ptr.set_offset(1);
    ptr.set_length(1);

http://tracker.ceph.com/issues/6614 fixes: #6614

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-10-26 02:42:31 +02:00
Joao Eduardo Luis
c14c98d3f0 mon: OSDMonitor: Make 'osd pool rename' idempotent
'ceph osd pool rename' takes two arguments: source pool and dest pool.
If by chance 'source pool' does not exist and 'destination pool' does,
then, in order to assure it's idempotent, we want to assume that if
'source pool' no longer exists is because it was already renamed.

However, while we will return success in such case, we want to make sure
to let the user know that we made such assumption.  Mostly to warn the
user of such a thing in case of a mistake on the user's part (say, the
user didn't notice that the source pool didn't exist, while the dest did),
but also to make sure that the user is not surprised by the command
returning success if the user expected an ENOENT or EEXIST.

Fixes: #6635

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-10-26 01:28:10 +01:00
Sage Weil
6681668565 Merge pull request #770 from dachary/master
packages: ceph.spec.in is missing make as a build dependency

Reviewed-by: Sage Weil <sage@inktank.com>
2013-10-25 16:00:35 -07:00
Loic Dachary
284b73bb41 packages: ceph.spec.in is missing make as a build dependency
On a virgin centos-6.4, after yum-builddep ceph and following
http://ceph.com/docs/next/install/building-ceph/ instructions to:

cd ceph
./autogen.sh
./configure
make

it fails because make is not installed. It probably is not a problem for
most people because there are few developers who did not install make.

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-10-26 00:46:32 +02:00
Gregory Farnum
0f1fed6fe7 Merge pull request #769 from ceph/wip-copy-get
With this branch we make copy-get significantly easier to extend by applying our standard encode/decode stuff to it, instead of doing an inline encode-onto-the-payload. We also add some infrastructure for dealing with completion of RepGathers.

Reviewed-by: Sage Weil <sage@inktank.com>
2013-10-25 13:57:21 -07:00
Greg Farnum
aea985c142 Objecter: expose the copy-get()'ed object's category
In the OSD, store the category in the CopyOp using this.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:52:57 -07:00
Greg Farnum
06b5bf675a osd: add category to object_copy_data_t
We don't bump the encoding version -- and stick it in the middle --
since it's still brand-new. For simplicity, we encode it unconditionally
rather than trying to embed it alongside the attrs or with its own
"complete" flag in the cursor.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:52:56 -07:00
Greg Farnum
61f2e5d994 OSD: add back CEPH_OSD_OP_COPY_GET, and use it in the Objecter
This one is encoded with version information. We are not doing anything
to control which op gets sent by the client, but after discussion with
Sam we think this op isn't accessible enough to clients (right now it's
only triggered by a client sending copy-from, which can only happen via
ceph-test-rados) to require compatibility versioning.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:52:56 -07:00
Greg Farnum
15c8267e34 OSD: rename CEPH_OSD_OP_COPY_GET -> CEPH_OSD_OP_COPY_GET_CLASSIC
In order to introduce versioning of copy-get, we need to make it a
different op that has the versioning infrastructure from the start.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:52:56 -07:00
Greg Farnum
b75b7ad679 ReplicatedPG: copy: move the COPY_GET implementation into its own function
It was getting long, isn't terribly dependent on access to do_osd_ops()
state, and will be easier to make generic as its own function.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:52:56 -07:00
Greg Farnum
80f36963b7 osd: Add a new object_copy_data_t, and use it in the OSD/Objecter
Right now this is very primitive, but we're about to extend it to
deal with request versioning appropriately, and adding in some
extra fields.
Sadly we are doing a little extra copying in the Objecter as a result, but
too bad -- being able to do updates will be worth it.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:52:56 -07:00
Greg Farnum
808fa9ad39 ReplicatedPG: cache: don't handle cache if the obc is blocked
Right now the only way that can happen is if we're in the middle of a
promote!

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:36:45 -07:00
Greg Farnum
91b589fb1f ReplicatedPG: copy: add a C_KickBlockedObject
As the name says, you give it an obc and it kicks the block list
when finish()ed.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:36:45 -07:00
Greg Farnum
ade8f19650 ReplicatedPG: add a Context *ondone to RepGathers
Make a few changes to make sure we trigger it when appropriate. We'll use
this shortly for object promotion, and perhaps for other things in future.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:36:45 -07:00
Greg Farnum
b403ca80d9 ReplicatedPG: copy: rename CopyOp::version -> user_version
This version is a user version, and since we're in the OSD we
should call it such. (In particular, we may want to keep track
of the internal version too when doing cache promotes.)

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:36:44 -07:00
Greg Farnum
4e139fc318 ReplicatedPG: copy: do not let start_copy() return error codes
There's no failure it can actually run into, and handling error
codes in some of its callers is going to be a pain.
While we're here, document the parameters.

Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:36:44 -07:00
Greg Farnum
178f9a2a45 ObjectStore: add a bufferlist-based getattrs() function
Signed-off-by: Greg Farnum <greg@inktank.com>
2013-10-25 13:36:44 -07:00
Sage Weil
4f7114a945 Merge branch 'wip-osd-fixes' into next
Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-10-25 12:56:02 -07:00
Sage Weil
e17ff196a4 osd/osd_types: init SnapSet::seq in ctor
Signed-off-by: Sage Weil <sage@inktank.com>
2013-10-25 12:50:17 -07:00
Sage Weil
d2b661d0ef os/FileStore: fix getattr return value when using omap
The return value should be the length of the value, even when it was
stored in omap.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-10-25 12:49:57 -07:00
Sage Weil
3a469bb2ae os/ObjectStore: fix RMATTRS encoding
Apparently nobody uses this!

Signed-off-by: Sage Weil <sage@inktank.com>
2013-10-25 12:49:51 -07:00
Samuel Just
847ea60592 PGLog::read_log: don't add items past backfill line to missing
Fixes: #6574
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
2013-10-25 12:34:13 -07:00
Sage Weil
4be4abe932 Merge pull request #764 from ceph/wip-rbd-parent-info
rbd.py: increase parent name size limit

Reviewed-by: Sage Weil <sage@inktank.com>
2013-10-25 10:09:28 -07:00
Josh Durgin
3c0042cde5 rbd.py: increase parent name size limit
64 characters isn't all that long. 4096 ought to be enough for anyone.

Fixes: #6072
Backport: dumpling, cuttlefish
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 17:31:04 -07:00
Samuel Just
87d3f88742 PGMap::dirty_all should be asserting about osd_epochs, not in.osd_epochs
Fixes: #6627
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-10-24 16:44:04 -07:00
Sage Weil
289b790340 Merge remote-tracking branch 'gh/next' 2013-10-24 15:23:19 -07:00
Adam Twardowski
0388b712b4 Update init-rbdmap
Add a chkconfig line for RHEL based distros to make chkconfig start rbdmap earlier on boot and stop later on shutdown.  This will help prevent shutdown/reboot from hanging your system forever in the event that some daemon has a file held open on an rbd mounted filesystem.

Signed-off-by: Adam Twardowski <adam.twardowski@gmail.com>(cherry picked from commit 80384a1a24)
2013-10-24 14:49:53 -07:00
Sage Weil
9d7b0d47ea Merge pull request #762 from atwardowski/patch-2
add redhat settings to rbdmap init script

Backport: emperor
Reviewed-by: Sage Weil <sage@inktank.com>
2013-10-24 14:41:37 -07:00
Greg Farnum
0d326c3fa5 ceph: tolerate commands without any child args
Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 12:35:47 -07:00
Josh Durgin
9fa9ed122e Merge branch 'wip-rgw-sync-next' into next
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
2013-10-24 11:45:06 -07:00
Josh Durgin
cfe845115b rgw: eliminate one unnecessary case statement
0x21 '!' is the first character that doesn't need encoding, so we can
expand the lower bound check.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 11:37:07 -07:00
Adam Twardowski
80384a1a24 Update init-rbdmap
Add a chkconfig line for RHEL based distros to make chkconfig start rbdmap earlier on boot and stop later on shutdown.  This will help prevent shutdown/reboot from hanging your system forever in the event that some daemon has a file held open on an rbd mounted filesystem.

Signed-off-by: Adam Twardowski <adam.twardowski@gmail.com>
2013-10-24 12:24:11 -04:00
Josh Durgin
f9a6d71904 radosgw-admin: remove unused function escape_str()
This was added before formatters were used for dumping logs.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 08:59:07 -07:00
Josh Durgin
ec45b3b88c rgw: escape bucket and object names in StreamReadRequests
This fixes copy operations for objects that contain unsafe characters,
like a newline, which would return a 403 otherwise, since the GET to
the source rgw would be unable to verify the signature on a partially
valid bucket name.

Fixes: #6604
Backport: dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 08:58:59 -07:00
Josh Durgin
dd308cd481 rgw: move url escaping to a common place
This is useful outside of the s3 interface. Rename url_escape()
url_encode() for consistency with the exsting common url_decode()
function. This is in preparation for the next commit, which needs
to escape url-unsafe characters in another place.

Backport: dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 08:58:48 -07:00
Josh Durgin
e0e8fb1b2b rgw: update metadata log list to match data log list
Send the last marker whether the log is truncated in the same format
as data log list, so clients don't have more needless complexity
handling the difference.  Keep bucket index logs the same, since they
contain the marker already, and are not used in exactly the same way
metadata and data logs are.

Backport: dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 08:56:48 -07:00
Josh Durgin
c275912509 rgw: include marker and truncated flag in data log list api
Consumers of this api need to know their position in the log. It's
readily available when fetching the log, so return it.  Without the
marker in this call, a client could not easily or efficiently figure
out its position in the log, since it would require getting the global
last marker in the log, and then reading all the log entries.

This would be slow for large logs, and would be subject to races that
would cause potentially very expensive duplicate work.

Returning this atomically while fetching the log entries simplifies
all of this.

Fixes: #6615
Backport: dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 08:56:45 -07:00
Josh Durgin
e74776f417 cls_log: always return final marker from log_list
There's no reason to restrict returning the marker to the case where
less than the whole log is returned, since there's already a truncated
flag to tell the client what happened.

Giving the client the last marker makes it easy to consume when the
log entries do not contain their own marker. If the last marker is not
returned, the client cannot get the last marker without racing with
updates to the log.

Backport: dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-10-24 08:56:07 -07:00