Commit Graph

48995 Commits

Author SHA1 Message Date
Matt Benjamin
eaf156397a librgw: move ObjUnref trace print ahead of...unref
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:04 -05:00
Matt Benjamin
1f2ec092f7 librgw: cleanup add_marker and handlers
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:03 -05:00
Matt Benjamin
e6eee9fa53 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>
2016-02-12 12:07:02 -05:00
Matt Benjamin
ef6367fc35 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>
2016-02-12 12:07:01 -05:00
Matt Benjamin
6147c3e526 librgw: fix RGWLibFS::stat_leaf ex-ref
Found verifying refcounts at RGWLibFS::close.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:00 -05:00
Matt Benjamin
9cf66708d9 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>
2016-02-12 12:06:59 -05:00
Matt Benjamin
562ebcbe38 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>
2016-02-12 12:06:58 -05:00
Matt Benjamin
066c2e8d00 librgw: remove dead code (rgw_readdir)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:57 -05:00
Matt Benjamin
00571a51e2 librgw: use correct finish path for RGWWriteRequest (logging and stats)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:56 -05:00
Matt Benjamin
e4b0c2be44 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>
2016-02-12 12:06:55 -05:00
Matt Benjamin
49a47d1d69 librgw: set iov->iov_len to nread (get)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:53 -05:00
Matt Benjamin
ea51474ab0 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>
2016-02-12 12:06:52 -05:00
Matt Benjamin
5d9e395cb0 librgw: update mtime on write finish
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:51 -05:00
Matt Benjamin
e08b8d67f7 librgw: -EISDIR
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:50 -05:00
Matt Benjamin
0090da6d49 librgw: check variant type, fix reversed check for write trans
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:49 -05:00
Matt Benjamin
3b795c1c09 librgw: finish write transactions in rgw_close path
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:48 -05:00
Matt Benjamin
a8f8c1a624 librgw: block in RGWWriteRequest::exec_continue
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:47 -05:00
Matt Benjamin
6e630d6924 librgw: block in RGWWriteRequest::exec_start
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:46 -05:00
Matt Benjamin
1c722bbcac librgw: wire up more of continuation
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:45 -05:00
Matt Benjamin
80bac65738 librgw: dont forget to call exec_start
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:44 -05:00
Matt Benjamin
6b798deb60 librgw: partial implementation of continued request framework
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:43 -05:00
Matt Benjamin
e3be0743f1 librgw_file_aw: re-enable write sequence
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:42 -05:00
Matt Benjamin
a27a4070b4 librgw: fix some incorrect uses of string temporary
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:40 -05:00
Matt Benjamin
5fe01703e7 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>
2016-02-12 12:06:39 -05:00
Matt Benjamin
4e5aef61f3 librgw: don't allow open on directories (externally)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:38 -05:00
Matt Benjamin
eb99b448b1 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>
2016-02-12 12:06:37 -05:00
Matt Benjamin
57938d8c7d 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>
2016-02-12 12:06:36 -05:00
Matt Benjamin
a420784253 librgw: fix and unify full-name assembly and hashing
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:35 -05:00
Matt Benjamin
46f82d7aba 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>
2016-02-12 12:06:34 -05:00
Matt Benjamin
b83ac0d945 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>
2016-02-12 12:06:33 -05:00
Matt Benjamin
6dba6924b1 librgw: remove unused string uri
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:32 -05:00
Matt Benjamin
589af39baf 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>
2016-02-12 12:06:31 -05:00
Matt Benjamin
821c562f0b librgw_file_nfsns: stage namespace traversal (fails)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:30 -05:00
Matt Benjamin
27c9a36065 librgw: initial librgw_file_nfsns.cc test
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:29 -05:00
Matt Benjamin
ba82ff805e librgw: add missing include deps (rgw_file.h)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:28 -05:00
Matt Benjamin
54dcf30cf1 librgw: fix parent chasing in make_fhk
Avoid an...infinite loop.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:26 -05:00
Matt Benjamin
f9173e89f2 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>
2016-02-12 12:06:25 -05:00
Matt Benjamin
4e9116ae52 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>
2016-02-12 12:06:24 -05:00
Matt Benjamin
33539db735 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>
2016-02-12 12:06:23 -05:00
Matt Benjamin
e53eb38ce2 librgw: implement stat_bucket, call from rgw_lookup
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:22 -05:00
Matt Benjamin
21bf277639 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>
2016-02-12 12:06:21 -05:00
Matt Benjamin
b9f306577a 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>
2016-02-12 12:06:20 -05:00
Matt Benjamin
1d17dcd926 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>
2016-02-12 12:06:19 -05:00
Matt Benjamin
06e2dad595 librgw: add marker processing to RGWListBucket(s)Request
Ignores object instances, for now.  Not verified.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:18 -05:00
Matt Benjamin
6e70b6deee 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>
2016-02-12 12:06:17 -05:00
Matt Benjamin
3ac44f9178 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>
2016-02-12 12:06:16 -05:00
Matt Benjamin
fcd432032f 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>
2016-02-12 12:06:15 -05:00
Matt Benjamin
103eda1c6f 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>
2016-02-12 12:06:14 -05:00
Matt Benjamin
5725721fe4 librgw: incr rework stat
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:12 -05:00
Matt Benjamin
3781027575 librgw: fix uninitialized rgw_fh
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:11 -05:00