Bug 100864 - Missing udev rules.d blacklist for zfs_member
Summary: Missing udev rules.d blacklist for zfs_member
Status: RESOLVED FIXED
Alias: None
Product: udisks
Classification: Unclassified
Component: detection (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Vojtech Trefny
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-28 11:33 UTC by leetminiwheat
Modified: 2017-08-31 12:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
udevadm dump of a zfs disk (6.66 KB, text/plain)
2017-04-28 11:33 UTC, leetminiwheat
Details

Description leetminiwheat 2017-04-28 11:33:29 UTC
Created attachment 131114 [details]
udevadm dump of a zfs disk

Problem:
With any ZFS disks on the system any file managers leveraging udisks (pfmanfm, thunar, nautilus, nemo, caja, etc) will show duplicate entries in the sidebar for every ZFS vdev disk in the system, which are not user mountable this method anyways. 
In addition, this also somehow triggers device mapper to scan any zvols present on the system (which ZoL includes rules to create /dev/zd## and /dev/zvol/<pool>/<dataset>/zvol>). This in turn triggers device mapper to attempt to create mappings in /dev/mapper/* and /dev/dm-# for any partitions it might find inside a zvol. This creates a secondary issue in which renaming or removing zvols without manually removing the mapping via 'dmsetup remove <device>' causes dmesg spam when it disappears, and also marks the device(s) in the ZFS pool as busy.

Proposed solution:
To fix this, I believe the below rule should be added to the 80-udisks2.rules (or equivalent depending on distribution) under the section "Devices which should not be display in the user interface", similarly to how it ignores RAID/LVM members and other special partition types. This was added to the ZoL wiki as a temporay workaround for now.

# /etc/udev/rules.d/80-udisks2-ignore-zfs.rules

ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_FS_TYPE}=="zfs_member", ENV{ID_PART_ENTRY_TYPE}=="6a898cc3-1dd2-11b2-99a6-080020736631", ENV{UDISKS_IGNORE}="1"


This rule was tested in /etc/udev.d/80-udisks2-ignore-zfs.rules in debian9/stretch and seems to work correctly without breaking or mismatching other types. dumping udevadm shows the following additional property after adding the above rule: E: UDISKS_IGNORE=1


Additional info:
ZFSonLinux (and BSD's impl from what I can tell) creates GPT partition(s) on each zfs disk with type "Solaris /usr & Apple ZFS" (6a898cc3-1dd2-11b2-99a6-080020736631) with filesystem type "zfs_member" (and usually a small 8MB "Solaris reserved 1" (6a945a3B-1dd2-11b2-99a6-080020736631) which is already ignored) The above proposed udisks rule matches only zfs_member partitions with part ID "Solaris /usr & Apple ZFS" to prevent mismatches.

If this bug is related moreso to distribution implementations, then I apologize for the noise and please inform me of the correct place to report this bug. I believe it affects all distros (and possibly BSD) which use udisks, but I see no reason why upstream here shouldn't append an ignore rule for zfs like it does for RAID/LVM and other special partitions.

Attached is a udevadm dump from one of my ZFS disks, if needed. 
After the rule is added, an additional entry "E: UDISKS_IGNORE=1" is present in udevadm info

Note: Partitions 1 and 9 are always created when giving whole disks to ZFS, but manually creating slices/partitions may be also be used, but it will still have the same filesystem type and partition ID (unless a non-standard and uncommon usage of a MBR partition is used as a zfs_member).
Comment 1 Vojtech Trefny 2017-08-14 08:44:53 UTC
Thank you for the report (and fix).

PR for upstream project: https://github.com/storaged-project/udisks/pull/376
Comment 2 Vojtech Trefny 2017-08-31 12:27:20 UTC
Fixed in udisks 2.7.3


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.