]> 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)
committerJason Dillaman <dillaman@redhat.com>
Thu, 28 Apr 2016 17:00:04 +0000 (13:00 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
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);