Skip to content

Commit b016d9a

Browse files
author
Andreas Gruenbacher
committed
gfs2: Save ip from gfs2_glock_nq_init
Before this patch, when a glock was locked by function gfs2_glock_nq_init, it initialized the holder gh_ip (return address) as gfs2_glock_nq_init. That made it extremely difficult to track down problems because many functions call gfs2_glock_nq_init. This patch changes the function so that it saves gh_ip from the caller of gfs2_glock_nq_init, which makes it easy to backtrack which holder took the lock. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
1 parent a500bd3 commit b016d9a

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

fs/gfs2/glock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ static void gfs2_glock_poke(struct gfs2_glock *gl)
911911
struct gfs2_holder gh;
912912
int error;
913913

914-
gfs2_holder_init(gl, LM_ST_SHARED, flags, &gh);
914+
__gfs2_holder_init(gl, LM_ST_SHARED, flags, &gh, _RET_IP_);
915915
error = gfs2_glock_nq(&gh);
916916
if (!error)
917917
gfs2_glock_dq(&gh);
@@ -1208,12 +1208,12 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
12081208
*
12091209
*/
12101210

1211-
void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, u16 flags,
1212-
struct gfs2_holder *gh)
1211+
void __gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, u16 flags,
1212+
struct gfs2_holder *gh, unsigned long ip)
12131213
{
12141214
INIT_LIST_HEAD(&gh->gh_list);
12151215
gh->gh_gl = gl;
1216-
gh->gh_ip = _RET_IP_;
1216+
gh->gh_ip = ip;
12171217
gh->gh_owner_pid = get_pid(task_pid(current));
12181218
gh->gh_state = state;
12191219
gh->gh_flags = flags;

fs/gfs2/glock.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,15 @@ extern int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
190190
extern void gfs2_glock_hold(struct gfs2_glock *gl);
191191
extern void gfs2_glock_put(struct gfs2_glock *gl);
192192
extern void gfs2_glock_queue_put(struct gfs2_glock *gl);
193-
extern void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state,
194-
u16 flags, struct gfs2_holder *gh);
193+
194+
extern void __gfs2_holder_init(struct gfs2_glock *gl, unsigned int state,
195+
u16 flags, struct gfs2_holder *gh,
196+
unsigned long ip);
197+
static inline void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state,
198+
u16 flags, struct gfs2_holder *gh) {
199+
__gfs2_holder_init(gl, state, flags, gh, _RET_IP_);
200+
}
201+
195202
extern void gfs2_holder_reinit(unsigned int state, u16 flags,
196203
struct gfs2_holder *gh);
197204
extern void gfs2_holder_uninit(struct gfs2_holder *gh);
@@ -241,7 +248,7 @@ static inline int gfs2_glock_nq_init(struct gfs2_glock *gl,
241248
{
242249
int error;
243250

244-
gfs2_holder_init(gl, state, flags, gh);
251+
__gfs2_holder_init(gl, state, flags, gh, _RET_IP_);
245252

246253
error = gfs2_glock_nq(gh);
247254
if (error)

0 commit comments

Comments
 (0)