diff options
Diffstat (limited to 'sys-cluster/ceph/files')
-rw-r--r-- | sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch b/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch new file mode 100644 index 000000000000..5cb89be0edf1 --- /dev/null +++ b/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch @@ -0,0 +1,28 @@ +diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc +index 2e399ab832..88e1e0ff65 100644 +--- a/src/tools/rbd_nbd/rbd-nbd.cc ++++ b/src/tools/rbd_nbd/rbd-nbd.cc +@@ -469,6 +469,10 @@ static int open_device(const char* path, bool try_load_moudle = false) + + static int check_device_size(int nbd_index, unsigned long expected_size) + { ++ // There are bugs with some older kernel versions that result in an ++ // overflow for large image sizes. This check is to ensure we are ++ // not affected. ++ + unsigned long size = 0; + std::string path = "/sys/block/nbd" + stringify(nbd_index) + "/size"; + std::ifstream ifs; +@@ -480,6 +484,12 @@ static int check_device_size(int nbd_index, unsigned long expected_size) + ifs >> size; + size *= RBD_NBD_BLKSIZE; + ++ if (size == 0) { ++ // Newer kernel versions will report real size only after nbd ++ // connect. Assume this is the case and return success. ++ return 0; ++ } ++ + if (size != expected_size) { + cerr << "rbd-nbd: kernel reported invalid device size (" << size + << ", expected " << expected_size << ")" << std::endl; |