fix append to uninitialized buffer in FlatIndex::created

The long_name variable is not initialized. When the append_oname
function is called, it will strlen(long_name) and get a result
that depends on the stack content. The long_name is truncated to a
zero length string to prevent this unexpected behavior.

There is no sure way to trigger the problem by writing a unit
test. Unit tests are added for all public methods of the FlatIndex
class. Most of the time the tests fail if the long_name variable is
not properly initialized.

 * uint32_t collection_version()
 * coll_t coll() const
 * void set_ref(std::tr1::shared_ptr<CollectionIndex> ref)
 * int cleanup()
 * int init()
 * int created(const hobject_t &hoid, const char *path)
 * int unlink(const hobject_t &hoid)
 * int lookup(const hobject_t &hoid, IndexedPath *path, int *exist)
 * int collection_list(vector<hobject_t> *ls)
 * int collection_list_partial(const hobject_t &start, int min_count, int max_count, snapid_t seq, vector<hobject_t> *ls, hobject_t *next)

There are a number of border cases that cannot be tested, such as the
logic of the lfn_get static function. Since FlatIndex code is designed
to transition from older namespace conventions, it is difficult to
figure out.

The tests rely on xattr(2) and their availability is checked before
running them.

http://tracker.ceph.com/issues/4542 refs #4542

Signed-off-by: Loic Dachary <loic@dachary.org>
MDS.cc: remove double is_clientreplay() check in active_start()

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
CephMount.java: remove unused import

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
java libcephfs: add serialVersionUID to some Exception classes

Fix for: "The serializable class does not declare a static final
serialVersionUID field" warning.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph_common.sh: fix typo in comment

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mkcephfs.in: use mktemp instead of dd+md5sum+awk

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mkcephfs.in: provide a valid rdir for MONs on -a

Provide also a valid rdir for ssh as in case of OSD/MDS hosts if
mkcephfs -a is called.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mkcephfs.in: cleanup rdir in MON case

Remove $rdir in MON case of 'mkcephfs -a' as soon as it's no
longer needed.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Merge pull request #152 from dalgaaf/wip-da-fix-misc

MDS.cc: remove double is_clientreplay() check in active_start()

Reviewed-by: Sage Weil <sage@inktank.com>
mkcephfs.in: use 32 chars for mktemp to be more unique

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Merge pull request #156 from dalgaaf/wip-da-fix-mkcephfs

Fix issues in mkcephfs

Reviewed-by: Sage Weil <sage@inktank.com>
Change ceph::apt -> ceph::repo in doc

Signed-off-by: Alexandre Marangone <alexandre.marangone@inktank.com>
Merge pull request #158 from alram/master

Change ceph apt recipe to repo in doc
Fix radosgw upstart job

Signed-off-by: Alexandre Marangone <alexandre.marangone@inktank.com>
Merge pull request #160 from alram/master

Fix radosgw upstart job

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #153 from dalgaaf/wip-da-java

Fix some small java issues
Merge pull request #148 from dachary/wip-4542

fix append to uninitialized buffer in FlatIndex::created

Reviewed-by: Samuel Just <sam.just@inktank.com>
OSD fails to start with error assert(values.size() == 2)

Remove redundant setting of dirty_info
Fix PG::upgrade() to conform to programming style
Set dirty_big_info in PG::write_info for upgrades

BUG: #4562

Signed-off-by: David Zafman <david.zafman@inktank.com>
Reviewed-by: Sam Just <sam.just@inktank.com>
Merge git://github.com/ceph/ceph