Commit Graph

48964 Commits

Author SHA1 Message Date
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
Matt Benjamin
196ef76962 cohort_lru: fix a maybe uninitialized warning (that seems invalid)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:10 -05:00
Matt Benjamin
4a23f4c0b4 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>
2016-02-12 12:06:09 -05:00
Matt Benjamin
b94b51f9db 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>
2016-02-12 12:06:08 -05:00
Matt Benjamin
42fc51a4eb librgw: don't discard lookup result, fix signedness of min_size
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:07 -05:00
Matt Benjamin
13bc25a18b librgw: make_fhk put base name, object_name in wrong order
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:06 -05:00
Matt Benjamin
3e6e4ed25c librgw: add pseudo() accessor
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:05 -05:00
Matt Benjamin
fc505f4a12 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>
2016-02-12 12:06:04 -05:00
Matt Benjamin
33ee6d27bb librgw: make_fhk, compute object hashes path-wise
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:03 -05:00
Matt Benjamin
6691da0441 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>
2016-02-12 12:06:02 -05:00
Matt Benjamin
443e9c9c4a 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>
2016-02-12 12:06:01 -05:00
Matt Benjamin
cfc7a4f5ee librgw: fix abuse of std::string& in RGWDeleteObjRequest
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:00 -05:00
Matt Benjamin
80c85738d0 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>
2016-02-12 12:05:58 -05:00
Matt Benjamin
fbfafb3eee 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>
2016-02-12 12:05:57 -05:00
Matt Benjamin
5f4ef7edff 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>
2016-02-12 12:05:56 -05:00
Matt Benjamin
c480472f00 librgw: fix Unix file modes
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:55 -05:00
Matt Benjamin
4fd6511c19 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>
2016-02-12 12:05:54 -05:00
Matt Benjamin
6db1f9dd79 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>
2016-02-12 12:05:53 -05:00
Matt Benjamin
bf6bee6117 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>
2016-02-12 12:05:52 -05:00
Matt Benjamin
66823a06b6 librgw: don't abuse fs_private
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:51 -05:00
Matt Benjamin
857aa1e337 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>
2016-02-12 12:05:50 -05:00
Matt Benjamin
7f482c05b2 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>
2016-02-12 12:05:49 -05:00
Matt Benjamin
3c94a95ba5 librgw: handle a 3 cases in rgw_getattr
Only the object case is mostly correct.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:48 -05:00
Matt Benjamin
885a603adb librgw: handle rgw_lookup in the root (minimally)
In addition, check real return code from RGWStatRequest.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:47 -05:00
Matt Benjamin
fd8f20e820 librgw: change validity check for rgw_lookup
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:46 -05:00
Matt Benjamin
71590b8b34 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>
2016-02-12 12:05:44 -05:00
Matt Benjamin
0e5f5e2bcf librgw: add diagnostic dump_buckets() call.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:43 -05:00
Matt Benjamin
a5e6d559f0 librgw: fail RGWLibFS::authorize() on user-by-id lookup failure
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:42 -05:00
Matt Benjamin
0175a3d3a9 librgw: implement rgw_vfsstat
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:41 -05:00
Matt Benjamin
74e4c5ab38 librgw: rgw_mkdir and rgw_create return addresses
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:40 -05:00
Matt Benjamin
507ecab9ce librgw: pass struct rgw_fh_hk by reference
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:39 -05:00
Matt Benjamin
056c0cb812 librgw: always add struct before rgw_file_handle in rgw_file.h
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:05:38 -05:00