Skip to contentSkip to conversation

AFS: Add a MAINTAINERS record for AFS

PATCH New David Howells 1 participant 2 messages Mar 25, 2008 Afs filesystem

lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/2 AFS: Add a MAINTAINERS record for AFS

Add a MAINTAINERS record for AFS

---

 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index 73883b8..41d226e 100644
@@ -163,6 +163,12 @@ M:	[email protected]
 L:	[email protected]
 S:	Maintained
 
+AFS FILESYSTEM & AF_RXRPC SOCKET DOMAIN
+P:	David Howells
+M:	[email protected]
+L:	[email protected]
+S:	Supported
+
 AIO
 P:	Benjamin LaHaise
 M:	[email protected]
author maintainer
#1 lore raw

PATCH 2/2 AFS: prevent double cell registration

kafs doesn't check if the cell already exists - so if you do an echo "add newcell.org 1.2.3.4" >/proc/fs/afs/cells it will try to create this cell again. kobject will also complain about a double registration. To prevent such problems, return -EEXIST in that case.

---

 fs/afs/cell.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
fs/afs/cell.c +13 -2
index 970d38f..788865d 100644
@@ -127,14 +127,20 @@ struct afs_cell *afs_cell_create(const char *name, char *vllist)
 
 	_enter("%s,%s", name, vllist);
 
+	down_write(&afs_cells_sem);
+	read_lock(&afs_cells_lock);
+	list_for_each_entry(cell, &afs_cells, link) {
+		if (strcasecmp(cell->name, name) == 0)
+			goto duplicate_name;
+	}
+	read_unlock(&afs_cells_lock);
+
 	cell = afs_cell_alloc(name, vllist);
 	if (IS_ERR(cell)) {
 		_leave(" = %ld", PTR_ERR(cell));
 		return cell;
 	}
 
-	down_write(&afs_cells_sem);
-
 	/* add a proc directory for this cell */
 	ret = afs_proc_cell_setup(cell);
 	if (ret < 0)
@@ -167,6 +173,11 @@ error:
 	kfree(cell);
 	_leave(" = %d", ret);
 	return ERR_PTR(ret);
+
+duplicate_name:
+	read_unlock(&afs_cells_lock);
+	up_write(&afs_cells_sem);
+	return ERR_PTR(-EEXIST);
 }
 
 /*