diff options
-rw-r--r-- | fs/gfs2/glock.c | 34 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 27 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 4 | ||||
-rw-r--r-- | fs/gfs2/trans.c | 32 | ||||
-rw-r--r-- | fs/gfs2/trans.h | 8 |
5 files changed, 52 insertions, 53 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 81b06812b329..6a1b42cf4df4 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/sort.h> | 16 | #include <linux/sort.h> |
17 | #include <linux/jhash.h> | 17 | #include <linux/jhash.h> |
18 | #include <linux/kref.h> | 18 | #include <linux/kref.h> |
19 | #include <linux/kallsyms.h> | ||
19 | #include <linux/gfs2_ondisk.h> | 20 | #include <linux/gfs2_ondisk.h> |
20 | #include <asm/semaphore.h> | 21 | #include <asm/semaphore.h> |
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
@@ -357,6 +358,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, int flags, | |||
357 | { | 358 | { |
358 | INIT_LIST_HEAD(&gh->gh_list); | 359 | INIT_LIST_HEAD(&gh->gh_list); |
359 | gh->gh_gl = gl; | 360 | gh->gh_gl = gl; |
361 | gh->gh_ip = (unsigned long)__builtin_return_address(0); | ||
360 | gh->gh_owner = (flags & GL_NEVER_RECURSE) ? NULL : current; | 362 | gh->gh_owner = (flags & GL_NEVER_RECURSE) ? NULL : current; |
361 | gh->gh_state = state; | 363 | gh->gh_state = state; |
362 | gh->gh_flags = flags; | 364 | gh->gh_flags = flags; |
@@ -388,6 +390,7 @@ void gfs2_holder_reinit(unsigned int state, int flags, struct gfs2_holder *gh) | |||
388 | gh->gh_flags |= GL_LOCAL_EXCL; | 390 | gh->gh_flags |= GL_LOCAL_EXCL; |
389 | 391 | ||
390 | gh->gh_iflags &= 1 << HIF_ALLOCED; | 392 | gh->gh_iflags &= 1 << HIF_ALLOCED; |
393 | gh->gh_ip = (unsigned long)__builtin_return_address(0); | ||
391 | } | 394 | } |
392 | 395 | ||
393 | /** | 396 | /** |
@@ -400,6 +403,7 @@ void gfs2_holder_uninit(struct gfs2_holder *gh) | |||
400 | { | 403 | { |
401 | gfs2_glock_put(gh->gh_gl); | 404 | gfs2_glock_put(gh->gh_gl); |
402 | gh->gh_gl = NULL; | 405 | gh->gh_gl = NULL; |
406 | gh->gh_ip = 0; | ||
403 | } | 407 | } |
404 | 408 | ||
405 | /** | 409 | /** |
@@ -427,7 +431,7 @@ struct gfs2_holder *gfs2_holder_get(struct gfs2_glock *gl, unsigned int state, | |||
427 | 431 | ||
428 | gfs2_holder_init(gl, state, flags, gh); | 432 | gfs2_holder_init(gl, state, flags, gh); |
429 | set_bit(HIF_ALLOCED, &gh->gh_iflags); | 433 | set_bit(HIF_ALLOCED, &gh->gh_iflags); |
430 | 434 | gh->gh_ip = (unsigned long)__builtin_return_address(0); | |
431 | return gh; | 435 | return gh; |
432 | } | 436 | } |
433 | 437 | ||
@@ -1238,6 +1242,9 @@ static int recurse_check(struct gfs2_holder *existing, struct gfs2_holder *new, | |||
1238 | return 0; | 1242 | return 0; |
1239 | 1243 | ||
1240 | fail: | 1244 | fail: |
1245 | print_symbol(KERN_WARNING "GFS2: Existing holder from %s\n", | ||
1246 | existing->gh_ip); | ||
1247 | print_symbol(KERN_WARNING "GFS2: New holder from %s\n", new->gh_ip); | ||
1241 | set_bit(HIF_ABORTED, &new->gh_iflags); | 1248 | set_bit(HIF_ABORTED, &new->gh_iflags); |
1242 | return -EINVAL; | 1249 | return -EINVAL; |
1243 | } | 1250 | } |
@@ -1544,30 +1551,6 @@ int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time) | |||
1544 | } | 1551 | } |
1545 | 1552 | ||
1546 | /** | 1553 | /** |
1547 | * gfs2_glock_nq_init - intialize a holder and enqueue it on a glock | ||
1548 | * @gl: the glock | ||
1549 | * @state: the state we're requesting | ||
1550 | * @flags: the modifier flags | ||
1551 | * @gh: the holder structure | ||
1552 | * | ||
1553 | * Returns: 0, GLR_*, or errno | ||
1554 | */ | ||
1555 | |||
1556 | int gfs2_glock_nq_init(struct gfs2_glock *gl, unsigned int state, int flags, | ||
1557 | struct gfs2_holder *gh) | ||
1558 | { | ||
1559 | int error; | ||
1560 | |||
1561 | gfs2_holder_init(gl, state, flags, gh); | ||
1562 | |||
1563 | error = gfs2_glock_nq(gh); | ||
1564 | if (error) | ||
1565 | gfs2_holder_uninit(gh); | ||
1566 | |||
1567 | return error; | ||
1568 | } | ||
1569 | |||
1570 | /** | ||
1571 | * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it | 1554 | * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it |
1572 | * @gh: the holder structure | 1555 | * @gh: the holder structure |
1573 | * | 1556 | * |
@@ -2334,6 +2317,7 @@ static int dump_holder(char *str, struct gfs2_holder *gh) | |||
2334 | if (test_bit(x, &gh->gh_iflags)) | 2317 | if (test_bit(x, &gh->gh_iflags)) |
2335 | printk(" %u", x); | 2318 | printk(" %u", x); |
2336 | printk(" \n"); | 2319 | printk(" \n"); |
2320 | print_symbol(KERN_INFO " initialized at: %s\n", gh->gh_ip); | ||
2337 | 2321 | ||
2338 | error = 0; | 2322 | error = 0; |
2339 | 2323 | ||
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index 06847ebebdee..560029de8d07 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -106,8 +106,6 @@ void gfs2_glock_force_drop(struct gfs2_glock *gl); | |||
106 | 106 | ||
107 | int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time); | 107 | int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time); |
108 | 108 | ||
109 | int gfs2_glock_nq_init(struct gfs2_glock *gl, unsigned int state, int flags, | ||
110 | struct gfs2_holder *gh); | ||
111 | void gfs2_glock_dq_uninit(struct gfs2_holder *gh); | 109 | void gfs2_glock_dq_uninit(struct gfs2_holder *gh); |
112 | int gfs2_glock_nq_num(struct gfs2_sbd *sdp, | 110 | int gfs2_glock_nq_num(struct gfs2_sbd *sdp, |
113 | uint64_t number, struct gfs2_glock_operations *glops, | 111 | uint64_t number, struct gfs2_glock_operations *glops, |
@@ -121,6 +119,31 @@ void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number, | |||
121 | struct gfs2_glock_operations *glops, | 119 | struct gfs2_glock_operations *glops, |
122 | unsigned int state, int flags); | 120 | unsigned int state, int flags); |
123 | 121 | ||
122 | /** | ||
123 | * gfs2_glock_nq_init - intialize a holder and enqueue it on a glock | ||
124 | * @gl: the glock | ||
125 | * @state: the state we're requesting | ||
126 | * @flags: the modifier flags | ||
127 | * @gh: the holder structure | ||
128 | * | ||
129 | * Returns: 0, GLR_*, or errno | ||
130 | */ | ||
131 | |||
132 | static inline int gfs2_glock_nq_init(struct gfs2_glock *gl, | ||
133 | unsigned int state, int flags, | ||
134 | struct gfs2_holder *gh) | ||
135 | { | ||
136 | int error; | ||
137 | |||
138 | gfs2_holder_init(gl, state, flags, gh); | ||
139 | |||
140 | error = gfs2_glock_nq(gh); | ||
141 | if (error) | ||
142 | gfs2_holder_uninit(gh); | ||
143 | |||
144 | return error; | ||
145 | } | ||
146 | |||
124 | /* Lock Value Block functions */ | 147 | /* Lock Value Block functions */ |
125 | 148 | ||
126 | int gfs2_lvb_hold(struct gfs2_glock *gl); | 149 | int gfs2_lvb_hold(struct gfs2_glock *gl); |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 35163b562460..b5a994d1b5f7 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -161,6 +161,7 @@ struct gfs2_holder { | |||
161 | int gh_error; | 161 | int gh_error; |
162 | unsigned long gh_iflags; | 162 | unsigned long gh_iflags; |
163 | struct completion gh_wait; | 163 | struct completion gh_wait; |
164 | unsigned long gh_ip; | ||
164 | }; | 165 | }; |
165 | 166 | ||
166 | enum { | 167 | enum { |
@@ -353,8 +354,7 @@ struct gfs2_log_buf { | |||
353 | }; | 354 | }; |
354 | 355 | ||
355 | struct gfs2_trans { | 356 | struct gfs2_trans { |
356 | char *tr_file; | 357 | unsigned long tr_ip; |
357 | unsigned int tr_line; | ||
358 | 358 | ||
359 | unsigned int tr_blocks; | 359 | unsigned int tr_blocks; |
360 | unsigned int tr_revokes; | 360 | unsigned int tr_revokes; |
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index aa1a619f0854..3fae3d4e9ae4 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/gfs2_ondisk.h> | 15 | #include <linux/gfs2_ondisk.h> |
16 | #include <linux/kallsyms.h> | ||
16 | #include <asm/semaphore.h> | 17 | #include <asm/semaphore.h> |
17 | 18 | ||
18 | #include "gfs2.h" | 19 | #include "gfs2.h" |
@@ -25,24 +26,20 @@ | |||
25 | #include "trans.h" | 26 | #include "trans.h" |
26 | #include "util.h" | 27 | #include "util.h" |
27 | 28 | ||
28 | int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks, | 29 | int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, |
29 | unsigned int revokes, char *file, unsigned int line) | 30 | unsigned int revokes) |
30 | { | 31 | { |
31 | struct gfs2_trans *tr; | 32 | struct gfs2_trans *tr; |
32 | int error; | 33 | int error; |
33 | 34 | ||
34 | if (gfs2_assert_warn(sdp, !current->journal_info) || | 35 | BUG_ON(current->journal_info); |
35 | gfs2_assert_warn(sdp, blocks || revokes)) { | 36 | BUG_ON(blocks == 0 && revokes == 0); |
36 | fs_warn(sdp, "(%s, %u)\n", file, line); | ||
37 | return -EINVAL; | ||
38 | } | ||
39 | 37 | ||
40 | tr = kzalloc(sizeof(struct gfs2_trans), GFP_NOFS); | 38 | tr = kzalloc(sizeof(struct gfs2_trans), GFP_NOFS); |
41 | if (!tr) | 39 | if (!tr) |
42 | return -ENOMEM; | 40 | return -ENOMEM; |
43 | 41 | ||
44 | tr->tr_file = file; | 42 | tr->tr_ip = (unsigned long)__builtin_return_address(0); |
45 | tr->tr_line = line; | ||
46 | tr->tr_blocks = blocks; | 43 | tr->tr_blocks = blocks; |
47 | tr->tr_revokes = revokes; | 44 | tr->tr_revokes = revokes; |
48 | tr->tr_reserved = 1; | 45 | tr->tr_reserved = 1; |
@@ -104,16 +101,15 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) | |||
104 | return; | 101 | return; |
105 | } | 102 | } |
106 | 103 | ||
107 | if (gfs2_assert_withdraw(sdp, tr->tr_num_buf <= tr->tr_blocks)) | 104 | if (gfs2_assert_withdraw(sdp, tr->tr_num_buf <= tr->tr_blocks)) { |
108 | fs_err(sdp, "tr_num_buf = %u, tr_blocks = %u " | 105 | fs_err(sdp, "tr_num_buf = %u, tr_blocks = %u ", |
109 | "tr_file = %s, tr_line = %u\n", | 106 | tr->tr_num_buf, tr->tr_blocks); |
110 | tr->tr_num_buf, tr->tr_blocks, | 107 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); |
111 | tr->tr_file, tr->tr_line); | 108 | } |
112 | if (gfs2_assert_withdraw(sdp, tr->tr_num_revoke <= tr->tr_revokes)) | 109 | if (gfs2_assert_withdraw(sdp, tr->tr_num_revoke <= tr->tr_revokes)) |
113 | fs_err(sdp, "tr_num_revoke = %u, tr_revokes = %u " | 110 | fs_err(sdp, "tr_num_revoke = %u, tr_revokes = %u ", |
114 | "tr_file = %s, tr_line = %u\n", | 111 | tr->tr_num_revoke, tr->tr_revokes); |
115 | tr->tr_num_revoke, tr->tr_revokes, | 112 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); |
116 | tr->tr_file, tr->tr_line); | ||
117 | 113 | ||
118 | gfs2_log_commit(sdp, tr); | 114 | gfs2_log_commit(sdp, tr); |
119 | 115 | ||
diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h index f7f3e2a3d590..6b5e9e8bf561 100644 --- a/fs/gfs2/trans.h +++ b/fs/gfs2/trans.h | |||
@@ -21,12 +21,8 @@ | |||
21 | #define RES_STATFS 1 | 21 | #define RES_STATFS 1 |
22 | #define RES_QUOTA 2 | 22 | #define RES_QUOTA 2 |
23 | 23 | ||
24 | #define gfs2_trans_begin(sdp, blocks, revokes) \ | 24 | int gfs2_trans_begin(struct gfs2_sbd *sdp, |
25 | gfs2_trans_begin_i((sdp), (blocks), (revokes), __FILE__, __LINE__) | 25 | unsigned int blocks, unsigned int revokes); |
26 | |||
27 | int gfs2_trans_begin_i(struct gfs2_sbd *sdp, | ||
28 | unsigned int blocks, unsigned int revokes, | ||
29 | char *file, unsigned int line); | ||
30 | 26 | ||
31 | void gfs2_trans_end(struct gfs2_sbd *sdp); | 27 | void gfs2_trans_end(struct gfs2_sbd *sdp); |
32 | 28 | ||