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