]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-nbd: rescan partition table after image resize event
authorJason Dillaman <dillaman@redhat.com>
Wed, 15 Nov 2017 15:34:32 +0000 (10:34 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 15 Nov 2017 15:34:32 +0000 (10:34 -0500)
Fixes: http://tracker.ceph.com/issues/22131
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_nbd/rbd-nbd.cc

index 371f5301ba06a55ceee8215f13f87f28959b521e..78e4239aaaea74a892c840e3a6d5b981000a2ec7 100644 (file)
@@ -469,13 +469,19 @@ public:
       unsigned long new_size = info.size;
 
       if (new_size != size) {
+        dout(5) << "resize detected" << dendl;
         if (ioctl(fd, BLKFLSBUF, NULL) < 0)
-            derr << "invalidate page cache failed: " << cpp_strerror(errno) << dendl;
+            derr << "invalidate page cache failed: " << cpp_strerror(errno)
+                 << dendl;
         if (ioctl(fd, NBD_SET_SIZE, new_size) < 0) {
             derr << "resize failed: " << cpp_strerror(errno) << dendl;
         } else {
           size = new_size;
         }
+        if (ioctl(fd, BLKRRPART, NULL) < 0) {
+          derr << "rescan of partition table failed: " << cpp_strerror(errno)
+               << dendl;
+        }
         if (image.invalidate_cache() < 0)
             derr << "invalidate rbd cache failed" << dendl;
       }