]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: return -ESHUTDOWN when a refresh is requested on a closed image
authorJason Dillaman <dillaman@redhat.com>
Thu, 28 Apr 2016 16:43:24 +0000 (12:43 -0400)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Mon, 2 May 2016 06:42:49 +0000 (12:12 +0530)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit ed132a1eb10e6b2eb4bc465658eb0379daca3d67)

src/librbd/ImageState.cc

index 329ad3afa55f4d5d730a7ab80faae11d16befc86..0bf2e45f7c15edf1fb4374a86a938edbd0ba0fdb 100644 (file)
@@ -109,7 +109,7 @@ void ImageState<I>::refresh(Context *on_finish) {
   m_lock.Lock();
   if (is_closed()) {
     m_lock.Unlock();
-    on_finish->complete(0);
+    on_finish->complete(-ESHUTDOWN);
     return;
   }
 
@@ -123,9 +123,12 @@ int ImageState<I>::refresh_if_required() {
   C_SaferCond ctx;
   {
     m_lock.Lock();
-    if (m_last_refresh == m_refresh_seq || is_closed()) {
+    if (m_last_refresh == m_refresh_seq) {
       m_lock.Unlock();
       return 0;
+    } else if (is_closed()) {
+      m_lock.Unlock();
+      return -ESHUTDOWN;
     }
 
     Action action(ACTION_TYPE_REFRESH);