diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-07-17 17:53:48 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2008-07-17 17:53:48 -0400 |
commit | f89ab8619e5320cc9c2576f5f8dcbaf6c0ba3950 (patch) | |
tree | e703050b232c76de7cb25afd63a2b4dd885c4bb9 /fs/ocfs2/cluster/nodemanager.c | |
parent | 5b664cb235e97afbf34db9c4d77f08ebd725335e (diff) |
Revert "configfs: Allow ->make_item() and ->make_group() to return detailed errors."
This reverts commit 11c3b79218390a139f2d474ee1e983a672d5839a. The code
will move to PTR_ERR().
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster/nodemanager.c')
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index b364b7052e46..cfdb08b484ed 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
@@ -644,32 +644,27 @@ out: | |||
644 | return ret; | 644 | return ret; |
645 | } | 645 | } |
646 | 646 | ||
647 | static int o2nm_node_group_make_item(struct config_group *group, | 647 | static struct config_item *o2nm_node_group_make_item(struct config_group *group, |
648 | const char *name, | 648 | const char *name) |
649 | struct config_item **new_item) | ||
650 | { | 649 | { |
651 | struct o2nm_node *node = NULL; | 650 | struct o2nm_node *node = NULL; |
652 | int ret = 0; | 651 | struct config_item *ret = NULL; |
653 | 652 | ||
654 | if (strlen(name) > O2NM_MAX_NAME_LEN) { | 653 | if (strlen(name) > O2NM_MAX_NAME_LEN) |
655 | ret = -ENAMETOOLONG; | 654 | goto out; /* ENAMETOOLONG */ |
656 | goto out; | ||
657 | } | ||
658 | 655 | ||
659 | node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); | 656 | node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); |
660 | if (node == NULL) { | 657 | if (node == NULL) |
661 | ret = -ENOMEM; | 658 | goto out; /* ENOMEM */ |
662 | goto out; | ||
663 | } | ||
664 | 659 | ||
665 | strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ | 660 | strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ |
666 | config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); | 661 | config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); |
667 | spin_lock_init(&node->nd_lock); | 662 | spin_lock_init(&node->nd_lock); |
668 | 663 | ||
669 | *new_item = &node->nd_item; | 664 | ret = &node->nd_item; |
670 | 665 | ||
671 | out: | 666 | out: |
672 | if (ret) | 667 | if (ret == NULL) |
673 | kfree(node); | 668 | kfree(node); |
674 | 669 | ||
675 | return ret; | 670 | return ret; |
@@ -756,31 +751,25 @@ static struct o2nm_cluster_group *to_o2nm_cluster_group(struct config_group *gro | |||
756 | } | 751 | } |
757 | #endif | 752 | #endif |
758 | 753 | ||
759 | static int o2nm_cluster_group_make_group(struct config_group *group, | 754 | static struct config_group *o2nm_cluster_group_make_group(struct config_group *group, |
760 | const char *name, | 755 | const char *name) |
761 | struct config_group **new_group) | ||
762 | { | 756 | { |
763 | struct o2nm_cluster *cluster = NULL; | 757 | struct o2nm_cluster *cluster = NULL; |
764 | struct o2nm_node_group *ns = NULL; | 758 | struct o2nm_node_group *ns = NULL; |
765 | struct config_group *o2hb_group = NULL; | 759 | struct config_group *o2hb_group = NULL, *ret = NULL; |
766 | void *defs = NULL; | 760 | void *defs = NULL; |
767 | int ret = 0; | ||
768 | 761 | ||
769 | /* this runs under the parent dir's i_mutex; there can be only | 762 | /* this runs under the parent dir's i_mutex; there can be only |
770 | * one caller in here at a time */ | 763 | * one caller in here at a time */ |
771 | if (o2nm_single_cluster) { | 764 | if (o2nm_single_cluster) |
772 | ret = -ENOSPC; | 765 | goto out; /* ENOSPC */ |
773 | goto out; | ||
774 | } | ||
775 | 766 | ||
776 | cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); | 767 | cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); |
777 | ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); | 768 | ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); |
778 | defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL); | 769 | defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL); |
779 | o2hb_group = o2hb_alloc_hb_set(); | 770 | o2hb_group = o2hb_alloc_hb_set(); |
780 | if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL) { | 771 | if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL) |
781 | ret = -ENOMEM; | ||
782 | goto out; | 772 | goto out; |
783 | } | ||
784 | 773 | ||
785 | config_group_init_type_name(&cluster->cl_group, name, | 774 | config_group_init_type_name(&cluster->cl_group, name, |
786 | &o2nm_cluster_type); | 775 | &o2nm_cluster_type); |
@@ -797,11 +786,11 @@ static int o2nm_cluster_group_make_group(struct config_group *group, | |||
797 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; | 786 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; |
798 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; | 787 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; |
799 | 788 | ||
800 | *new_group = &cluster->cl_group; | 789 | ret = &cluster->cl_group; |
801 | o2nm_single_cluster = cluster; | 790 | o2nm_single_cluster = cluster; |
802 | 791 | ||
803 | out: | 792 | out: |
804 | if (ret) { | 793 | if (ret == NULL) { |
805 | kfree(cluster); | 794 | kfree(cluster); |
806 | kfree(ns); | 795 | kfree(ns); |
807 | o2hb_free_hb_set(o2hb_group); | 796 | o2hb_free_hb_set(o2hb_group); |