summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2022-01-14 09:05:13 +0100
committerAndreas Gruenbacher <agruenba@redhat.com>2022-02-15 15:01:40 +0100
commita4e8145edcfd66b69056c59885770b428eccca59 (patch)
treead4979d4bcc381fa2c36082900350d6618570a8a /fs/gfs2/glock.c
parent5a27a43efd1d5cd55dd5988cac596bdea7294d73 (diff)
downloadlinux-stable-a4e8145edcfd66b69056c59885770b428eccca59.tar.gz
linux-stable-a4e8145edcfd66b69056c59885770b428eccca59.tar.bz2
linux-stable-a4e8145edcfd66b69056c59885770b428eccca59.zip
gfs2: Initialize gh_error in gfs2_glock_nq
The gh_error field if a glock holder is initialized to zero in gfs2_holder_init(). When a locking operation fails, gh_error is set to an error code; when it succeeds, the gh_error value is left unchanged. The field isn't initialized in gfs2_holder_reinit(), which is a problem. Instead of fixing that directly, initialize gh_error in gfs2_glock_nq(). That also obsoletes the assignment in do_flock(). Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index a12bb3e8cb9c..630c6550eacf 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1261,7 +1261,6 @@ void __gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, u16 flags,
gh->gh_owner_pid = get_pid(task_pid(current));
gh->gh_state = state;
gh->gh_flags = flags;
- gh->gh_error = 0;
gh->gh_iflags = 0;
gfs2_glock_hold(gl);
}
@@ -1567,6 +1566,7 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
if (test_bit(GLF_LRU, &gl->gl_flags))
gfs2_glock_remove_from_lru(gl);
+ gh->gh_error = 0;
spin_lock(&gl->gl_lockref.lock);
add_to_queue(gh);
if (unlikely((LM_FLAG_NOEXP & gh->gh_flags) &&