aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/configfs/configfs.txt18
-rw-r--r--Documentation/filesystems/configfs/configfs_example.c2
-rw-r--r--fs/configfs/dir.c16
-rw-r--r--fs/dlm/config.c10
-rw-r--r--fs/ocfs2/cluster/nodemanager.c2
-rw-r--r--include/linux/configfs.h4
6 files changed, 26 insertions, 26 deletions
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
index b34cdb50eab4..21f038e66724 100644
--- a/Documentation/filesystems/configfs/configfs.txt
+++ b/Documentation/filesystems/configfs/configfs.txt
@@ -280,18 +280,18 @@ tells configfs to make the subsystem appear in the file tree.
280 280
281 struct configfs_subsystem { 281 struct configfs_subsystem {
282 struct config_group su_group; 282 struct config_group su_group;
283 struct semaphore su_sem; 283 struct mutex su_mutex;
284 }; 284 };
285 285
286 int configfs_register_subsystem(struct configfs_subsystem *subsys); 286 int configfs_register_subsystem(struct configfs_subsystem *subsys);
287 void configfs_unregister_subsystem(struct configfs_subsystem *subsys); 287 void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
288 288
289 A subsystem consists of a toplevel config_group and a semaphore. 289 A subsystem consists of a toplevel config_group and a mutex.
290The group is where child config_items are created. For a subsystem, 290The group is where child config_items are created. For a subsystem,
291this group is usually defined statically. Before calling 291this group is usually defined statically. Before calling
292configfs_register_subsystem(), the subsystem must have initialized the 292configfs_register_subsystem(), the subsystem must have initialized the
293group via the usual group _init() functions, and it must also have 293group via the usual group _init() functions, and it must also have
294initialized the semaphore. 294initialized the mutex.
295 When the register call returns, the subsystem is live, and it 295 When the register call returns, the subsystem is live, and it
296will be visible via configfs. At that point, mkdir(2) can be called and 296will be visible via configfs. At that point, mkdir(2) can be called and
297the subsystem must be ready for it. 297the subsystem must be ready for it.
@@ -303,7 +303,7 @@ subsystem/group and the simple_child item in configfs_example.c It
303shows a trivial object displaying and storing an attribute, and a simple 303shows a trivial object displaying and storing an attribute, and a simple
304group creating and destroying these children. 304group creating and destroying these children.
305 305
306[Hierarchy Navigation and the Subsystem Semaphore] 306[Hierarchy Navigation and the Subsystem Mutex]
307 307
308There is an extra bonus that configfs provides. The config_groups and 308There is an extra bonus that configfs provides. The config_groups and
309config_items are arranged in a hierarchy due to the fact that they 309config_items are arranged in a hierarchy due to the fact that they
@@ -314,19 +314,19 @@ and config_item->ci_parent structure members.
314 314
315A subsystem can navigate the cg_children list and the ci_parent pointer 315A subsystem can navigate the cg_children list and the ci_parent pointer
316to see the tree created by the subsystem. This can race with configfs' 316to see the tree created by the subsystem. This can race with configfs'
317management of the hierarchy, so configfs uses the subsystem semaphore to 317management of the hierarchy, so configfs uses the subsystem mutex to
318protect modifications. Whenever a subsystem wants to navigate the 318protect modifications. Whenever a subsystem wants to navigate the
319hierarchy, it must do so under the protection of the subsystem 319hierarchy, it must do so under the protection of the subsystem
320semaphore. 320mutex.
321 321
322A subsystem will be prevented from acquiring the semaphore while a newly 322A subsystem will be prevented from acquiring the mutex while a newly
323allocated item has not been linked into this hierarchy. Similarly, it 323allocated item has not been linked into this hierarchy. Similarly, it
324will not be able to acquire the semaphore while a dropping item has not 324will not be able to acquire the mutex while a dropping item has not
325yet been unlinked. This means that an item's ci_parent pointer will 325yet been unlinked. This means that an item's ci_parent pointer will
326never be NULL while the item is in configfs, and that an item will only 326never be NULL while the item is in configfs, and that an item will only
327be in its parent's cg_children list for the same duration. This allows 327be in its parent's cg_children list for the same duration. This allows
328a subsystem to trust ci_parent and cg_children while they hold the 328a subsystem to trust ci_parent and cg_children while they hold the
329semaphore. 329mutex.
330 330
331[Item Aggregation Via symlink(2)] 331[Item Aggregation Via symlink(2)]
332 332
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example.c
index 2d6a14a463e0..e56d49264b39 100644
--- a/Documentation/filesystems/configfs/configfs_example.c
+++ b/Documentation/filesystems/configfs/configfs_example.c
@@ -453,7 +453,7 @@ static int __init configfs_example_init(void)
453 subsys = example_subsys[i]; 453 subsys = example_subsys[i];
454 454
455 config_group_init(&subsys->su_group); 455 config_group_init(&subsys->su_group);
456 init_MUTEX(&subsys->su_sem); 456 mutex_init(&subsys->su_mutex);
457 ret = configfs_register_subsystem(subsys); 457 ret = configfs_register_subsystem(subsys);
458 if (ret) { 458 if (ret) {
459 printk(KERN_ERR "Error %d while registering subsystem %s\n", 459 printk(KERN_ERR "Error %d while registering subsystem %s\n",
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 5e6e37e58f36..d3b1dbb9b5b8 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -562,7 +562,7 @@ static int populate_groups(struct config_group *group)
562 562
563/* 563/*
564 * All of link_obj/unlink_obj/link_group/unlink_group require that 564 * All of link_obj/unlink_obj/link_group/unlink_group require that
565 * subsys->su_sem is held. 565 * subsys->su_mutex is held.
566 */ 566 */
567 567
568static void unlink_obj(struct config_item *item) 568static void unlink_obj(struct config_item *item)
@@ -783,7 +783,7 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
783 783
784 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); 784 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name);
785 785
786 down(&subsys->su_sem); 786 mutex_lock(&subsys->su_mutex);
787 group = NULL; 787 group = NULL;
788 item = NULL; 788 item = NULL;
789 if (type->ct_group_ops->make_group) { 789 if (type->ct_group_ops->make_group) {
@@ -797,7 +797,7 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
797 if (item) 797 if (item)
798 link_obj(parent_item, item); 798 link_obj(parent_item, item);
799 } 799 }
800 up(&subsys->su_sem); 800 mutex_unlock(&subsys->su_mutex);
801 801
802 kfree(name); 802 kfree(name);
803 if (!item) { 803 if (!item) {
@@ -841,13 +841,13 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
841out_unlink: 841out_unlink:
842 if (ret) { 842 if (ret) {
843 /* Tear down everything we built up */ 843 /* Tear down everything we built up */
844 down(&subsys->su_sem); 844 mutex_lock(&subsys->su_mutex);
845 if (group) 845 if (group)
846 unlink_group(group); 846 unlink_group(group);
847 else 847 else
848 unlink_obj(item); 848 unlink_obj(item);
849 client_drop_item(parent_item, item); 849 client_drop_item(parent_item, item);
850 up(&subsys->su_sem); 850 mutex_unlock(&subsys->su_mutex);
851 851
852 if (module_got) 852 if (module_got)
853 module_put(owner); 853 module_put(owner);
@@ -910,17 +910,17 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
910 if (sd->s_type & CONFIGFS_USET_DIR) { 910 if (sd->s_type & CONFIGFS_USET_DIR) {
911 configfs_detach_group(item); 911 configfs_detach_group(item);
912 912
913 down(&subsys->su_sem); 913 mutex_lock(&subsys->su_mutex);
914 unlink_group(to_config_group(item)); 914 unlink_group(to_config_group(item));
915 } else { 915 } else {
916 configfs_detach_item(item); 916 configfs_detach_item(item);
917 917
918 down(&subsys->su_sem); 918 mutex_lock(&subsys->su_mutex);
919 unlink_obj(item); 919 unlink_obj(item);
920 } 920 }
921 921
922 client_drop_item(parent_item, item); 922 client_drop_item(parent_item, item);
923 up(&subsys->su_sem); 923 mutex_unlock(&subsys->su_mutex);
924 924
925 /* Drop our reference from above */ 925 /* Drop our reference from above */
926 config_item_put(item); 926 config_item_put(item);
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 4348cb42cf17..2f8e3c81bc19 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -607,7 +607,7 @@ static struct clusters clusters_root = {
607int dlm_config_init(void) 607int dlm_config_init(void)
608{ 608{
609 config_group_init(&clusters_root.subsys.su_group); 609 config_group_init(&clusters_root.subsys.su_group);
610 init_MUTEX(&clusters_root.subsys.su_sem); 610 mutex_init(&clusters_root.subsys.su_mutex);
611 return configfs_register_subsystem(&clusters_root.subsys); 611 return configfs_register_subsystem(&clusters_root.subsys);
612} 612}
613 613
@@ -751,9 +751,9 @@ static struct space *get_space(char *name)
751 if (!space_list) 751 if (!space_list)
752 return NULL; 752 return NULL;
753 753
754 down(&space_list->cg_subsys->su_sem); 754 mutex_lock(&space_list->cg_subsys->su_mutex);
755 i = config_group_find_item(space_list, name); 755 i = config_group_find_item(space_list, name);
756 up(&space_list->cg_subsys->su_sem); 756 mutex_unlock(&space_list->cg_subsys->su_mutex);
757 757
758 return to_space(i); 758 return to_space(i);
759} 759}
@@ -772,7 +772,7 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr)
772 if (!comm_list) 772 if (!comm_list)
773 return NULL; 773 return NULL;
774 774
775 down(&clusters_root.subsys.su_sem); 775 mutex_lock(&clusters_root.subsys.su_mutex);
776 776
777 list_for_each_entry(i, &comm_list->cg_children, ci_entry) { 777 list_for_each_entry(i, &comm_list->cg_children, ci_entry) {
778 cm = to_comm(i); 778 cm = to_comm(i);
@@ -792,7 +792,7 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr)
792 break; 792 break;
793 } 793 }
794 } 794 }
795 up(&clusters_root.subsys.su_sem); 795 mutex_unlock(&clusters_root.subsys.su_mutex);
796 796
797 if (!found) 797 if (!found)
798 cm = NULL; 798 cm = NULL;
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index 9f5ad0f01ce0..48b77d113cb2 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -934,7 +934,7 @@ static int __init init_o2nm(void)
934 goto out_sysctl; 934 goto out_sysctl;
935 935
936 config_group_init(&o2nm_cluster_group.cs_subsys.su_group); 936 config_group_init(&o2nm_cluster_group.cs_subsys.su_group);
937 init_MUTEX(&o2nm_cluster_group.cs_subsys.su_sem); 937 mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
938 ret = configfs_register_subsystem(&o2nm_cluster_group.cs_subsys); 938 ret = configfs_register_subsystem(&o2nm_cluster_group.cs_subsys);
939 if (ret) { 939 if (ret) {
940 printk(KERN_ERR "nodemanager: Registration returned %d\n", ret); 940 printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index bbb1b6cafa8b..5ce0fc4e3b5b 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -40,9 +40,9 @@
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/list.h> 41#include <linux/list.h>
42#include <linux/kref.h> 42#include <linux/kref.h>
43#include <linux/mutex.h>
43 44
44#include <asm/atomic.h> 45#include <asm/atomic.h>
45#include <asm/semaphore.h>
46 46
47#define CONFIGFS_ITEM_NAME_LEN 20 47#define CONFIGFS_ITEM_NAME_LEN 20
48 48
@@ -174,7 +174,7 @@ struct configfs_group_operations {
174 174
175struct configfs_subsystem { 175struct configfs_subsystem {
176 struct config_group su_group; 176 struct config_group su_group;
177 struct semaphore su_sem; 177 struct mutex su_mutex;
178}; 178};
179 179
180static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group) 180static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)