aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2007-07-07 02:33:17 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2007-07-10 20:10:56 -0400
commite6bd07aee739566803425acdbf5cdb29919164e1 (patch)
treee085a5065d06af2b7c0cab8bcd8fb4eb289344be /fs
parent3fe6c5ce1176cf661dbe71fc43b627c1a742a89a (diff)
configfs: Convert subsystem semaphore to mutex
Convert the su_sem member of struct configfs_subsystem to a struct mutex, as that's what it is. Also convert all the users and update Documentation/configfs.txt and Documentation/configfs_example.c accordingly. [ Conflict in fs/dlm/config.c with commit 3168b0780d06ace875696f8a648d04d6089654e5 manually resolved. --Mark ] Inspired-by: Satyam Sharma <ssatyam@cse.iitk.ac.in> Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/configfs/dir.c16
-rw-r--r--fs/dlm/config.c10
-rw-r--r--fs/ocfs2/cluster/nodemanager.c2
3 files changed, 14 insertions, 14 deletions
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);