dir.c (bc95f3669f5e6f63cf0b84fe4922c3c6dd4aa775) | dir.c (e6bd07aee739566803425acdbf5cdb29919164e1) |
---|---|
1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * dir.c - Operations for configfs directories. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public 8 * License as published by the Free Software Foundation; either --- 548 unchanged lines hidden (view full) --- 557 if (ret) 558 detach_groups(group); 559 560 return ret; 561} 562 563/* 564 * All of link_obj/unlink_obj/link_group/unlink_group require that | 1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * dir.c - Operations for configfs directories. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public 8 * License as published by the Free Software Foundation; either --- 548 unchanged lines hidden (view full) --- 557 if (ret) 558 detach_groups(group); 559 560 return ret; 561} 562 563/* 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 */ 567 568static void unlink_obj(struct config_item *item) 569{ 570 struct config_group *group; 571 572 group = item->ci_group; 573 if (group) { --- 204 unchanged lines hidden (view full) --- 778 name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL); 779 if (!name) { 780 ret = -ENOMEM; 781 goto out_put; 782 } 783 784 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); 785 | 566 */ 567 568static void unlink_obj(struct config_item *item) 569{ 570 struct config_group *group; 571 572 group = item->ci_group; 573 if (group) { --- 204 unchanged lines hidden (view full) --- 778 name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL); 779 if (!name) { 780 ret = -ENOMEM; 781 goto out_put; 782 } 783 784 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); 785 |
786 down(&subsys->su_sem); | 786 mutex_lock(&subsys->su_mutex); |
787 group = NULL; 788 item = NULL; 789 if (type->ct_group_ops->make_group) { 790 group = type->ct_group_ops->make_group(to_config_group(parent_item), name); 791 if (group) { 792 link_group(to_config_group(parent_item), group); 793 item = &group->cg_item; 794 } 795 } else { 796 item = type->ct_group_ops->make_item(to_config_group(parent_item), name); 797 if (item) 798 link_obj(parent_item, item); 799 } | 787 group = NULL; 788 item = NULL; 789 if (type->ct_group_ops->make_group) { 790 group = type->ct_group_ops->make_group(to_config_group(parent_item), name); 791 if (group) { 792 link_group(to_config_group(parent_item), group); 793 item = &group->cg_item; 794 } 795 } else { 796 item = type->ct_group_ops->make_item(to_config_group(parent_item), name); 797 if (item) 798 link_obj(parent_item, item); 799 } |
800 up(&subsys->su_sem); | 800 mutex_unlock(&subsys->su_mutex); |
801 802 kfree(name); 803 if (!item) { 804 /* 805 * If item == NULL, then link_obj() was never called. 806 * There are no extra references to clean up. 807 */ 808 ret = -ENOMEM; --- 27 unchanged lines hidden (view full) --- 836 if (group) 837 ret = configfs_attach_group(parent_item, item, dentry); 838 else 839 ret = configfs_attach_item(parent_item, item, dentry); 840 841out_unlink: 842 if (ret) { 843 /* Tear down everything we built up */ | 801 802 kfree(name); 803 if (!item) { 804 /* 805 * If item == NULL, then link_obj() was never called. 806 * There are no extra references to clean up. 807 */ 808 ret = -ENOMEM; --- 27 unchanged lines hidden (view full) --- 836 if (group) 837 ret = configfs_attach_group(parent_item, item, dentry); 838 else 839 ret = configfs_attach_item(parent_item, item, dentry); 840 841out_unlink: 842 if (ret) { 843 /* Tear down everything we built up */ |
844 down(&subsys->su_sem); | 844 mutex_lock(&subsys->su_mutex); |
845 if (group) 846 unlink_group(group); 847 else 848 unlink_obj(item); 849 client_drop_item(parent_item, item); | 845 if (group) 846 unlink_group(group); 847 else 848 unlink_obj(item); 849 client_drop_item(parent_item, item); |
850 up(&subsys->su_sem); | 850 mutex_unlock(&subsys->su_mutex); |
851 852 if (module_got) 853 module_put(owner); 854 } 855 856out_put: 857 /* 858 * link_obj()/link_group() took a reference from child->parent, --- 46 unchanged lines hidden (view full) --- 905 config_item_put(parent_item); 906 907 if (item->ci_type) 908 owner = item->ci_type->ct_owner; 909 910 if (sd->s_type & CONFIGFS_USET_DIR) { 911 configfs_detach_group(item); 912 | 851 852 if (module_got) 853 module_put(owner); 854 } 855 856out_put: 857 /* 858 * link_obj()/link_group() took a reference from child->parent, --- 46 unchanged lines hidden (view full) --- 905 config_item_put(parent_item); 906 907 if (item->ci_type) 908 owner = item->ci_type->ct_owner; 909 910 if (sd->s_type & CONFIGFS_USET_DIR) { 911 configfs_detach_group(item); 912 |
913 down(&subsys->su_sem); | 913 mutex_lock(&subsys->su_mutex); |
914 unlink_group(to_config_group(item)); 915 } else { 916 configfs_detach_item(item); 917 | 914 unlink_group(to_config_group(item)); 915 } else { 916 configfs_detach_item(item); 917 |
918 down(&subsys->su_sem); | 918 mutex_lock(&subsys->su_mutex); |
919 unlink_obj(item); 920 } 921 922 client_drop_item(parent_item, item); | 919 unlink_obj(item); 920 } 921 922 client_drop_item(parent_item, item); |
923 up(&subsys->su_sem); | 923 mutex_unlock(&subsys->su_mutex); |
924 925 /* Drop our reference from above */ 926 config_item_put(item); 927 928 module_put(owner); 929 930 return 0; 931} --- 265 unchanged lines hidden --- | 924 925 /* Drop our reference from above */ 926 config_item_put(item); 927 928 module_put(owner); 929 930 return 0; 931} --- 265 unchanged lines hidden --- |