diff options
author | Bob Peterson <rpeterso@redhat.com> | 2020-02-17 14:15:05 -0600 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2020-02-27 07:53:18 -0600 |
commit | c9ebc4b737999ab1f3264c42431f7be80ac2efbf (patch) | |
tree | 018f1b3a5884c1c3be8cae99a19a3ec45dcbf0dc | |
parent | 019dd669bde14bc0748bc43af2f96e2c5e37d3f8 (diff) |
gfs2: allow journal replay to hold sd_log_flush_lock
Before this patch, journal replays could stomp on log flushes
and each other because both log flushes and journal replays used
the same sd_log_bio. Function gfs2_log_flush prevents other log
flushes from interfering by taking the sd_log_flush_lock rwsem
during the flush. However, it does not protect against journal
replays. This patch allows the journal replay to take the same
sd_log_flush_lock rwsem so use of the sd_log_bio is not stomped.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r-- | fs/gfs2/recovery.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index 8cc26bef4e64..21fc44b31863 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c @@ -398,6 +398,10 @@ void gfs2_recover_func(struct work_struct *work) fs_info(sdp, "jid=%u: Replaying journal...0x%x to 0x%x\n", jd->jd_jid, head.lh_tail, head.lh_blkno); + /* We take the sd_log_flush_lock here primarily to prevent log + * flushes and simultaneous journal replays from stomping on + * each other wrt sd_log_bio. */ + down_write(&sdp->sd_log_flush_lock); for (pass = 0; pass < 2; pass++) { lops_before_scan(jd, &head, pass); error = foreach_descriptor(jd, head.lh_tail, @@ -408,6 +412,7 @@ void gfs2_recover_func(struct work_struct *work) } clean_journal(jd, &head); + up_write(&sdp->sd_log_flush_lock); gfs2_glock_dq_uninit(&thaw_gh); t_rep = ktime_get(); |