]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Fixes coverity defect 716890 [DEADCODE]
authorSam Lang <sam.lang@inktank.com>
Tue, 25 Sep 2012 16:07:00 +0000 (09:07 -0700)
committerSage Weil <sage@inktank.com>
Wed, 26 Sep 2012 23:44:47 +0000 (16:44 -0700)
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.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
src/client/Client.cc

index 1a29779458a33c3267436dd306671a21e880e6ac..694ed0a8cff0f93f77a79d3ea49a09d3d4840d1d 100644 (file)
@@ -884,7 +884,7 @@ Inode* Client::insert_trace(MetaRequest *request, int mds)
 
 int Client::choose_target_mds(MetaRequest *req) 
 {
-  int mds = 0;
+  int mds = -1;
   __u32 hash = 0;
   bool is_hash = false;