Fix following warning from cppcheck:
[src/mds/Locker.cc:2255] -> [src/mds/Locker.cc:2258]: (error)
Possible null pointer dereference: in - otherwise it is redundant
to check it against null.
Since head_in used for call pick_inode_snap() is already valid,
there is no need to check if 'CInode *in' is not NULL. Remove
not needed check.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This is a common error and there's no reason the script can't
at least tell you it's a really bad idea. One might argue it
could even successfully proactively truncate the host parameter
at the first dot, but that's a little controlling, perhaps.
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Close out any connection with an old peer. This avoids a race like:
- peer marked down
- we get map, mark down the con
- they reconnect and try to send us some stuff
- we share our map to tell them they are old and dead, but leave the con
open
...
- peer marks itself up a few times, eventually reuses the same port
- sends messages on their fresh con
- we discard because of our old con
This could cause a tight reconnect loop, but it is better than wrong
behavior.
Other possible fixes:
- make addr nonce truly unique (augment pid in nonce)
- make a smarter 'disposable' msgr state (bleh)
Signed-off-by: Sage Weil <sage@inktank.com>
This avoids confusion with the OSD method of the same name, and better
matches what the function tests (and does not do).
Signed-off-by: Sage Weil <sage@inktank.com>
There is a separate clock skew check now, and more often than not this
suggests laggy messages, and not necessarily skew.
Signed-off-by: Sage Weil <sage@inktank.com>
- Promote len argument in dump_content_length to uint64_t.
- Make sure there is sufficient scratch space to format string.
- Use PRIu64 macro for formatting.
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Fixes: #4247
The list buckets operation was missing some attrs on the different
xml result entities. This fixes it.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
xml entities may have attrs assigned to them. Add the ability
to set them. A usage example:
formatter->open_array_section_with_attrs("container",
FormatterAttrs("name", "foo", NULL));
This will generate the following xml entity:
<container name="foo">
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
Fixes: #4363
Backport: argonaut, bobtail
When listing objects in namespace don't iterate through all the
objects, only go though the ones that starts with the namespace
prefix
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Add transaction flag indicating if op is at a replica
After write has been sync'ed use posix_fadvise() to clear kernel cache
Feature: #2733
Signed-off-by: David Zafman <david.zafman@inktank.com>
Reviewed-by: Sam Just <sam.just@inktank.com>
Functions called from RGWGetObj_ObjStore_S3::send_response_data may
change the value of the non-local variable 'ret'. But the response
relies on a local 'req_state' which copies ret at the start of the
function.
Right now none of the called functions actually changes ret so the
problem doesn't trigger, but to avoid future breakage it is safer
to not rely on the (early) copy of the ret variable.
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
After an MDS restart, the client will resend uncommitted requests. Use the
information we now have in the session_info_t to pass the created ino
back via the extra_bl payload in the reply.
Fixes: #4034
Signed-off-by: Sage Weil <sage@inktank.com>
Along with each session completed request (tid), also track the created
ino (if any). This will be used to pass back to the client when they
replay requests in the next patch.
Do not bother making this a backward compatible encoding. The only
benefit is to allow ceph-mds code to run and then old mds code to run
after it. Given all of the other incompat changes we *just* made, this
is highly unlikely and not worth the code clutter. If we had spanned
more releases or a stable release the story would be different.
While we are here, inline the second add_completed_request() method variant
since there is only a single caller and having it overloaded somewhat
obscures what is going on. This also avoids a duplicate lookup in the
session map in the have_session() check and then in the (old) helper.
Signed-off-by: Sage Weil <sage@inktank.com>
Even though these are "may_write" and may be a mutation, the MDS should not
fake out a traceless reply. In a real failure, it looks like:
- mds process request (mutation)
- mds fails
- client resends request
- mds notes that it is O_TRUNC, and already committed, and proceeds with
a regular open
And that is all fine.
But, that means that if we are trying to simulate this behavior without a
failure, then we should never do a traceless reply on an O_TRUNC request,
because the client will never see such a reply--it'll get a full open
request response instead.
Signed-off-by: Sage Weil <sage@inktank.com>
If a request is against a dentry, and we get a traceless reply, clear
the directory I_COMPLETE flag on the parent directory because we can no
longer trust that our cache is complete.
It is possible we could do something a bit more intelligent here, but it
is not trivial because of racing requests, and traceless replies are
rare, so it's not worth the effort.
Signed-off-by: Sage Weil <sage@inktank.com>
Use the new make_request functionality to ensure that we properly handle
the re-lookup/getattr when we get a traceless reply back from the MDS.
Note that we have to do this on setattr() because ll_getattr() expects to
return the updated inode metadata to the caller.
Signed-off-by: Sage Weil <sage@inktank.com>
Modify the generic make_request wrapper to retry lookups or getattrs on
requests when the ptarget pointer is specified but there is no trace in
the reply.
Refactor the _create() method to use this, effectively moving all of the
extra_bl code processing into make_request where it is generically
useful.
Signed-off-by: Sage Weil <sage@inktank.com>