]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fix readahead counter update logic
authorxiexingguo <258156334@qq.com>
Sat, 19 Dec 2015 02:29:59 +0000 (10:29 +0800)
committerxiexingguo <xie.xingguo@zte.com.cn>
Sun, 20 Dec 2015 07:02:06 +0000 (15:02 +0800)
Fixes: #14127
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/librbd/internal.cc

index abaf475e7e083caff9d05b0980868997d1d662fc..96317eb0b3f807869ea3ae6b9ce2323a57506aaf 100644 (file)
@@ -3179,17 +3179,20 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
         ++p) {
       total_bytes += p->second;
     }
+    
     ictx->md_lock.get_write();
     bool abort = ictx->readahead_disable_after_bytes != 0 &&
       ictx->total_bytes_read > ictx->readahead_disable_after_bytes;
+    if (abort) {
+      ictx->md_lock.put_write();
+      return;
+    }
     ictx->total_bytes_read += total_bytes;
     ictx->snap_lock.get_read();
     uint64_t image_size = ictx->get_image_size(ictx->snap_id);
     ictx->snap_lock.put_read();
     ictx->md_lock.put_write();
-    if (abort) {
-      return;
-    }
+    
     pair<uint64_t, uint64_t> readahead_extent = ictx->readahead.update(image_extents, image_size);
     uint64_t readahead_offset = readahead_extent.first;
     uint64_t readahead_length = readahead_extent.second;