Mark Harmstone
7b478122cd
btrfs: don't allow adding block device of less than 1 MB
...
[ Upstream commit 3d1267475b ]
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 <wqu@suse.com >
Signed-off-by: Mark Harmstone <mark@harmstone.com >
Reviewed-by: David Sterba <dsterba@suse.com >
Signed-off-by: David Sterba <dsterba@suse.com >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-10-02 13:44:08 +02:00
..
2025-06-19 15:32:36 +02:00
2024-10-02 17:23:23 -04:00
2025-04-10 14:39:29 +02:00
2025-03-07 18:25:29 +01:00
2024-10-28 13:16:56 +01:00
2025-07-10 16:05:08 +02:00
2024-08-07 11:33:21 +02:00
2025-10-02 13:44:08 +02:00
2025-07-24 08:56:30 +02:00
2025-09-19 16:35:47 +02:00
2024-08-19 13:45:03 +02:00
2025-06-27 11:11:12 +01:00
2025-08-20 18:30:15 +02:00
2025-08-28 16:31:08 +02:00
2025-05-29 11:02:14 +02:00
2024-10-02 17:23:23 -04:00
2025-09-04 15:31:52 +02:00
2024-12-05 14:01:10 +01:00
2025-09-04 15:31:44 +02:00
2025-08-20 18:30:47 +02:00
2025-08-20 18:30:21 +02:00
2025-09-19 16:35:42 +02:00
2025-08-28 16:30:59 +02:00
2024-10-17 00:28:06 -07:00
2025-09-19 16:35:46 +02:00
2025-08-20 18:30:20 +02:00
2025-08-20 18:30:20 +02:00
2025-08-20 18:30:19 +02:00
2025-04-10 14:39:25 +02:00
2024-10-02 17:23:23 -04:00
2024-12-27 14:02:20 +01:00
2025-05-02 07:59:27 +02:00
2025-07-24 08:56:25 +02:00
2025-08-28 16:30:59 +02:00
2025-06-27 11:11:37 +01:00
2025-08-20 18:30:42 +02:00
2025-09-19 16:35:47 +02:00
2024-10-02 17:23:23 -04:00
2024-08-07 11:33:36 +02:00
2025-08-28 16:31:04 +02:00
2025-09-19 16:35:44 +02:00
2025-02-08 09:57:59 +01:00
2025-08-20 18:30:14 +02:00
2025-09-25 11:13:45 +02:00
2024-10-02 17:23:23 -04:00
2025-08-15 12:13:51 +02:00
2025-08-20 18:30:21 +02:00
2025-09-19 16:35:45 +02:00
2024-08-07 11:33:21 +02:00
2025-08-20 18:30:41 +02:00
2025-08-28 16:31:10 +02:00
2025-09-19 16:35:45 +02:00
2025-05-29 11:02:58 +02:00
2025-01-23 17:22:55 +01:00
2024-12-09 10:40:55 +01:00
2024-10-02 17:23:23 -04:00
2024-08-21 22:32:58 +02:00
2025-10-02 13:44:08 +02:00
2025-08-28 16:31:05 +02:00
2024-08-07 11:33:36 +02:00
2025-08-20 18:30:21 +02:00
2025-02-08 09:58:01 +01:00
2025-08-20 18:30:20 +02:00
2024-10-02 00:05:09 -04:00
2024-12-14 20:04:13 +01:00
2025-03-22 12:54:15 -07:00
2024-08-20 14:03:18 -04:00
2025-09-04 15:31:54 +02:00
2024-10-02 12:02:15 -07:00
2024-08-19 13:45:03 +02:00
2025-07-10 16:05:09 +02:00
2024-08-29 06:20:44 +12:00
2024-10-16 13:17:45 +02:00
2024-12-05 14:02:50 +01:00
2025-05-22 14:29:35 +02:00
2025-02-17 10:05:04 +01:00
2024-12-05 14:02:50 +01:00
2024-08-07 11:26:54 -07:00
2025-08-28 16:31:08 +02:00
2025-06-04 14:43:52 +02:00
2024-10-07 13:51:47 +02:00
2024-09-16 08:35:09 +02:00
2024-08-19 13:45:02 +02:00
2024-08-12 22:00:43 -04:00
2025-08-20 18:30:15 +02:00
2025-04-10 14:39:40 +02:00
2024-12-05 14:02:47 +01:00
2025-09-19 16:35:41 +02:00
2025-07-10 16:05:08 +02:00
2025-08-28 16:31:16 +02:00
2025-06-19 15:32:32 +02:00
2025-09-09 18:58:03 +02:00
2024-09-27 08:18:43 -07:00
2024-10-09 12:47:18 -07:00
2024-08-28 13:05:39 +02:00
2024-08-12 22:00:43 -04:00
2025-04-25 10:47:50 +02:00
2024-08-12 22:00:43 -04:00
2025-08-20 18:30:20 +02:00
2024-09-23 09:35:36 -07:00
2024-08-06 09:01:41 -07:00
2024-09-24 15:29:42 -07:00
2025-01-17 13:40:50 +01:00
2025-01-17 13:40:33 +01:00
2025-03-22 12:54:20 -07:00
2025-09-09 18:58:19 +02:00
2024-09-27 08:18:43 -07:00
2024-10-10 12:09:03 +02:00
2025-08-20 18:30:21 +02:00
2024-09-27 08:18:43 -07:00
2024-08-30 08:22:37 +02:00
2024-12-05 14:01:11 +01:00
2024-08-12 22:00:43 -04:00
2024-08-12 22:00:43 -04:00
2025-02-08 09:56:53 +01:00
2024-09-23 09:35:36 -07:00
2025-08-28 16:31:04 +02:00
2024-08-12 22:00:43 -04:00
2024-08-12 22:00:43 -04:00
2024-10-21 14:30:26 +02:00
2024-08-12 22:00:43 -04:00
2024-08-12 22:00:43 -04:00
2025-05-18 08:24:52 +02:00
2024-08-12 22:00:43 -04:00
2025-06-27 11:11:36 +01:00