mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
btrfs: fix loopback resizing code
This corrects the block device to use, to the right path, as it was before 553e15f21bd7b1ecb709edfb5686d5768fe942f2. Replaces: #10153
This commit is contained in:
parent
6c9c51e5e2
commit
de89949a71
@ -877,7 +877,7 @@ int btrfs_subvol_set_subtree_quota_limit(const char *path, uint64_t subvol_id, u
|
|||||||
|
|
||||||
int btrfs_resize_loopback_fd(int fd, uint64_t new_size, bool grow_only) {
|
int btrfs_resize_loopback_fd(int fd, uint64_t new_size, bool grow_only) {
|
||||||
struct btrfs_ioctl_vol_args args = {};
|
struct btrfs_ioctl_vol_args args = {};
|
||||||
char p[SYS_BLOCK_PATH_MAX("/loop/backing_file")];
|
char p[SYS_BLOCK_PATH_MAX("/loop/backing_file")], q[DEV_NUM_PATH_MAX];
|
||||||
_cleanup_free_ char *backing = NULL;
|
_cleanup_free_ char *backing = NULL;
|
||||||
_cleanup_close_ int loop_fd = -1, backing_fd = -1;
|
_cleanup_close_ int loop_fd = -1, backing_fd = -1;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -922,8 +922,8 @@ int btrfs_resize_loopback_fd(int fd, uint64_t new_size, bool grow_only) {
|
|||||||
if (grow_only && new_size < (uint64_t) st.st_size)
|
if (grow_only && new_size < (uint64_t) st.st_size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
xsprintf_sys_block_path(p, NULL, dev);
|
xsprintf_dev_num_path(q, "block", dev);
|
||||||
loop_fd = open(p, O_RDWR|O_CLOEXEC|O_NOCTTY);
|
loop_fd = open(q, O_RDWR|O_CLOEXEC|O_NOCTTY);
|
||||||
if (loop_fd < 0)
|
if (loop_fd < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user