aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 16:39:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 16:39:11 -0500
commit9228ff90387e276ad67b10c0eb525c9d6a57d5e9 (patch)
treee7c87b68daba7cf7ca4c342c6b52165bd78fbe16 /init
parent9360b53661a2c7754517b2925580055bacc8ec38 (diff)
parentd2ec180c23a5a1bfe34d8638b0342a47c00cf70f (diff)
Merge branch 'for-3.8/drivers' of git://git.kernel.dk/linux-block
Pull block driver update from Jens Axboe: "Now that the core bits are in, here are the driver bits for 3.8. The branch contains: - A huge pile of drbd bits that were dumped from the 3.7 merge window. Following that, it was both made perfectly clear that there is going to be no more over-the-wall pulls and how the situation on individual pulls can be improved. - A few cleanups from Akinobu Mita for drbd and cciss. - Queue improvement for loop from Lukas. This grew into adding a generic interface for waiting/checking an even with a specific lock, allowing this to be pulled out of md and now loop and drbd is also using it. - A few fixes for xen back/front block driver from Roger Pau Monne. - Partition improvements from Stephen Warren, allowing partiion UUID to be used as an identifier." * 'for-3.8/drivers' of git://git.kernel.dk/linux-block: (609 commits) drbd: update Kconfig to match current dependencies drbd: Fix drbdsetup wait-connect, wait-sync etc... commands drbd: close race between drbd_set_role and drbd_connect drbd: respect no-md-barriers setting also when changed online via disk-options drbd: Remove obsolete check drbd: fixup after wait_even_lock_irq() addition to generic code loop: Limit the number of requests in the bio list wait: add wait_event_lock_irq() interface xen-blkfront: free allocated page xen-blkback: move free persistent grants code block: partition: msdos: provide UUIDs for partitions init: reduce PARTUUID min length to 1 from 36 block: store partition_meta_info.uuid as a string cciss: use check_signature() cciss: cleanup bitops usage drbd: use copy_highpage drbd: if the replication link breaks during handshake, keep retrying drbd: check return of kmalloc in receive_uuids drbd: Broadcast sync progress no more often than once per second drbd: don't try to clear bits once the disk has failed ...
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts.c61
1 files changed, 40 insertions, 21 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c
index f8a66424360d..1d1b6348f903 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -69,23 +69,28 @@ __setup("ro", readonly);
69__setup("rw", readwrite); 69__setup("rw", readwrite);
70 70
71#ifdef CONFIG_BLOCK 71#ifdef CONFIG_BLOCK
72struct uuidcmp {
73 const char *uuid;
74 int len;
75};
76
72/** 77/**
73 * match_dev_by_uuid - callback for finding a partition using its uuid 78 * match_dev_by_uuid - callback for finding a partition using its uuid
74 * @dev: device passed in by the caller 79 * @dev: device passed in by the caller
75 * @data: opaque pointer to a 36 byte char array with a UUID 80 * @data: opaque pointer to the desired struct uuidcmp to match
76 * 81 *
77 * Returns 1 if the device matches, and 0 otherwise. 82 * Returns 1 if the device matches, and 0 otherwise.
78 */ 83 */
79static int match_dev_by_uuid(struct device *dev, void *data) 84static int match_dev_by_uuid(struct device *dev, void *data)
80{ 85{
81 u8 *uuid = data; 86 struct uuidcmp *cmp = data;
82 struct hd_struct *part = dev_to_part(dev); 87 struct hd_struct *part = dev_to_part(dev);
83 88
84 if (!part->info) 89 if (!part->info)
85 goto no_match; 90 goto no_match;
86 91
87 if (memcmp(uuid, part->info->uuid, sizeof(part->info->uuid))) 92 if (strncasecmp(cmp->uuid, part->info->uuid, cmp->len))
88 goto no_match; 93 goto no_match;
89 94
90 return 1; 95 return 1;
91no_match: 96no_match:
@@ -95,7 +100,7 @@ no_match:
95 100
96/** 101/**
97 * devt_from_partuuid - looks up the dev_t of a partition by its UUID 102 * devt_from_partuuid - looks up the dev_t of a partition by its UUID
98 * @uuid: min 36 byte char array containing a hex ascii UUID 103 * @uuid: char array containing ascii UUID
99 * 104 *
100 * The function will return the first partition which contains a matching 105 * The function will return the first partition which contains a matching
101 * UUID value in its partition_meta_info struct. This does not search 106 * UUID value in its partition_meta_info struct. This does not search
@@ -106,38 +111,41 @@ no_match:
106 * 111 *
107 * Returns the matching dev_t on success or 0 on failure. 112 * Returns the matching dev_t on success or 0 on failure.
108 */ 113 */
109static dev_t devt_from_partuuid(char *uuid_str) 114static dev_t devt_from_partuuid(const char *uuid_str)
110{ 115{
111 dev_t res = 0; 116 dev_t res = 0;
117 struct uuidcmp cmp;
112 struct device *dev = NULL; 118 struct device *dev = NULL;
113 u8 uuid[16];
114 struct gendisk *disk; 119 struct gendisk *disk;
115 struct hd_struct *part; 120 struct hd_struct *part;
116 int offset = 0; 121 int offset = 0;
122 bool clear_root_wait = false;
123 char *slash;
117 124
118 if (strlen(uuid_str) < 36) 125 cmp.uuid = uuid_str;
119 goto done;
120 126
127 slash = strchr(uuid_str, '/');
121 /* Check for optional partition number offset attributes. */ 128 /* Check for optional partition number offset attributes. */
122 if (uuid_str[36]) { 129 if (slash) {
123 char c = 0; 130 char c = 0;
124 /* Explicitly fail on poor PARTUUID syntax. */ 131 /* Explicitly fail on poor PARTUUID syntax. */
125 if (sscanf(&uuid_str[36], 132 if (sscanf(slash + 1,
126 "/PARTNROFF=%d%c", &offset, &c) != 1) { 133 "PARTNROFF=%d%c", &offset, &c) != 1) {
127 printk(KERN_ERR "VFS: PARTUUID= is invalid.\n" 134 clear_root_wait = true;
128 "Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n");
129 if (root_wait)
130 printk(KERN_ERR
131 "Disabling rootwait; root= is invalid.\n");
132 root_wait = 0;
133 goto done; 135 goto done;
134 } 136 }
137 cmp.len = slash - uuid_str;
138 } else {
139 cmp.len = strlen(uuid_str);
135 } 140 }
136 141
137 /* Pack the requested UUID in the expected format. */ 142 if (!cmp.len) {
138 part_pack_uuid(uuid_str, uuid); 143 clear_root_wait = true;
144 goto done;
145 }
139 146
140 dev = class_find_device(&block_class, NULL, uuid, &match_dev_by_uuid); 147 dev = class_find_device(&block_class, NULL, &cmp,
148 &match_dev_by_uuid);
141 if (!dev) 149 if (!dev)
142 goto done; 150 goto done;
143 151
@@ -158,6 +166,13 @@ static dev_t devt_from_partuuid(char *uuid_str)
158no_offset: 166no_offset:
159 put_device(dev); 167 put_device(dev);
160done: 168done:
169 if (clear_root_wait) {
170 pr_err("VFS: PARTUUID= is invalid.\n"
171 "Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n");
172 if (root_wait)
173 pr_err("Disabling rootwait; root= is invalid.\n");
174 root_wait = 0;
175 }
161 return res; 176 return res;
162} 177}
163#endif 178#endif
@@ -174,6 +189,10 @@ done:
174 * used when disk name of partitioned disk ends on a digit. 189 * used when disk name of partitioned disk ends on a digit.
175 * 6) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the 190 * 6) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
176 * unique id of a partition if the partition table provides it. 191 * unique id of a partition if the partition table provides it.
192 * The UUID may be either an EFI/GPT UUID, or refer to an MSDOS
193 * partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero-
194 * filled hex representation of the 32-bit "NT disk signature", and PP
195 * is a zero-filled hex representation of the 1-based partition number.
177 * 7) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to 196 * 7) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to
178 * a partition with a known unique id. 197 * a partition with a known unique id.
179 * 198 *