Matt Benjamin [Thu, 14 Jan 2016 22:25:45 +0000 (17:25 -0500)]
librgw: fix timestamp on create (another case)
In the rgw_create regular file case, the timestamp and size update
logic (though present) was being bypassed because the "FLAG_CREATE"
indicator which formerly propagated up from RGWLibFS::lookup_fh
was lost in the LRU change, which refactored the code for creating
new RGWFileHandle objects.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Matt Benjamin [Thu, 14 Jan 2016 16:38:24 +0000 (11:38 -0500)]
librgw: add missing RGWFileHandle::stat in rgw_mkdir
The lack of stat here induced a serious memory corruption, due to
the organization of Ganesha file attributes (and their reliance on
the FSAL to initialize the memory).
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Matt Benjamin [Tue, 12 Jan 2016 23:21:56 +0000 (18:21 -0500)]
librgw: fix leading-slash special case, again
Fix boilerplate to sanitize relative_object_name() in rgw_create
as well as the RGWStatObjRequest case of RGWLibFS::stat_leaf. Signed-off-by: Matt Benjamin <mbenjamin@redhat.com> Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Rewrite rgw_getattr to just dispatch into RGWLibFS::getattr, where
we can better use RGWFileHandle and RGWLibFS internals.
Initially, this change intended to dispatch a new RGWStatObjRequest
in the file case, but during implementation, discovered that in
(apparently) all file cases, it has already been done--but the path
had stopped working with the naming change.
Current GETATTR_DIRS1 unit test, when repeated so relying on lookup
(rather than saving size after rgw_write/rgw_close), passes.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Matt Benjamin [Thu, 7 Jan 2016 01:57:36 +0000 (20:57 -0500)]
librgw: likely correct marker handling
New logic propagates is_truncated traveral-finished indicator up
from bucket and object list operations in all cases, and correctly
expands relative paths.
Unit test output looks promising.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Matt Benjamin [Wed, 6 Jan 2016 00:03:49 +0000 (19:03 -0500)]
librgw: rework full_object_name() and friends
Flex RGWFileHandle::full_object_name() to build either a search
prefix (omits leading "/" and bucket name) or else the full path
to the root (e.g., for pretty-printing), depending on the value
of a boolean omit_bucket argument.
New convenience methods search_prefix() and relative_object_name()
select these, respectively.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Matt Benjamin [Tue, 5 Jan 2016 17:26:36 +0000 (12:26 -0500)]
librgw: add continued readdir test
Verify that files created in a single, large directory are correctly
enumerated through a sequence of rgw_readdir() calls, at successive
offsets checking cookie/marker and bounds invariants.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Matt Benjamin [Thu, 24 Dec 2015 17:45:16 +0000 (12:45 -0500)]
librgw: dir traversal state GC added
To minimize overhead, traversal events are modeled as a linear
sequence of fh_key, timestamp tuples. GC operates out-of-line in
LIFO order, and includes a ref cycle. If the matching directory
object can't be found by handle, it's already gone, and nothing
happens.
To avoid lock contention, scanning of the event sequence is done
in groups of 24 by default, but in groups of sequence/4 if the
event sequence grows larger than 500 events.
Push READDIR events on successful component readdir (bucket or
object listing partial result, as appropriate).
Revise locking, timestamp and update link count in all cases. Link
counts are approximate (metadata to represent it is not stored).
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
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>
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>
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>
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>
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>
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>
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>
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>