Commit 12908709 authored by Milan Broz's avatar Milan Broz

Resize loop device after fallocate.

On old systems we have a loop mapped so the loop must be resized as well.
parent b42d183b
......@@ -498,13 +498,16 @@ int device_fallocate(struct device *device, uint64_t size)
struct stat st;
int devfd, r = -EINVAL;
devfd = open(device->path, O_WRONLY);
devfd = open(device_path(device), O_WRONLY);
if(devfd == -1)
return -EINVAL;
if (!fstat(devfd, &st) && S_ISREG(st.st_mode) &&
!posix_fallocate(devfd, 0, size))
!posix_fallocate(devfd, 0, size)) {
r = 0;
if (device->file_path && crypt_loop_resize(device->path))
r = -EINVAL;
return r;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment