aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorMark Harmstone <[email protected]>2025-09-02 10:34:10 +0000
committerDavid Sterba <[email protected]>2025-09-05 17:52:10 +0000
commit3d1267475b94b3df7a61e4ea6788c7c5d9e473c4 (patch)
tree42e2cb5f5791763eb3e916ab0ded19a335be48a7 /fs/open.c
parentMAINTAINERS: update btrfs entry (diff)
downloadkernel-3d1267475b94b3df7a61e4ea6788c7c5d9e473c4.tar.gz
kernel-3d1267475b94b3df7a61e4ea6788c7c5d9e473c4.zip
btrfs: don't allow adding block device of less than 1 MB
Commit 15ae0410c37a79 ("btrfs-progs: add error handling for device_get_partition_size_fd_stat()") in btrfs-progs inadvertently changed it so that if the BLKGETSIZE64 ioctl on a block device returned a size of 0, this was no longer seen as an error condition. Unfortunately this is how disconnected NBD devices behave, meaning that with btrfs-progs 6.16 it's now possible to add a device you can't remove: # btrfs device add /dev/nbd0 /root/temp # btrfs device remove /dev/nbd0 /root/temp ERROR: error removing device '/dev/nbd0': Invalid argument This check should always have been done kernel-side anyway, so add a check in btrfs_init_new_device() that the new device doesn't have a size less than BTRFS_DEVICE_RANGE_RESERVED (i.e. 1 MB). Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Mark Harmstone <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/open.c')
0 files changed, 0 insertions, 0 deletions