Merge pull request #18947 from dillaman/wip-22131

rbd-nbd: certain kernels may not discover resized block devices

Reviewed-by: Mykola Golub <to.my.trociny@gmail.com>
This commit is contained in:
Mykola Golub 2017-11-16 13:32:46 +02:00 committed by GitHub
commit 3b741bd5c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -2247,7 +2247,6 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
}
RWLock::RLocker owner_locker(ictx->owner_lock);
RWLock::WLocker md_locker(ictx->md_lock);
r = ictx->invalidate_cache(false);
ictx->perfcounter->inc(l_librbd_invalidate_cache);
return r;

View 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;
}