cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2] Put back semaphore to avoid umount problem
@ 2007-01-26  9:08 Steven Whitehouse
  2007-01-26 10:36 ` Steven Whitehouse
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Whitehouse @ 2007-01-26  9:08 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From b99f08ce80721ea5ad8013ac6aed8c9a1dd517b7 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <swhiteho@redhat.com>
Date: Fri, 26 Jan 2007 09:02:09 -0500
Subject: [PATCH] [GFS2] Put back semaphore to avoid umount problem

Dave Teigland fixed this bug a while back, but I managed to mistakenly
remove the semaphore during later development. It is required to avoid
the list of inodes changing during an invalidate_inodes call. I have
made it an rwsem since the read side will be taken frequently during
normal filesystem operation. The write site will only happen during
umount of the file system.

Also the bug only triggers when using the DLM lock manager and only then
under certain conditions as its timing related.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: David Teigland <teigland@redhat.com>
---
 fs/gfs2/glock.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index c070ede..679aa25 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -20,6 +20,7 @@ #include <linux/gfs2_ondisk.h>
 #include <linux/list.h>
 #include <linux/lm_interface.h>
 #include <linux/wait.h>
+#include <linux/rwsem.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
@@ -45,6 +46,7 @@ static int dump_glock(struct gfs2_glock 
 static int dump_inode(struct gfs2_inode *ip);
 static void gfs2_glock_xmote_th(struct gfs2_holder *gh);
 static void gfs2_glock_drop_th(struct gfs2_glock *gl);
+static DECLARE_RWSEM(gfs2_umount_flush_sem);
 
 #define GFS2_GL_HASH_SHIFT      15
 #define GFS2_GL_HASH_SIZE       (1 << GFS2_GL_HASH_SHIFT)
@@ -190,6 +192,7 @@ int gfs2_glock_put(struct gfs2_glock *gl
 	int rv = 0;
 	struct gfs2_sbd *sdp = gl->gl_sbd;
 
+	down_read(&gfs2_umount_flush_sem);
 	write_lock(gl_lock_addr(gl->gl_hash));
 	if (atomic_dec_and_test(&gl->gl_ref)) {
 		hlist_del(&gl->gl_list);
@@ -207,6 +210,7 @@ int gfs2_glock_put(struct gfs2_glock *gl
 	}
 	write_unlock(gl_lock_addr(gl->gl_hash));
 out:
+	up_read(&gfs2_umount_flush_sem);
 	return rv;
 }
 
@@ -1828,7 +1832,9 @@ void gfs2_gl_hash_clear(struct gfs2_sbd 
 			t = jiffies;
 		}
 
+		down_write(&gfs2_umount_flush_sem);
 		invalidate_inodes(sdp->sd_vfs);
+		up_write(&gfs2_umount_flush_sem);
 		msleep(10);
 	}
 }
-- 
1.4.1





^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-29 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26  9:08 [Cluster-devel] [GFS2] Put back semaphore to avoid umount problem Steven Whitehouse
2007-01-26 10:36 ` Steven Whitehouse
2007-01-26 15:37   ` David Teigland
2007-01-29 11:51     ` Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).