Sam Lang [Wed, 26 Sep 2012 02:11:45 +0000 (19:11 -0700)]
client: Fix coverity 716909 [FORWARD_NULL]
If we fill the request path from the dentry instead of the inode, we
need to use the dentry inode. This fixes a segfault that would occur
in the case where request->inode is in fact null.
Sam Lang [Tue, 25 Sep 2012 16:13:26 +0000 (09:13 -0700)]
client: Fixes coverity defect 716891
Fix for coverity defect 716891 [DEADCODE] in
Client::encode_dentry_release where the released var is initialized
to 0, but never set, so the pre-emptive release of the dentry
capability (if requested by the drop flag) never happens.
Sam Lang [Tue, 25 Sep 2012 16:07:00 +0000 (09:07 -0700)]
client: Fixes coverity defect 716890 [DEADCODE]
In choose_target_mds, the mds number is initialized to 0 and
then a separate target mds number is chosen based on the inode
set in the request. If the inode isn't set, we drop to choosing
a random mds, but only if the mds number is < 0, which doesn't
happen with the initialize to 0. This fix initializes the mds
number to -1, ensuring a random mds is chosen.
Sam Lang [Tue, 25 Sep 2012 14:03:57 +0000 (07:03 -0700)]
cephfs: Fixes for coverity bugs 716840 and 716970
Fixes for two coverity bugs in cephfs.cc.
716840 (CHECKED_RETURN) reported that the return value from
fstat wasn't getting checked. It now is checked, reports an
error and returns to the caller.
716970 (NEGATIVE_RETURNS) reported that the file descriptor passed
to fstat (*fd) might be negative, which isn't allowed. The check at
the top that open failed wasn't aborting the function (when *fd < 0),
now it does.
Sam Lang [Mon, 24 Sep 2012 16:55:25 +0000 (09:55 -0700)]
client: Fix for #3184 cfuse segv with no keyring
Fixes bug #3184 where the ceph-fuse client segfaults if authx is
enabled but no keyring file is present. This was due to the
client->init() return value not getting checked.
Sage Weil [Sat, 22 Sep 2012 05:20:09 +0000 (22:20 -0700)]
mds: fix ino release on session close
If we project an inode release, we need to follow through, even if for
some reason we decide to keep the session active. Clear out the session
interval_sets in case that happens.
Fixes: #1677 Signed-off-by: Sage Weil <sage@inktank.com>
Sam Lang [Wed, 26 Sep 2012 00:55:05 +0000 (17:55 -0700)]
mds: Handle empty relpath from client getattr
A bug in the client (see 2b54391) results in an empty relpath on
a lookup request. This causes a segfault in the mds, because the
getattr logic expects a lookup to have a relpath to place in the
response. The fix here ensures that lookups include a non-empty
relpath, o.w. aborting the request and returning -EINVAL to the
client.
Sam Lang [Tue, 25 Sep 2012 21:48:32 +0000 (14:48 -0700)]
client: Fix to client filepath initializing
The filepath constructor that takes a const char * is missing the
initializer for the encoded member. This results in uninitialized
memory, so the encoded field is sometimes true, resulting in mds
crashes (see #3186) and client errors with empty components in path
names. This commit fixes #3186 and #2285.
C_aio_sparse_read_Ack's members are filled in by the only caller
immediately after construction, so make them arguments to the
constructor.
CID 717218: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "m" is not initialized in this
constructor nor in any functions that it calls.
WatchContext: these variables are unused, so remove them.
CID 717217: Uninitialized scalar field (UNINIT_CTOR)
At (4): Non-static class member "ver" is not initialized in this
constructor nor in any functions that it calls.
CID 716962: Missing break in switch (MISSING_BREAK)
At (1): This case (value 109) is not terminated by a 'break'
statement. # (use "git add <file>..." to update what will be
committed)
CID 716937: Overflowed return value (INTEGER_OVERFLOW)
At (3): Overflowed or truncated value (or a value computed from an
overflowed or truncated value) "offset" used as return value.
mds: Adjust mydir auth when starting MDS that was stopped cleanly
When starting a MDS that was stopped cleanly, we need manually
adjust mydir's auth. This is because MDS log is empty in this case,
mydir's auth can not be adjusted during log replay.
librados: fix use without NULL check in rados_pool_list
CID 716911: Dereference after null check (FORWARD_NULL)
At (5): Passing null pointer "b" to function "strncat(char *, char
const *, size_t)", which dereferences it. (The dereference is assumed
on the basis of the 'nonnull' parameter attribute.)
librados: init everything in default IoCtxImpl ctor
CID 717219: Uninitialized pointer field (UNINIT_CTOR)
At (14): Non-static class member "objecter" is not initialized in this
constructor nor in any functions that it calls.
rbd: make sure we have a device before trying to unmap
CID 717444: Explicit null dereferenced (FORWARD_NULL)
At (48): Passing null pointer "devpath" to function
"do_kernel_rm(char const *)", which dereferences it.
Order is never actually this high currently, but it be via librbd.
CID 716937: Overflowed return value (INTEGER_OVERFLOW)
At (3): Overflowed or truncated value (or a value computed from an
overflowed or truncated value) "offset" used as return value.
CID 717012: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << obj_order" with type
"int" (32 bits, signed) is evaluated using 32-bit arithmetic before
being used in a context which expects an expression of type "uint64_t"
(64 bits, unsigned). To avoid overflow, cast the left operand to
"uint64_t" before performing the left shift.
CID 717011: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << order" with type
"int" (32 bits, signed) is evaluated using 32-bit arithmetic before
being used in a context which expects an expression of type "uint64_t"
(64 bits, unsigned). To avoid overflow, cast the left operand to
"uint64_t" before performing the left shift.
CID 717013: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << order" with type
"int" (32 bits, signed) is evaluated using 32-bit arithmetic before
being used in a context which expects an expression of type "uint64_t"
(64 bits, unsigned). To avoid overflow, cast the left operand to
"uint64_t" before performing the left shift.
CID 717226: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "cookie" is not initialized in this
constructor nor in any functions that it calls.
librbd: init m_req in LibrbdWriteback::C_Read ctor
CID 717225: Uninitialized pointer field (UNINIT_CTOR)
At (2): Non-static class member "m_req" is not initialized in this
constructor nor in any functions that it calls.
librbd: initialize on-disk header in ImageCtx ctor
CID 717224: Uninitialized scalar field (UNINIT_CTOR)
At (26): Non-static class member field "header.snaps" is not
initialized in this constructor nor in any functions that it calls.
librbd: init everything in default AioRequest constructors
CID 717222: Uninitialized pointer field (UNINIT_CTOR)
At (16): Non-static class member "m_hide_enoent" is not initialized
in this constructor nor in any functions that it calls.
CID 717223: Uninitialized scalar field (UNINIT_CTOR)
At (4): Non-static class member "m_has_parent" is not initialized in
this constructor nor in any functions that it calls.
CID 717220: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "aio_type" is not initialized in this
constructor nor in any functions that it calls.
CID 717221: Uninitialized pointer field (UNINIT_CTOR)
At (2): Non-static class member "m_req" is not initialized in this
constructor nor in any functions that it calls.
Sage Weil [Thu, 20 Sep 2012 17:14:24 +0000 (10:14 -0700)]
msg/Accepter: fix race in accepter shutdown
We want to avoid a race like:
- entry() starts, populates pfd with listen_sd, gets past !done check
- stop() does shutdown + close on listen_sd
- someone else opens a new fd
- entry() thread calls poll(2) on wrong sd
- stop() calls join, waits forever for entry thread
rgw: prepare_update_index should not error on system bucket
Should just return true. This way we don't need higher level
functions to be aware of system buckets. Also, don't use
marker.empty() to test for system bucket, use bucket_is_system().
Sam Lang [Thu, 20 Sep 2012 15:54:45 +0000 (08:54 -0700)]
vstart.sh: Alternative fix for vstart.sh -n
The previous fix (0f7c516f3e) breaks osd startup with -k. This one
from dmick just tells the ceph-mon which keyring to use through the
command line rather than moving the keyring path to the [global]
section of the config file.
When handling master request with slaves, the mds could crash
after receiving all slaves' commit acknowledgement, but before
journalling the ECommitted. Current MDS recovery code does not
handle this case correctly, the request will be left in
LogSegment's uncommitted_masters after recovery is finished.
It prevents LogSegment from being trimmed. The fix is find and
clean up request of this kind when recovery enters rejoin stage.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Signed-off-by: Sage Weil <sage@inktank.com>
Sam Lang [Thu, 20 Sep 2012 17:24:35 +0000 (10:24 -0700)]
cfuse: Define CEPH_INO_DOTDOT (3) for top-level parentdir
Defines the macro CEPH_INO_DOTDOT (to 3) and uses it as the top-level
parent directory (..) inode number. The value of 2 is already taken
by the .ceph hidden directory.
Sam Lang [Thu, 20 Sep 2012 00:47:21 +0000 (17:47 -0700)]
cfuse: Add the parent entry (..) for a top-level readdir
In the lowlevel fuse api, the current (.) and parent (..) entries
must be added manually in a readdir call. For the root directory
the parent is not a ceph inode, so we give it a fake inode value
(2) and intercept that inode on a getattr.
Fixes: #1957 Signed-off-by: Sam Lang <sam.lang@inktank.com>
Sam Lang [Wed, 19 Sep 2012 20:22:59 +0000 (13:22 -0700)]
Move keyring option to global section
Using vstart.sh -n uses ceph-authtool to generate the keyring file
in ./keyring. The vstart.sh script then writes out the ceph.conf
with a keyring option in the [client] section, so when the monitors
start, they can't find a keyring file. This commit puts the keyring in
the [global] section.
Sage Weil [Thu, 13 Sep 2012 00:49:24 +0000 (17:49 -0700)]
mon: require MON_GV protocol feature
Require the MON_GV feature when
- we see the ondisk feature is set on bootup
- we enable the ondisk feature
This means that once we form a quorum with the feature and enable it on
disk, there is no going back; we won't be able to talk to old monitors
without the feature, and a downgrade won't be possible.
Hopefully, in practice, any monitors with old code will be up at the time
we are upgrading, such that the quorum will not include the feature and we
won't make the transition. Otherwise, if they are down, and the remaining
nodes have the feature and enable it, and the old code starts up, it won't
be able ot join until it is upgraded to the new code as well.
Sage Weil [Wed, 12 Sep 2012 23:23:33 +0000 (16:23 -0700)]
mon: set new incompat GV feature when paxos stabilizes for the first time
This is a marker that future versions will use to know whether they can
safely convert the monitor data to the new format. If the GV feature is
not present, they will refuse to convert.