* [PATCH 1/2] AFS: Add a MAINTAINERS record for AFS
@ 2008-03-25 19:03 David Howells
2008-03-25 19:03 ` [PATCH 2/2] AFS: prevent double cell registration David Howells
0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2008-03-25 19:03 UTC (permalink / raw)
To: torvalds, akpm, svens; +Cc: linux-kernel, dhowells
Add a MAINTAINERS record for AFS
Signed-off-by: David Howells <dhowells@redhat.com>
---
MAINTAINERS | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 73883b8..41d226e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -163,6 +163,12 @@ M: A2232@gmx.net
L: linux-m68k@lists.linux-m68k.org
S: Maintained
+AFS FILESYSTEM & AF_RXRPC SOCKET DOMAIN
+P: David Howells
+M: dhowells@redhat.com
+L: linux-afs@lists.infradead.org
+S: Supported
+
AIO
P: Benjamin LaHaise
M: bcrl@kvack.org
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] AFS: prevent double cell registration
2008-03-25 19:03 [PATCH 1/2] AFS: Add a MAINTAINERS record for AFS David Howells
@ 2008-03-25 19:03 ` David Howells
0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2008-03-25 19:03 UTC (permalink / raw)
To: torvalds, akpm, svens; +Cc: linux-kernel, dhowells
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.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: David Howells <dhowells@redhat.com>
---
fs/afs/cell.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 970d38f..788865d 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -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);
}
/*
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-25 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-25 19:03 [PATCH 1/2] AFS: Add a MAINTAINERS record for AFS David Howells
2008-03-25 19:03 ` [PATCH 2/2] AFS: prevent double cell registration David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®