From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Fri, 30 Oct 2015 11:14:02 +0000 Subject: [Cluster-devel] [GFS2 PATCH v3 03/14] GFS2: Protect log tail calculations with inside locks In-Reply-To: <1445542222-30672-4-git-send-email-rpeterso@redhat.com> References: <1445542222-30672-1-git-send-email-rpeterso@redhat.com> <1445542222-30672-4-git-send-email-rpeterso@redhat.com> Message-ID: <563350FA.10300@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, sd_log_tail should be protected by sdp->sd_log_flush_lock, so is that not happening for some reason? Steve. On 22/10/15 20:30, Bob Peterson wrote: > This patch moves the variables "old_tail" and "wrap" in function > gfs2_ail2_empty_one inside the protective spin_lock so they can't > be moved by another process. If the calculations aren't protected, > the log's tail may not be properly pulled, which eventually makes > it seem like there isn't enough room in the journal for more > transactions. This results in a hang where GFS2 repeatedly does > log flushes without making any progress. > > Signed-off-by: Bob Peterson > --- > fs/gfs2/log.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c > index 536e7a6..18959de 100644 > --- a/fs/gfs2/log.c > +++ b/fs/gfs2/log.c > @@ -277,11 +277,12 @@ static void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_trans *tr) > static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail) > { > struct gfs2_trans *tr, *safe; > - unsigned int old_tail = sdp->sd_log_tail; > - int wrap = (new_tail < old_tail); > - int a, b, rm; > + unsigned int old_tail; > + int wrap, a, b, rm; > > spin_lock(&sdp->sd_ail_lock); > + old_tail = sdp->sd_log_tail; > + wrap = (new_tail < old_tail); > > list_for_each_entry_safe(tr, safe, &sdp->sd_ail2_list, tr_list) { > a = (old_tail <= tr->tr_first);