Lines Matching refs:cell

2 /* AFS cell alias detection
17 static struct afs_volume *afs_sample_volume(struct afs_cell *cell, struct key *key,
25 .net = cell->net,
26 .cell = cell,
154 * Compare root.cell volumes.
156 static int afs_compare_cell_roots(struct afs_cell *cell)
164 hlist_for_each_entry_rcu(p, &cell->net->proc_cells, proc_link) {
165 if (p == cell || p->alias_of)
168 continue; /* Ignore cells that don't have a root.cell volume. */
170 if (afs_compare_volume_slists(cell->root_volume, p->root_volume) != 0)
180 cell->alias_of = afs_use_cell(p, afs_cell_trace_use_alias);
185 * Query the new cell for a volume from a cell we're already using.
187 static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key,
203 _enter("%s:%s", cell->name, pvol->name);
205 /* And see if it's in the new cell. */
206 volume = afs_sample_volume(cell, key, pvol->name, pvol->name_len);
208 afs_put_volume(cell->net, pvol, afs_volume_trace_put_query_alias);
211 /* That volume is not in the new cell, so not an alias */
215 /* The new cell has a like-named volume also - compare volume ID,
226 afs_put_volume(cell->net, volume, afs_volume_trace_put_query_alias);
227 afs_put_volume(cell->net, pvol, afs_volume_trace_put_query_alias);
232 * Query the new cell for volumes we know exist in cells we're already using.
234 static int afs_query_for_alias(struct afs_cell *cell, struct key *key)
238 _enter("%s", cell->name);
240 if (mutex_lock_interruptible(&cell->net->proc_cells_lock) < 0)
243 hlist_for_each_entry(p, &cell->net->proc_cells, proc_link) {
244 if (p == cell || p->alias_of)
249 continue; /* Ignore cells that have a root.cell volume. */
251 mutex_unlock(&cell->net->proc_cells_lock);
253 if (afs_query_for_alias_one(cell, key, p) != 0)
256 if (mutex_lock_interruptible(&cell->net->proc_cells_lock) < 0) {
257 afs_unuse_cell(cell->net, p, afs_cell_trace_unuse_check_alias);
261 afs_unuse_cell(cell->net, p, afs_cell_trace_unuse_check_alias);
264 mutex_unlock(&cell->net->proc_cells_lock);
269 cell->alias_of = p; /* Transfer our ref */
276 static char *afs_vl_get_cell_name(struct afs_cell *cell, struct key *key)
283 if (!afs_begin_vlserver_operation(&vc, cell, key))
302 static int yfs_check_canonical_cell_name(struct afs_cell *cell, struct key *key)
307 cell_name = afs_vl_get_cell_name(cell, key);
311 if (strcmp(cell_name, cell->name) == 0) {
316 master = afs_lookup_cell(cell->net, cell_name, strlen(cell_name),
322 cell->alias_of = master; /* Transfer our ref */
326 static int afs_do_cell_detect_alias(struct afs_cell *cell, struct key *key)
331 _enter("%s", cell->name);
333 ret = yfs_check_canonical_cell_name(cell, key);
337 /* Try and get the root.cell volume for comparison with other cells */
338 root_volume = afs_sample_volume(cell, key, "root.cell", 9);
340 cell->root_volume = root_volume;
341 return afs_compare_cell_roots(cell);
347 /* Okay, this cell doesn't have an root.cell volume. We need to
350 return afs_query_for_alias(cell, key);
354 * Check to see if a new cell is an alias of a cell we already have. At this
355 * point we have the cell's volume server list.
359 * detect an alias, cell->alias_of is set to point to the assumed master.
361 int afs_cell_detect_alias(struct afs_cell *cell, struct key *key)
363 struct afs_net *net = cell->net;
369 if (test_bit(AFS_CELL_FL_CHECK_ALIAS, &cell->flags)) {
370 ret = afs_do_cell_detect_alias(cell, key);
372 clear_bit_unlock(AFS_CELL_FL_CHECK_ALIAS, &cell->flags);
374 ret = cell->alias_of ? 1 : 0;
381 cell->name, cell->alias_of->name);