lofi does mismanage size(9P) properties
Test: /opt/zfs-tests/tests/functional/slog/slog_013_pos (run as root) [00:01] [FAIL]
The failure was caused by:
00:56:17.88 ERROR: /usr/sbin/zpool add testpool.457037 log /dev/lofi/1 exited 1
While investigating I found that Nblocks / Size properties are actually set wrong and does not conform to description in size(9P). Implemented change does fix this use case.
Updated by Toomas Soome almost 4 years ago
The explanation about the root cause and surrounding details:
The disk devices are supposed to expose the device and block size related information via properties, as described in size(9P), so there are two distinct cases - disk as whole with total size, and disk sliced to partitions.
For total size or whole disk, there should be properties:
In case the disk driver will not add properties listed above, the device framework will create those properties.
For partitions, every partition is represented by device minor node and should have following properties:
Nblocks (for block device)
Size (for character or raw device).
In case of disks, the label framework (cmlb driver) will create and update Nblocks and Size automatically based on partition sizes and/or changes to partitions. Also in case of labeled lofi, since the disk label support in lofi is implemented by stacking cmlb, the cmlb does manage Nblocks and Size properties for minor nodes representing the partitions.
However, if the traditional, unlabeled lofi mapping is used, the lofi driver must create Nblocks and Size properties with proper values and bind those properties with proper minor node associated with mapped file. The bug was caused by fact that I did not realize the importance of minor number related to those properties.
The fix for the issue does not create property "device-nblocks" in lofi driver as it will be created by device framework, and makes sure the non-labeled mapping will get the properties "Nblocks" and "Size" created and bound to proper minor node. This creation is only applied in case of non-labeled mapping, because for labeled mapping, the cmlb driver will manage mentioned properties.
Updated by Electric Monk almost 4 years ago
- Status changed from New to Closed
- % Done changed from 90 to 100
commit 538c7dac42a1f56f75806831c01aec2529d90a80 Author: Toomas Soome <email@example.com> Date: 2016-07-07T19:57:42.000Z 7167 lofi does mismanage size(9P) properties Reviewed by: Igor Kozhukhov <firstname.lastname@example.org> Reviewed by: Robert Mustacchi <email@example.com> Approved by: Richard Lowe <firstname.lastname@example.org>