Lines Matching refs:mg

86 static void __mount_group_release(struct mount_group *mg)  in __mount_group_release()  argument
90 for (i = 0; i < mg->num_sessions; i++) in __mount_group_release()
91 cifs_put_smb_ses(mg->sessions[i]); in __mount_group_release()
92 kfree(mg); in __mount_group_release()
97 struct mount_group *mg = container_of(kref, struct mount_group, refcount); in mount_group_release() local
100 list_del(&mg->list); in mount_group_release()
102 __mount_group_release(mg); in mount_group_release()
107 struct mount_group *mg; in find_mount_group_locked() local
109 list_for_each_entry(mg, &mount_group_list, list) { in find_mount_group_locked()
110 if (uuid_equal(&mg->id, id)) in find_mount_group_locked()
111 return mg; in find_mount_group_locked()
118 struct mount_group *mg; in __get_mount_group_locked() local
120 mg = find_mount_group_locked(id); in __get_mount_group_locked()
121 if (!IS_ERR(mg)) in __get_mount_group_locked()
122 return mg; in __get_mount_group_locked()
124 mg = kmalloc(sizeof(*mg), GFP_KERNEL); in __get_mount_group_locked()
125 if (!mg) in __get_mount_group_locked()
127 kref_init(&mg->refcount); in __get_mount_group_locked()
128 uuid_copy(&mg->id, id); in __get_mount_group_locked()
129 mg->num_sessions = 0; in __get_mount_group_locked()
130 spin_lock_init(&mg->lock); in __get_mount_group_locked()
131 list_add(&mg->list, &mount_group_list); in __get_mount_group_locked()
132 return mg; in __get_mount_group_locked()
137 struct mount_group *mg; in get_mount_group() local
140 mg = __get_mount_group_locked(id); in get_mount_group()
141 if (!IS_ERR(mg)) in get_mount_group()
142 kref_get(&mg->refcount); in get_mount_group()
145 return mg; in get_mount_group()
150 struct mount_group *mg, *tmp_mg; in free_mount_group_list() local
152 list_for_each_entry_safe(mg, tmp_mg, &mount_group_list, list) { in free_mount_group_list()
153 list_del_init(&mg->list); in free_mount_group_list()
154 __mount_group_release(mg); in free_mount_group_list()
1122 struct mount_group *mg; in dfs_cache_add_refsrv_session() local
1127 mg = get_mount_group(mount_id); in dfs_cache_add_refsrv_session()
1128 if (WARN_ON_ONCE(IS_ERR(mg))) in dfs_cache_add_refsrv_session()
1131 spin_lock(&mg->lock); in dfs_cache_add_refsrv_session()
1132 if (mg->num_sessions < ARRAY_SIZE(mg->sessions)) in dfs_cache_add_refsrv_session()
1133 mg->sessions[mg->num_sessions++] = ses; in dfs_cache_add_refsrv_session()
1134 spin_unlock(&mg->lock); in dfs_cache_add_refsrv_session()
1135 kref_put(&mg->refcount, mount_group_release); in dfs_cache_add_refsrv_session()
1147 struct mount_group *mg; in dfs_cache_put_refsrv_sessions() local
1153 mg = find_mount_group_locked(mount_id); in dfs_cache_put_refsrv_sessions()
1154 if (IS_ERR(mg)) { in dfs_cache_put_refsrv_sessions()
1159 kref_put(&mg->refcount, mount_group_release); in dfs_cache_put_refsrv_sessions()