All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 1/4] [GFS2] flush the glock completely in inode_go_sync
Date: Mon, 18 Jun 2007 15:54:27 +0100	[thread overview]
Message-ID: <1182178478593-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <11821784703600-git-send-email-swhiteho@redhat.com>


Fix for bz #231910
When filemap_fdatawrite() is called on the inode mapping in data=ordered mode,
it will add the glock to the log. In inode_go_sync(), if you do the
gfs2_log_flush() before this, after the filemap_fdatawrite() call, the glock
and its associated data buffers will be on the log again. This means you can
demote a lock from exclusive, without having it flushed from the log. The
attached patch simply moves the gfs2_log_flush up to after the
filemap_fdatawrite() call.

Originally, I tried moving the gfs2_log_flush to after gfs2_meta_sync(), but
that caused me to trip the following assert.

GFS2: fsid=cypher-36:test.0: fatal: assertion "!buffer_busy(bh)" failed
GFS2: fsid=cypher-36:test.0:   function = gfs2_ail_empty_gl, file = fs/gfs2/glops.c, line = 61

It appears that gfs2_log_flush() puts some of the glocks buffers in the busy
state and the filemap_fdatawrite() call is necessary to flush them. This makes
me worry slightly that a related problem could happen because of moving the
gfs2_log_flush() after the initial filemap_fdatawrite(), but I assume that
gfs2_ail_empty_gl() would catch that case as well.

Signed-off-by: Benjamin E. Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
 fs/gfs2/glops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: e92666ae590962682cf23fcae2c3bdcb6e5e2d27.diff
Type: text/x-patch
Size: 473 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20070618/65bbac21/attachment.bin>

WARNING: multiple messages have this Message-ID (diff)
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel@redhat.com, linux-kernel@vger.kernel.org
Cc: Benjamin Marzinski <bmarzins@redhat.com>,
	Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 1/4] [GFS2] flush the glock completely in inode_go_sync
Date: Mon, 18 Jun 2007 15:54:27 +0100	[thread overview]
Message-ID: <1182178478593-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <11821784703600-git-send-email-swhiteho@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 44 bytes --]

This is a multi-part message in MIME format.

[-- Attachment #2: Type: text/plain, Size: 1330 bytes --]


Fix for bz #231910
When filemap_fdatawrite() is called on the inode mapping in data=ordered mode,
it will add the glock to the log. In inode_go_sync(), if you do the
gfs2_log_flush() before this, after the filemap_fdatawrite() call, the glock
and its associated data buffers will be on the log again. This means you can
demote a lock from exclusive, without having it flushed from the log. The
attached patch simply moves the gfs2_log_flush up to after the
filemap_fdatawrite() call.

Originally, I tried moving the gfs2_log_flush to after gfs2_meta_sync(), but
that caused me to trip the following assert.

GFS2: fsid=cypher-36:test.0: fatal: assertion "!buffer_busy(bh)" failed
GFS2: fsid=cypher-36:test.0:   function = gfs2_ail_empty_gl, file = fs/gfs2/glops.c, line = 61

It appears that gfs2_log_flush() puts some of the glocks buffers in the busy
state and the filemap_fdatawrite() call is necessary to flush them. This makes
me worry slightly that a related problem could happen because of moving the
gfs2_log_flush() after the initial filemap_fdatawrite(), but I assume that
gfs2_ail_empty_gl() would catch that case as well.

Signed-off-by: Benjamin E. Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
 fs/gfs2/glops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: e92666ae590962682cf23fcae2c3bdcb6e5e2d27.diff --]
[-- Type: text/x-patch; name="e92666ae590962682cf23fcae2c3bdcb6e5e2d27.diff", Size: 473 bytes --]

diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 7b82657..777ca46 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -156,9 +156,9 @@ static void inode_go_sync(struct gfs2_glock *gl)
 		ip = NULL;
 
 	if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
-		gfs2_log_flush(gl->gl_sbd, gl);
 		if (ip)
 			filemap_fdatawrite(ip->i_inode.i_mapping);
+		gfs2_log_flush(gl->gl_sbd, gl);
 		gfs2_meta_sync(gl);
 		if (ip) {
 			struct address_space *mapping = ip->i_inode.i_mapping;

  reply	other threads:[~2007-06-18 14:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-18 14:54 [Cluster-devel] [GFS2/DLM] Some small bug fixes Steven Whitehouse
2007-06-18 14:54 ` Steven Whitehouse
2007-06-18 14:54 ` Steven Whitehouse [this message]
2007-06-18 14:54   ` [PATCH 1/4] [GFS2] flush the glock completely in inode_go_sync Steven Whitehouse
2007-06-18 14:54   ` [Cluster-devel] [PATCH 2/4] [DLM] fix a couple of races Steven Whitehouse
2007-06-18 14:54     ` Steven Whitehouse
2007-06-18 14:54     ` [Cluster-devel] [PATCH 3/4] [GFS2] use zero_user_page Steven Whitehouse
2007-06-18 14:54       ` Steven Whitehouse
2007-06-18 14:54       ` [Cluster-devel] [PATCH 4/4] [DLM] keep dlm from panicing when traversing rsb list in debugfs Steven Whitehouse
2007-06-18 14:54         ` Steven Whitehouse
2007-06-18 15:13 ` [Cluster-devel] [GFS2/DLM] Pull request Steven Whitehouse
2007-06-18 15:13   ` Steven Whitehouse
2007-06-18 15:30   ` [Cluster-devel] " Steven Whitehouse
2007-06-18 15:30     ` Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1182178478593-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.