mirror of
https://github.com/ceph/ceph
synced 2024-12-27 14:03:25 +00:00
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:
commit
3b741bd5c0
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user