Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 365735 | Differences between
and this patch

Collapse All | Expand All

(-)kernel/block-io.c (-2 / +2 lines)
Lines 162-168 Link Here
162
	if (!bio_data->path)
162
	if (!bio_data->path)
163
		return -ENOMEM;
163
		return -ENOMEM;
164
164
165
	bdev = open_bdev_exclusive(path, flags, THIS_MODULE);
165
	bdev = blkdev_get_by_path(path, flags, THIS_MODULE);
166
	if (IS_ERR(bdev)) {
166
	if (IS_ERR(bdev)) {
167
		err = PTR_ERR(bdev);
167
		err = PTR_ERR(bdev);
168
		eprintk("Can't open device %s, error %d\n", path, err);
168
		eprintk("Can't open device %s, error %d\n", path, err);
Lines 253-259 Link Here
253
	int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
253
	int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
254
254
255
	if (bio_data->bdev)
255
	if (bio_data->bdev)
256
		close_bdev_exclusive(bio_data->bdev, flags);
256
		blkdev_put(bio_data->bdev, flags);
257
	kfree(bio_data->path);
257
	kfree(bio_data->path);
258
258
259
	kfree(volume->private);
259
	kfree(volume->private);
(-)kernel/config.c (-5 / +5 lines)
Lines 9-15 Link Here
9
#include "iscsi.h"
9
#include "iscsi.h"
10
#include "iscsi_dbg.h"
10
#include "iscsi_dbg.h"
11
11
12
static DECLARE_MUTEX(ioctl_sem);
12
static DEFINE_MUTEX(ioctl_mutex);
13
13
14
struct proc_entries {
14
struct proc_entries {
15
	const char *name;
15
	const char *name;
Lines 258-264 Link Here
258
	long err;
258
	long err;
259
	u32 id;
259
	u32 id;
260
260
261
	err = down_interruptible(&ioctl_sem);
261
	err = mutex_lock_interruptible(&ioctl_mutex);
262
	if (err < 0)
262
	if (err < 0)
263
		return err;
263
		return err;
264
264
Lines 339-345 Link Here
339
339
340
	target_unlock(target);
340
	target_unlock(target);
341
done:
341
done:
342
	up(&ioctl_sem);
342
	mutex_unlock(&ioctl_mutex);
343
343
344
	return err;
344
	return err;
345
}
345
}
Lines 347-355 Link Here
347
static int release(struct inode *i __attribute__((unused)),
347
static int release(struct inode *i __attribute__((unused)),
348
		   struct file *f __attribute__((unused)))
348
		   struct file *f __attribute__((unused)))
349
{
349
{
350
	down(&ioctl_sem);
350
	mutex_lock(&ioctl_mutex);
351
	target_del_all();
351
	target_del_all();
352
	up(&ioctl_sem);
352
	mutex_unlock(&ioctl_mutex);
353
353
354
	return 0;
354
	return 0;
355
}
355
}
(-)kernel/conn.c (-1 / +1 lines)
Lines 44-50 Link Here
44
		switch (sk->sk_family) {
44
		switch (sk->sk_family) {
45
		case AF_INET:
45
		case AF_INET:
46
			snprintf(buf, sizeof(buf),
46
			snprintf(buf, sizeof(buf),
47
				 "%pI4", inet_sk(sk)->inet_daddr);
47
				 "%pI4", (void *)inet_sk(sk)->inet_daddr);
48
			break;
48
			break;
49
		case AF_INET6:
49
		case AF_INET6:
50
			snprintf(buf, sizeof(buf), "[%pI6]",
50
			snprintf(buf, sizeof(buf), "[%pI6]",
(-)kernel/iscsi.h (-1 / +1 lines)
Lines 130-136 Link Here
130
	/* Points either to own list or global pool */
130
	/* Points either to own list or global pool */
131
	struct worker_thread_info * wthread_info;
131
	struct worker_thread_info * wthread_info;
132
132
133
	struct semaphore target_sem;
133
	struct mutex target_mutex;
134
};
134
};
135
135
136
struct iscsi_queue {
136
struct iscsi_queue {
(-)kernel/target.c (-17 / +19 lines)
Lines 4-9 Link Here
4
 * Released under the terms of the GNU GPL v2.0.
4
 * Released under the terms of the GNU GPL v2.0.
5
 */
5
 */
6
6
7
#include <linux/mutex.h>
8
7
#include "iscsi.h"
9
#include "iscsi.h"
8
#include "digest.h"
10
#include "digest.h"
9
#include "iscsi_dbg.h"
11
#include "iscsi_dbg.h"
Lines 11-17 Link Here
11
#define	MAX_NR_TARGETS	(1UL << 30)
13
#define	MAX_NR_TARGETS	(1UL << 30)
12
14
13
static LIST_HEAD(target_list);
15
static LIST_HEAD(target_list);
14
static DECLARE_MUTEX(target_list_sem);
16
static DEFINE_MUTEX(target_list_mutex);
15
static u32 next_target_id;
17
static u32 next_target_id;
16
static u32 nr_targets;
18
static u32 nr_targets;
17
19
Lines 48-63 Link Here
48
	int err = 0;
50
	int err = 0;
49
51
50
	if (interruptible)
52
	if (interruptible)
51
		err = down_interruptible(&target->target_sem);
53
		err = mutex_lock_interruptible(&target->target_mutex);
52
	else
54
	else
53
		down(&target->target_sem);
55
		mutex_lock(&target->target_mutex);
54
56
55
	return err;
57
	return err;
56
}
58
}
57
59
58
inline void target_unlock(struct iscsi_target *target)
60
inline void target_unlock(struct iscsi_target *target)
59
{
61
{
60
	up(&target->target_sem);
62
	mutex_unlock(&target->target_mutex);
61
}
63
}
62
64
63
static struct iscsi_target *__target_lookup_by_id(u32 id)
65
static struct iscsi_target *__target_lookup_by_id(u32 id)
Lines 86-94 Link Here
86
{
88
{
87
	struct iscsi_target *target;
89
	struct iscsi_target *target;
88
90
89
	down(&target_list_sem);
91
	mutex_lock(&target_list_mutex);
90
	target = __target_lookup_by_id(id);
92
	target = __target_lookup_by_id(id);
91
	up(&target_list_sem);
93
	mutex_unlock(&target_list_mutex);
92
94
93
	return target;
95
	return target;
94
}
96
}
Lines 157-163 Link Here
157
159
158
	strncpy(target->name, name, sizeof(target->name) - 1);
160
	strncpy(target->name, name, sizeof(target->name) - 1);
159
161
160
	init_MUTEX(&target->target_sem);
162
	mutex_init(&target->target_mutex);
161
	spin_lock_init(&target->session_list_lock);
163
	spin_lock_init(&target->session_list_lock);
162
164
163
	INIT_LIST_HEAD(&target->session_list);
165
	INIT_LIST_HEAD(&target->session_list);
Lines 195-201 Link Here
195
	u32 tid = info->tid;
197
	u32 tid = info->tid;
196
	int err;
198
	int err;
197
199
198
	err = down_interruptible(&target_list_sem);
200
	err = mutex_lock_interruptible(&target_list_mutex);
199
	if (err < 0)
201
	if (err < 0)
200
		return err;
202
		return err;
201
203
Lines 204-210 Link Here
204
		goto out;
206
		goto out;
205
	}
207
	}
206
208
207
	if (__target_lookup_by_name(info->name) || 
209
	if (__target_lookup_by_name(info->name) ||
208
			(tid && __target_lookup_by_id(tid))) {
210
			(tid && __target_lookup_by_id(tid))) {
209
		err = -EEXIST;
211
		err = -EEXIST;
210
		goto out;
212
		goto out;
Lines 223-229 Link Here
223
	if (!err)
225
	if (!err)
224
		nr_targets++;
226
		nr_targets++;
225
out:
227
out:
226
	up(&target_list_sem);
228
	mutex_unlock(&target_list_mutex);
227
229
228
	return err;
230
	return err;
229
}
231
}
Lines 248-254 Link Here
248
	module_put(THIS_MODULE);
250
	module_put(THIS_MODULE);
249
}
251
}
250
252
251
/* @locking: target_list_sem must be locked */
253
/* @locking: target_list_mutex must be locked */
252
static int __target_del(struct iscsi_target *target)
254
static int __target_del(struct iscsi_target *target)
253
{
255
{
254
	int err;
256
	int err;
Lines 283-289 Link Here
283
	struct iscsi_target *target;
285
	struct iscsi_target *target;
284
	int err;
286
	int err;
285
287
286
	err = down_interruptible(&target_list_sem);
288
	err = mutex_lock_interruptible(&target_list_mutex);
287
	if (err < 0)
289
	if (err < 0)
288
		return err;
290
		return err;
289
291
Lines 295-301 Link Here
295
297
296
	err = __target_del(target);
298
	err = __target_del(target);
297
out:
299
out:
298
	up(&target_list_sem);
300
	mutex_unlock(&target_list_mutex);
299
301
300
	return err;
302
	return err;
301
}
303
}
Lines 305-311 Link Here
305
	struct iscsi_target *target, *tmp;
307
	struct iscsi_target *target, *tmp;
306
	int err;
308
	int err;
307
309
308
	down(&target_list_sem);
310
	mutex_lock(&target_list_mutex);
309
311
310
	if (!list_empty(&target_list))
312
	if (!list_empty(&target_list))
311
		iprintk("Removing all connections, sessions and targets\n");
313
		iprintk("Removing all connections, sessions and targets\n");
Lines 319-325 Link Here
319
321
320
	next_target_id = 0;
322
	next_target_id = 0;
321
323
322
	up(&target_list_sem);
324
	mutex_unlock(&target_list_mutex);
323
}
325
}
324
326
325
static void *iet_seq_start(struct seq_file *m, loff_t *pos)
327
static void *iet_seq_start(struct seq_file *m, loff_t *pos)
Lines 327-333 Link Here
327
	int err;
329
	int err;
328
330
329
	/* are you sure this is to be interruptible? */
331
	/* are you sure this is to be interruptible? */
330
	err = down_interruptible(&target_list_sem);
332
	err = mutex_lock_interruptible(&target_list_mutex);
331
	if (err < 0)
333
	if (err < 0)
332
		return ERR_PTR(err);
334
		return ERR_PTR(err);
333
335
Lines 341-347 Link Here
341
343
342
static void iet_seq_stop(struct seq_file *m, void *v)
344
static void iet_seq_stop(struct seq_file *m, void *v)
343
{
345
{
344
	up(&target_list_sem);
346
	mutex_unlock(&target_list_mutex);
345
}
347
}
346
348
347
static int iet_seq_show(struct seq_file *m, void *p)
349
static int iet_seq_show(struct seq_file *m, void *p)
(-)kernel/wthread.c (-3 / +6 lines)
Lines 71-79 Link Here
71
71
72
	if (!current->io_context)
72
	if (!current->io_context)
73
		eprintk("%s\n", "Failed to get IO context");
73
		eprintk("%s\n", "Failed to get IO context");
74
	else if (info->wthread_ioc)
74
	else if (info->wthread_ioc &&
75
		copy_io_context(&current->io_context, &info->wthread_ioc);
75
			atomic_long_read(&info->wthread_ioc->refcount)) {
76
	else
76
		atomic_long_inc(&info->wthread_ioc->refcount);
77
		put_io_context(current->io_context);
78
		current->io_context = info->wthread_ioc;
79
	} else
77
		info->wthread_ioc = current->io_context;
80
		info->wthread_ioc = current->io_context;
78
81
79
	add_wait_queue(&info->wthread_sleep, &wait);
82
	add_wait_queue(&info->wthread_sleep, &wait);

Return to bug 365735