From: Jason Dillaman Date: Wed, 15 Nov 2017 15:34:32 +0000 (-0500) Subject: rbd-nbd: rescan partition table after image resize event X-Git-Tag: v13.0.1~201^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=db13e4757451b463e7fb65c43247e033f24d45e5;p=ceph.git rbd-nbd: rescan partition table after image resize event Fixes: http://tracker.ceph.com/issues/22131 Signed-off-by: Jason Dillaman --- diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc index 371f5301ba06..78e4239aaaea 100644 --- a/src/tools/rbd_nbd/rbd-nbd.cc +++ b/src/tools/rbd_nbd/rbd-nbd.cc @@ -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; }