]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
9 years agolibrgw: fix initialization of string_ref from temporary
Matt Benjamin [Sun, 20 Dec 2015 01:27:31 +0000 (20:27 -0500)]
librgw: fix initialization of string_ref from temporary

Found by valgrind.  The good news:  amounts to proof that the
sref notation works.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agocohort_lru: use correct new/delete operator pair
Matt Benjamin [Sat, 19 Dec 2015 23:32:42 +0000 (18:32 -0500)]
cohort_lru: use correct new/delete operator pair

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: move ObjUnref trace print ahead of...unref
Matt Benjamin [Sat, 19 Dec 2015 23:32:05 +0000 (18:32 -0500)]
librgw: move ObjUnref trace print ahead of...unref

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: cleanup add_marker and handlers
Matt Benjamin [Sat, 19 Dec 2015 22:45:07 +0000 (17:45 -0500)]
librgw: cleanup add_marker and handlers

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: rename RGWGetObjRequest, RGWListBucketRequest
Matt Benjamin [Sat, 19 Dec 2015 22:15:27 +0000 (17:15 -0500)]
librgw: rename RGWGetObjRequest, RGWListBucketRequest

The behavior of these requests is basically specific to the
needs of NFS READDIR and READ.  (RGWWriteRequest already updated.)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agocommon: add (tweaked) sstring.h
Matt Benjamin [Sat, 19 Dec 2015 21:01:44 +0000 (16:01 -0500)]
common: add (tweaked) sstring.h

Add sstring.h from Seastar, slightly adapted for c++2011 and
boost::string_ref.

An sstring resembles std::string, but the size of its small-string
optimization (static allocation) is controlled by a template
argument (cf. small_vector).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix RGWLibFS::stat_leaf ex-ref
Matt Benjamin [Sat, 19 Dec 2015 17:36:49 +0000 (12:36 -0500)]
librgw: fix RGWLibFS::stat_leaf ex-ref

Found verifying refcounts at RGWLibFS::close.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolirgw: call RGWLibFS::close in rgw_umount
Matt Benjamin [Sat, 19 Dec 2015 16:34:08 +0000 (11:34 -0500)]
lirgw: call RGWLibFS::close in rgw_umount

Also remove an unused warning in currently-disabled rgw_readv.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement LRU lifecycle for handles
Matt Benjamin [Fri, 18 Dec 2015 05:11:38 +0000 (00:11 -0500)]
librgw: implement LRU lifecycle for handles

This re-uses intrusive lane LRU and co-resident intrusive b-tree
for lookups (formerly, we were using just the dictionary).

Machinery for cache drain on unmount/release of an active filesystem
instance has been added.  Currently, this code won't be reached.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove dead code (rgw_readdir)
Matt Benjamin [Fri, 18 Dec 2015 00:46:57 +0000 (19:46 -0500)]
librgw: remove dead code (rgw_readdir)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: use correct finish path for RGWWriteRequest (logging and stats)
Matt Benjamin [Fri, 18 Dec 2015 00:42:38 +0000 (19:42 -0500)]
librgw: use correct finish path for RGWWriteRequest (logging and stats)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: update posix-style read path
Matt Benjamin [Thu, 17 Dec 2015 22:32:25 +0000 (17:32 -0500)]
librgw: update posix-style read path

Update RGWGetObj to take ulp buffer rather than transferring the
elements of a buffer::list and re-traversing it.

This breaks the readv variant, but that was not final.  What it
fixes is offset handling.

Also, skip CREATE_BUCKET if not requested, in librgw_file_aw.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: set iov->iov_len to nread (get)
Matt Benjamin [Thu, 17 Dec 2015 21:23:44 +0000 (16:23 -0500)]
librgw: set iov->iov_len to nread (get)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: sequential rgw_write works
Matt Benjamin [Thu, 17 Dec 2015 19:54:26 +0000 (14:54 -0500)]
librgw: sequential rgw_write works

This commit finishes hooking up RGWWriteRequest, and its supporting
RGWLibContinuedRequest.

The rgw_read call now fails--trivially, because it never handled
starting offset correctly.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: update mtime on write finish
Matt Benjamin [Thu, 17 Dec 2015 15:25:12 +0000 (10:25 -0500)]
librgw: update mtime on write finish

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: -EISDIR
Matt Benjamin [Wed, 16 Dec 2015 16:08:02 +0000 (11:08 -0500)]
librgw: -EISDIR

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: check variant type, fix reversed check for write trans
Matt Benjamin [Wed, 16 Dec 2015 16:06:29 +0000 (11:06 -0500)]
librgw: check variant type, fix reversed check for write trans

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: finish write transactions in rgw_close path
Matt Benjamin [Wed, 16 Dec 2015 15:56:24 +0000 (10:56 -0500)]
librgw: finish write transactions in rgw_close path

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: block in RGWWriteRequest::exec_continue
Matt Benjamin [Tue, 15 Dec 2015 22:28:50 +0000 (17:28 -0500)]
librgw: block in RGWWriteRequest::exec_continue

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: block in RGWWriteRequest::exec_start
Matt Benjamin [Tue, 15 Dec 2015 21:48:41 +0000 (16:48 -0500)]
librgw: block in RGWWriteRequest::exec_start

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: wire up more of continuation
Matt Benjamin [Tue, 15 Dec 2015 03:10:29 +0000 (22:10 -0500)]
librgw: wire up more of continuation

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: dont forget to call exec_start
Matt Benjamin [Tue, 15 Dec 2015 00:27:03 +0000 (19:27 -0500)]
librgw: dont forget to call exec_start

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: partial implementation of continued request framework
Matt Benjamin [Tue, 15 Dec 2015 00:19:41 +0000 (19:19 -0500)]
librgw: partial implementation of continued request framework

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file_aw: re-enable write sequence
Matt Benjamin [Mon, 14 Dec 2015 20:55:46 +0000 (15:55 -0500)]
librgw_file_aw: re-enable write sequence

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix some incorrect uses of string temporary
Matt Benjamin [Mon, 14 Dec 2015 20:31:55 +0000 (15:31 -0500)]
librgw: fix some incorrect uses of string temporary

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add initial atomic write unit test
Matt Benjamin [Mon, 14 Dec 2015 19:16:30 +0000 (14:16 -0500)]
librgw: add initial atomic write unit test

Tests are focused on open-write-close, open-read-close sequences.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: don't allow open on directories (externally)
Matt Benjamin [Mon, 14 Dec 2015 17:16:08 +0000 (12:16 -0500)]
librgw: don't allow open on directories (externally)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: restrict objects to single-open
Matt Benjamin [Mon, 14 Dec 2015 16:27:10 +0000 (11:27 -0500)]
librgw: restrict objects to single-open

this is the simplest consistent model for an open-write-close
transaction (and it reads stable)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix last enumeration bug, move tracing to debug
Matt Benjamin [Fri, 11 Dec 2015 21:19:57 +0000 (16:19 -0500)]
librgw: fix last enumeration bug, move tracing to debug

The last issue with enumeration was caused by inserting objects
into handle cache with their key-ified full_object_name()--this
should be the base name.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix and unify full-name assembly and hashing
Matt Benjamin [Fri, 11 Dec 2015 16:39:00 +0000 (11:39 -0500)]
librgw: fix and unify full-name assembly and hashing

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: incremental listing fixes
Matt Benjamin [Fri, 11 Dec 2015 02:33:01 +0000 (21:33 -0500)]
librgw: incremental listing fixes

* remove path in RGWStatLeafRequest--use bool is_dir instead
* remove unused uri in RGWListBucketRequest
* more dbg prints; problem w/final segment in obj_rec

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: incremental enumeration progress
Matt Benjamin [Thu, 10 Dec 2015 23:13:27 +0000 (18:13 -0500)]
librgw: incremental enumeration progress

As of this change, enumeration is -almost- correct, but the
rules for name, object_name(), and full_object_name() need to be
checked.

The rationale for storing just the last component name in dirents
means that name can't ever have the form "foo/bar" (make sure it
doesn't).  But there may still be code which assumes name ==
object_name() OR assumes object_name() is hashable (it isn't, that
has to be the full object name).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove unused string uri
Matt Benjamin [Thu, 10 Dec 2015 21:27:13 +0000 (16:27 -0500)]
librgw: remove unused string uri

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: namespace bugfixes
Matt Benjamin [Thu, 10 Dec 2015 21:12:37 +0000 (16:12 -0500)]
librgw: namespace bugfixes

1. stat_leaf() and stat_bucket() require RGWFileHandle::FLAG_CREATE
2. refactor RGWStatLeafRequest on the model of RGWListBucketRequest
3. fix uses of is_object() which meant is_file()
4. fix parent_fh passing

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file_nfsns: stage namespace traversal (fails)
Matt Benjamin [Thu, 10 Dec 2015 18:55:56 +0000 (13:55 -0500)]
librgw_file_nfsns: stage namespace traversal (fails)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: initial librgw_file_nfsns.cc test
Matt Benjamin [Thu, 10 Dec 2015 17:43:00 +0000 (12:43 -0500)]
librgw: initial librgw_file_nfsns.cc test

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add missing include deps (rgw_file.h)
Matt Benjamin [Thu, 10 Dec 2015 16:24:24 +0000 (11:24 -0500)]
librgw: add missing include deps (rgw_file.h)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix parent chasing in make_fhk
Matt Benjamin [Thu, 10 Dec 2015 02:10:03 +0000 (21:10 -0500)]
librgw: fix parent chasing in make_fhk

Avoid an...infinite loop.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix last-of marker detection
Matt Benjamin [Thu, 10 Dec 2015 02:01:11 +0000 (21:01 -0500)]
librgw: fix last-of marker detection

Add the count of common_prefixes to the existing listing size, rather
than overwriting it, else size cannot be compared w/ix.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: unify result cases in rgw_mkdir
Matt Benjamin [Thu, 10 Dec 2015 01:25:22 +0000 (20:25 -0500)]
librgw: unify result cases in rgw_mkdir

In both paths, instantiate a file handle iff the remote op
succeeded.

If this operation lost a race to create an object with the same
name, we cannot correctly return a valid result and handle in all
cases, so don't attempt it.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: RGWListBucketRequest and related bugfixes
Matt Benjamin [Wed, 9 Dec 2015 22:24:04 +0000 (17:24 -0500)]
librgw: RGWListBucketRequest and related bugfixes

1. instantiate handles as required in RGWLibFS::stat_bucket
2. fix bucket_name() when bucket
3. fix full_object_name(), which should not return paths w/buckets
   by default (allow doing so by passing non-default depth)
4. fix uri, prefix, and delimiter logic
5. add logic to parse and forward common_prefixes

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement stat_bucket, call from rgw_lookup
Matt Benjamin [Wed, 9 Dec 2015 19:58:35 +0000 (14:58 -0500)]
librgw: implement stat_bucket, call from rgw_lookup

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: annotate unlink's rgw_lookup
Matt Benjamin [Wed, 9 Dec 2015 17:47:34 +0000 (12:47 -0500)]
librgw: annotate unlink's rgw_lookup

An rgw_lookup w/RGW_LOOKUP_FLAG_NONE will return an existing (hence
validated, modulo CREATE races) handle, but fail with ENOENT if none
exists (which is the desired behavior).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add lookup step in rgw_unlink
Matt Benjamin [Wed, 9 Dec 2015 16:18:19 +0000 (11:18 -0500)]
librgw: add lookup step in rgw_unlink

Implement the required check for underlying leaf object, since with
the current signature it is not known.

(Is that a fixed requirement? If we have previously done a lookup, we
already know the underlying object by name and type.)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: hide uri in RGWListBucketRequest, use full_objectname()
Matt Benjamin [Wed, 9 Dec 2015 16:04:39 +0000 (11:04 -0500)]
librgw: hide uri in RGWListBucketRequest, use full_objectname()

Really would like to remove the requirement to format a URI for these
requests, since it is merely taken apart in parsing before execution.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add marker processing to RGWListBucket(s)Request
Matt Benjamin [Tue, 8 Dec 2015 23:52:46 +0000 (18:52 -0500)]
librgw: add marker processing to RGWListBucket(s)Request

Ignores object instances, for now.  Not verified.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: reimplement RGWLibFS::stat_leaf
Matt Benjamin [Tue, 8 Dec 2015 21:18:50 +0000 (16:18 -0500)]
librgw: reimplement RGWLibFS::stat_leaf

Now the code attempts to read an object header (which may be cached),
and if this fails, uses RGWStatLeafRequest to find a potential matching
file or directory leaf.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: variant handle subtype and marker cache
Matt Benjamin [Mon, 7 Dec 2015 14:38:58 +0000 (09:38 -0500)]
librgw: variant handle subtype and marker cache

RGWFileHandle gets a type-specific variant part.  For the directory
variant, define a flat_map of cookie to marker.  Hash dirent names and
update the marker_cache in readdirs.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: create dir file handles w/correct type
Matt Benjamin [Sun, 6 Dec 2015 21:39:35 +0000 (16:39 -0500)]
librgw: create dir file handles w/correct type

RGW objects which happen to represent directories will always end
in '/', but the trailing slash will not be present in cached versions
of the name.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement RGWLibFS::stat_leaf
Matt Benjamin [Sun, 6 Dec 2015 19:25:24 +0000 (14:25 -0500)]
librgw: implement RGWLibFS::stat_leaf

Stats one of <object>, <object/>.   Additional control over handle
creation has been added to RGWLibFS::lookup_fh.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: incr rework stat
Matt Benjamin [Wed, 2 Dec 2015 15:44:19 +0000 (10:44 -0500)]
librgw: incr rework stat

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix uninitialized rgw_fh
Matt Benjamin [Wed, 2 Dec 2015 02:04:40 +0000 (21:04 -0500)]
librgw: fix uninitialized rgw_fh

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agocohort_lru: fix a maybe uninitialized warning (that seems invalid)
Matt Benjamin [Tue, 1 Dec 2015 20:22:12 +0000 (15:22 -0500)]
cohort_lru: fix a maybe uninitialized warning (that seems invalid)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: create explicit directory leaf objects in rgw_mkdir
Matt Benjamin [Tue, 1 Dec 2015 18:05:50 +0000 (13:05 -0500)]
librgw: create explicit directory leaf objects in rgw_mkdir

There is some asymmetry here, since directories are also inferred
from object names containing embedded "/."

The obvious question seems to be, "when can a leaf directory be
garbage collected?"  The answer seems to be, "only explicitly."

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: consolidate RGWLib RGWOps into RGWRequest
Matt Benjamin [Tue, 1 Dec 2015 17:50:51 +0000 (12:50 -0500)]
librgw: consolidate RGWLib RGWOps into RGWRequest

The intermediate derivation mirrored that in RGWRest, but we
don't seem to need it.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: don't discard lookup result, fix signedness of min_size
Matt Benjamin [Tue, 1 Dec 2015 17:34:33 +0000 (12:34 -0500)]
librgw: don't discard lookup result, fix signedness of min_size

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: make_fhk put base name, object_name in wrong order
Matt Benjamin [Mon, 30 Nov 2015 22:15:19 +0000 (17:15 -0500)]
librgw: make_fhk put base name, object_name in wrong order

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add pseudo() accessor
Matt Benjamin [Mon, 30 Nov 2015 22:00:21 +0000 (17:00 -0500)]
librgw: add pseudo() accessor

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add pseudofs awareness to lookup_fh
Matt Benjamin [Mon, 30 Nov 2015 21:55:27 +0000 (16:55 -0500)]
librgw: add pseudofs awareness to lookup_fh

And then allow rgw_mkdir() to create pseudofs vnodes, when parent
is not the root.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: make_fhk, compute object hashes path-wise
Matt Benjamin [Mon, 30 Nov 2015 18:48:25 +0000 (13:48 -0500)]
librgw: make_fhk, compute object hashes path-wise

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add depth and make_path to RGWFileHandle
Matt Benjamin [Mon, 30 Nov 2015 17:29:39 +0000 (12:29 -0500)]
librgw: add depth and make_path to RGWFileHandle

This just (mostly) efficiently builds a full path from its segments
on demand.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: compress RGWFileHandle stat data
Matt Benjamin [Wed, 25 Nov 2015 03:14:37 +0000 (22:14 -0500)]
librgw: compress RGWFileHandle stat data

Just save the state we actually mutate, and fill stat structures
on demand.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix abuse of std::string& in RGWDeleteObjRequest
Matt Benjamin [Thu, 12 Nov 2015 19:55:36 +0000 (14:55 -0500)]
librgw: fix abuse of std::string& in RGWDeleteObjRequest

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix rgw_unlink
Matt Benjamin [Thu, 12 Nov 2015 18:53:38 +0000 (13:53 -0500)]
librgw: fix rgw_unlink

Fix handling of bucket namespace, remove bogus RGWLibFS::is_root()
logic.  Also remove a stray debug check.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: ok, make RGW vnodes cache Unix attrs
Matt Benjamin [Thu, 12 Nov 2015 16:55:37 +0000 (11:55 -0500)]
librgw: ok, make RGW vnodes cache Unix attrs

Ganesa ULP needs to see a sane progression of attrs in the CREATE
path.

With this change shell actions like

$ echo "hi" > /nfs41/mybucket/mom

work as expected.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: forge Unix attrs in rgw_create
Matt Benjamin [Thu, 12 Nov 2015 15:32:12 +0000 (10:32 -0500)]
librgw: forge Unix attrs in rgw_create

Possibly RGW vnodes should cache Unix attrs, it would reduce the
latency of (frequent) getattr calls, and eventually lines up with
more materialized Unix attributes.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix Unix file modes
Matt Benjamin [Wed, 11 Nov 2015 22:30:00 +0000 (17:30 -0500)]
librgw: fix Unix file modes

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement rgw_create + bugfixes
Matt Benjamin [Tue, 10 Nov 2015 20:51:04 +0000 (15:51 -0500)]
librgw: implement rgw_create + bugfixes

Incremental work to support CREATE,OPEN,WRITE*,CLOSE transactions.
Adds a new tuple-based signature for RGWFileHandle::lookup_fh, and
fixes an inconsisten initialization of fhk and fh.fh_hk.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix size computation in RGWStatObjRequest
Matt Benjamin [Tue, 10 Nov 2015 16:40:43 +0000 (11:40 -0500)]
librgw: fix size computation in RGWStatObjRequest

Overrides RGWGetObj::execute(), calls the parent method and then
saves obj_size from the manifest.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix many rgw_file return codes
Matt Benjamin [Tue, 10 Nov 2015 14:23:06 +0000 (09:23 -0500)]
librgw: fix many rgw_file return codes

This should all be -(POSIX), or at any rate negative.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: don't abuse fs_private
Matt Benjamin [Tue, 10 Nov 2015 00:19:52 +0000 (19:19 -0500)]
librgw: don't abuse fs_private

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: introduce RGW_LOOKUP_FLAG_CREATE
Matt Benjamin [Sun, 8 Nov 2015 23:54:58 +0000 (18:54 -0500)]
librgw: introduce RGW_LOOKUP_FLAG_CREATE

The current API relies on rgw_lookup and rgw_lookup_filehandle to
return file handle instances, and like POSIX, needs to deal in some
way with the NFS/POSIX open-for-create concept.

For now, allow rgw_lookup to return the canonical instance for an
object being created, i.e., if the option RGW_LOOKUP_FLAG_CREATE
is passed.  (I added an RGW_OPEN_FLAG_CREATE also, but it doesn't
do anything.)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add getattr unit tests, restructure
Matt Benjamin [Sun, 8 Nov 2015 23:11:37 +0000 (18:11 -0500)]
librgw: add getattr unit tests, restructure

The fids1, fids2 vectors were confusing, as fids2 mapped the
objects in the union of all buckets.

Now there's a matrix of <bucket,object>, and it's trivial to
scan the objects in any one bucket.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: handle a 3 cases in rgw_getattr
Matt Benjamin [Sun, 8 Nov 2015 01:40:51 +0000 (20:40 -0500)]
librgw: handle a 3 cases in rgw_getattr

Only the object case is mostly correct.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: handle rgw_lookup in the root (minimally)
Matt Benjamin [Sun, 8 Nov 2015 01:06:08 +0000 (20:06 -0500)]
librgw: handle rgw_lookup in the root (minimally)

In addition, check real return code from RGWStatRequest.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: change validity check for rgw_lookup
Matt Benjamin [Sat, 7 Nov 2015 21:18:18 +0000 (16:18 -0500)]
librgw: change validity check for rgw_lookup

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add RGWStatObjRequest and use it
Matt Benjamin [Sat, 7 Nov 2015 20:46:52 +0000 (15:46 -0500)]
librgw: add RGWStatObjRequest and use it

* implement a stat operation over RGWGetObj (returning early)
* use stat to validate rgw_lookup
* use stat to implement rgw_getattr

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add diagnostic dump_buckets() call.
Matt Benjamin [Fri, 6 Nov 2015 21:55:57 +0000 (16:55 -0500)]
librgw: add diagnostic dump_buckets() call.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fail RGWLibFS::authorize() on user-by-id lookup failure
Matt Benjamin [Fri, 6 Nov 2015 21:55:15 +0000 (16:55 -0500)]
librgw: fail RGWLibFS::authorize() on user-by-id lookup failure

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement rgw_vfsstat
Matt Benjamin [Thu, 5 Nov 2015 16:09:24 +0000 (11:09 -0500)]
librgw: implement rgw_vfsstat

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: rgw_mkdir and rgw_create return addresses
Matt Benjamin [Thu, 5 Nov 2015 15:15:41 +0000 (10:15 -0500)]
librgw: rgw_mkdir and rgw_create return addresses

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: pass struct rgw_fh_hk by reference
Matt Benjamin [Wed, 4 Nov 2015 23:26:11 +0000 (18:26 -0500)]
librgw: pass struct rgw_fh_hk by reference

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: always add struct before rgw_file_handle in rgw_file.h
Matt Benjamin [Wed, 4 Nov 2015 22:51:24 +0000 (17:51 -0500)]
librgw: always add struct before rgw_file_handle in rgw_file.h

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: bring back lookup_handle()
Matt Benjamin [Wed, 4 Nov 2015 21:20:45 +0000 (16:20 -0500)]
librgw: bring back lookup_handle()

Now as a member of RGWLibFS, and exposed via rgw_lookup_handle()
for use by library clients.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file_gp: check test state before closing null fh handle
Matt Benjamin [Wed, 4 Nov 2015 17:48:03 +0000 (12:48 -0500)]
librgw_file_gp: check test state before closing null fh handle

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement intrusive filehandle cache
Matt Benjamin [Tue, 3 Nov 2015 01:31:53 +0000 (20:31 -0500)]
librgw: implement intrusive filehandle cache

The cache is keyed on a hash of bucket name, plus a hash of the
object name.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add common/cohort_lru.h
Matt Benjamin [Mon, 2 Nov 2015 19:41:26 +0000 (14:41 -0500)]
librgw: add common/cohort_lru.h

This a cache-line-friendly set of primitives for

a) shareded, intrusive maps based on boost::intrusive
b) an LRU system based on them

The system uses per-lane (shard) locks.  Lane count, front cache
size, and lock type are template params.

Initially, use this in preference to an unshareded map or hashtable,
in new RGW code.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file: release file handles
Matt Benjamin [Sat, 31 Oct 2015 00:26:58 +0000 (20:26 -0400)]
librgw_file: release file handles

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file_gp: don't leak a buffer::list
Matt Benjamin [Fri, 30 Oct 2015 21:41:39 +0000 (17:41 -0400)]
librgw_file_gp: don't leak a buffer::list

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: checksum verify writev/readv read-after-write
Matt Benjamin [Fri, 30 Oct 2015 21:27:22 +0000 (17:27 -0400)]
librgw: checksum verify writev/readv read-after-write

The changes to GET_OBJECT and PUT_OBJECT test options are needed,
since they are (re) writing the same object.

Sadly, READV_AFTER_WRITEV is failing at page offset 7.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: really make hexdump optional, set resid in readv unit test
Matt Benjamin [Fri, 30 Oct 2015 20:19:35 +0000 (16:19 -0400)]
librgw: really make hexdump optional, set resid in readv unit test

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix 2 dout problems
Matt Benjamin [Fri, 30 Oct 2015 17:28:25 +0000 (13:28 -0400)]
librgw: fix 2 dout problems

* rgw_file.cc needed to include include/assert.h AFTER all rgw
  includes, for some reason

* use *_dout syntax as target of bl.hexdump in lbrgw_file_gp.cc

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: try-implement rgw_readv/rgw_writev
Matt Benjamin [Thu, 29 Oct 2015 22:03:16 +0000 (18:03 -0400)]
librgw: try-implement rgw_readv/rgw_writev

The model in the rgw_readv call is the caller owns the struct rgw_uio,
and uses it to pass uio_offset.

The caller returns the rgw_uio filled out, and provides indirectly
rgw_uio->uio_vio (the full private data is at uio->uio_p1 on return,
the caller (p==private) must not touch it.  The caller returns
private data in rgw_readv_release() when finished.

Meanwhile rgw_writev is atomic.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: improve rgw_write and add WRITE_READ_VERIFY
Matt Benjamin [Thu, 29 Oct 2015 18:58:47 +0000 (14:58 -0400)]
librgw: improve rgw_write and add WRITE_READ_VERIFY

Update rgw_write to return bytes written as an OUT argument,
use and verify in PUT test.

A new WRITE_READ_VERIFY test writes 16 checksummed, 64K data pages
to the object when --bulk specified.  The returned write value is
checked, but pages not re-read (yet).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove junk prints
Matt Benjamin [Thu, 29 Oct 2015 16:42:31 +0000 (12:42 -0400)]
librgw: remove junk prints

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: set RGWGetObj::get_data = true, for great justice
Matt Benjamin [Thu, 29 Oct 2015 16:36:19 +0000 (12:36 -0400)]
librgw: set RGWGetObj::get_data = true, for great justice

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: rework library CephContext* and init
Matt Benjamin [Thu, 29 Oct 2015 15:49:06 +0000 (11:49 -0400)]
librgw: rework library CephContext* and init

Remove duplicated init step.  Just reference the global
Ceph context for the library instance(s).

The immediate effect of this is to bring the (correctly initialized)
global context into all call paths, which (e.g.) fixes debug
log prints within subsystems.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: dispatch RGWDeleteRequest in object branch in rgw_unlink().
Matt Benjamin [Wed, 28 Oct 2015 23:10:10 +0000 (19:10 -0400)]
librgw: dispatch RGWDeleteRequest in object branch in rgw_unlink().

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement RGWGetObjRequest
Matt Benjamin [Wed, 28 Oct 2015 21:53:06 +0000 (17:53 -0400)]
librgw: implement RGWGetObjRequest

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: declare RGWDeleteObjRequest
Matt Benjamin [Tue, 27 Oct 2015 21:57:13 +0000 (17:57 -0400)]
librgw: declare RGWDeleteObjRequest

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>