e1b51b7
From 1c9c067901c9af742bcdef3dd134b68e3e45a38f Mon Sep 17 00:00:00 2001
e1b51b7
From: Martin Pitt <martin.pitt@ubuntu.com>
e1b51b7
Date: Wed, 11 Feb 2015 15:26:52 +0100
e1b51b7
Subject: [PATCH] rules: Fix by-path of mmc RPMB partitions and don't blkid
e1b51b7
 them
e1b51b7
e1b51b7
Linux 3.10+ exposes RPMB (Replay Protected Memory Block) partitions of MMC
e1b51b7
devices [1] ; trying to read them with blkid or other unspecific means will
e1b51b7
cause kernel buffer I/O errors and timeouts. So don't run blkid on these.
e1b51b7
e1b51b7
Also ensure that /dev/disk/by-path creates proper symlinks and exposes the
e1b51b7
-rpmb partition separately, instead of letting the "normal" partition symlink
e1b51b7
point to the rpbm device (this is a race condition).
e1b51b7
e1b51b7
[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=090d25fe224c0
e1b51b7
e1b51b7
https://launchpad.net/bugs/1333140
e1b51b7
(cherry picked from commit b87b01cf83947f467f3c46d9831cd67955fc46b9)
e1b51b7
---
e1b51b7
 rules/60-persistent-storage.rules | 6 +++++-
e1b51b7
 1 file changed, 5 insertions(+), 1 deletion(-)
e1b51b7
e1b51b7
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
e1b51b7
index 475b151535..08ed1ccf74 100644
e1b51b7
--- a/rules/60-persistent-storage.rules
e1b51b7
+++ b/rules/60-persistent-storage.rules
e1b51b7
@@ -53,7 +53,8 @@ KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+=
e1b51b7
 
e1b51b7
 # by-path (parent device path)
e1b51b7
 ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
e1b51b7
-ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
e1b51b7
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", KERNEL=="mmcblk[0-9]*rpmb", SYMLINK+="disk/by-path/$env{ID_PATH}-rpmb"
e1b51b7
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", KERNEL!="mmcblk[0-9]*rpmb", SYMLINK+="disk/by-path/$env{ID_PATH}"
e1b51b7
 ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
e1b51b7
 
e1b51b7
 # skip unpartitioned removable media devices from drivers which do not send "change" events
e1b51b7
@@ -66,6 +67,9 @@ KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DAT
e1b51b7
 KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
e1b51b7
   IMPORT{builtin}="blkid --noraid"
e1b51b7
 
e1b51b7
+# don't try to read Replay Protected Memory Block partitions
e1b51b7
+KERNEL=="mmcblk[0-9]*rpmb", GOTO="persistent_storage_end"
e1b51b7
+
e1b51b7
 # probe filesystem metadata of disks
e1b51b7
 KERNEL!="sr*", IMPORT{builtin}="blkid"
e1b51b7