[Cluster-devel] [PATCH 1/4] GFS2: Fix race between lru_list and glock ref count

2012-02-28 Thread Steven Whitehouse
This patch fixes a narrow race window between the glock ref count
hitting zero and glocks being removed from the lru_list.

Signed-off-by: Steven Whitehouse swhit...@redhat.com

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 376816f..351a3e7 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -167,14 +167,19 @@ void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
spin_unlock(lru_lock);
 }
 
-static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
+static void __gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
 {
-   spin_lock(lru_lock);
if (!list_empty(gl-gl_lru)) {
list_del_init(gl-gl_lru);
atomic_dec(lru_count);
clear_bit(GLF_LRU, gl-gl_flags);
}
+}
+
+static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
+{
+   spin_lock(lru_lock);
+   __gfs2_glock_remove_from_lru(gl);
spin_unlock(lru_lock);
 }
 
@@ -217,11 +222,12 @@ void gfs2_glock_put(struct gfs2_glock *gl)
struct gfs2_sbd *sdp = gl-gl_sbd;
struct address_space *mapping = gfs2_glock2aspace(gl);
 
-   if (atomic_dec_and_test(gl-gl_ref)) {
+   if (atomic_dec_and_lock(gl-gl_ref, lru_lock)) {
+   __gfs2_glock_remove_from_lru(gl);
+   spin_unlock(lru_lock);
spin_lock_bucket(gl-gl_hash);
hlist_bl_del_rcu(gl-gl_list);
spin_unlock_bucket(gl-gl_hash);
-   gfs2_glock_remove_from_lru(gl);
GLOCK_BUG_ON(gl, !list_empty(gl-gl_holders));
GLOCK_BUG_ON(gl, mapping  mapping-nrpages);
trace_gfs2_glock_put(gl);
-- 
1.7.4



[Cluster-devel] GFS2: Pre-pull patch posting (fixes)

2012-02-28 Thread Steven Whitehouse
Hi,

Here are four patches which provided fixes for bugs found in the
current upstream code. Please see individual patches for
descriptions,

Steve.



[Cluster-devel] [PATCH 4/4] GFS2: Read resource groups on mount

2012-02-28 Thread Steven Whitehouse
This makes mount take slightly longer, but at the same time, the first
write to the filesystem will be faster too. It also means that if there
is a problem in the resource index, then we can refuse to mount rather
than having to try and report that when the first write occurs.

In addition, to avoid recursive locking, we hvae to take account of
instances when the rindex glock may already be held when we are
trying to update the rbtree of resource groups.

Signed-off-by: Steven Whitehouse swhit...@redhat.com

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 7f906c8..c5fb359 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -772,11 +772,6 @@ static long gfs2_fallocate(struct file *file, int mode, 
loff_t offset,
if (bytes == 0)
bytes = sdp-sd_sb.sb_bsize;
 
-   error = gfs2_rindex_update(sdp);
-   if (error) {
-   fs_warn(sdp, rindex update returns %d\n, error);
-   return error;
-   }
gfs2_holder_init(ip-i_gl, LM_ST_EXCLUSIVE, 0, ip-i_gh);
error = gfs2_glock_nq(ip-i_gh);
if (unlikely(error))
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index c87faf4..5698746 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -391,10 +391,6 @@ static int alloc_dinode(struct gfs2_inode *dip, u64 
*no_addr, u64 *generation)
int error;
int dblocks = 1;
 
-   error = gfs2_rindex_update(sdp);
-   if (error)
-   fs_warn(sdp, rindex update returns %d\n, error);
-
error = gfs2_inplace_reserve(dip, RES_DINODE);
if (error)
goto out;
@@ -1035,19 +1031,15 @@ static int gfs2_unlink(struct inode *dir, struct dentry 
*dentry)
struct buffer_head *bh;
struct gfs2_holder ghs[3];
struct gfs2_rgrpd *rgd;
-   int error;
+   int error = -EROFS;
 
-   error = gfs2_rindex_update(sdp);
-   if (error)
-   return error;
gfs2_holder_init(dip-i_gl, LM_ST_EXCLUSIVE, 0, ghs);
gfs2_holder_init(ip-i_gl,  LM_ST_EXCLUSIVE, 0, ghs + 1);
 
rgd = gfs2_blk2rgrpd(sdp, ip-i_no_addr);
-   if (!rgd) {
-   error = -EROFS;
+   if (!rgd)
goto out_inodes;
-   }
+
gfs2_holder_init(rgd-rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
 
 
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 6aacf3f..24f609c 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -800,6 +800,11 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
fs_err(sdp, can't get quota file inode: %d\n, error);
goto fail_rindex;
}
+
+   error = gfs2_rindex_update(sdp);
+   if (error)
+   goto fail_qinode;
+
return 0;
 
 fail_qinode:
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 981bfa3..49ada95 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -683,16 +683,21 @@ int gfs2_rindex_update(struct gfs2_sbd *sdp)
struct gfs2_glock *gl = ip-i_gl;
struct gfs2_holder ri_gh;
int error = 0;
+   int unlock_required = 0;
 
/* Read new copy from disk if we don't have the latest */
if (!sdp-sd_rindex_uptodate) {
mutex_lock(sdp-sd_rindex_mutex);
-   error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, ri_gh);
-   if (error)
-   return error;
+   if (!gfs2_glock_is_locked_by_me(gl)) {
+   error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, ri_gh);
+   if (error)
+   return error;
+   unlock_required = 1;
+   }
if (!sdp-sd_rindex_uptodate)
error = gfs2_ri_update(ip);
-   gfs2_glock_dq_uninit(ri_gh);
+   if (unlock_required)
+   gfs2_glock_dq_uninit(ri_gh);
mutex_unlock(sdp-sd_rindex_mutex);
}
 
-- 
1.7.4



[Cluster-devel] [PATCH 2/4] GFS2: Read in rindex if necessary during unlink

2012-02-28 Thread Steven Whitehouse
From: Bob Peterson rpete...@redhat.com

This patch fixes a problem whereby you were unable to delete
files until other file system operations were done (such as
statfs, touch, writes, etc.) that caused the rindex to be
read in.

Signed-off-by: Bob Peterson rpete...@redhat.com
Signed-off-by: Steven Whitehouse swhit...@redhat.com

diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index a7d611b..c87faf4 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1035,14 +1035,19 @@ static int gfs2_unlink(struct inode *dir, struct dentry 
*dentry)
struct buffer_head *bh;
struct gfs2_holder ghs[3];
struct gfs2_rgrpd *rgd;
-   int error = -EROFS;
+   int error;
 
+   error = gfs2_rindex_update(sdp);
+   if (error)
+   return error;
gfs2_holder_init(dip-i_gl, LM_ST_EXCLUSIVE, 0, ghs);
gfs2_holder_init(ip-i_gl,  LM_ST_EXCLUSIVE, 0, ghs + 1);
 
rgd = gfs2_blk2rgrpd(sdp, ip-i_no_addr);
-   if (!rgd)
+   if (!rgd) {
+   error = -EROFS;
goto out_inodes;
+   }
gfs2_holder_init(rgd-rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
 
 
-- 
1.7.4



[Cluster-devel] GFS2: Pull request (fixes)

2012-02-28 Thread Steven Whitehouse
Hi,

Please consider pulling the following bug fixes,

Steve.


The following changes since commit 586c6e7013c8cbb8c91aaa6568ec349b1dc2c691:

  Merge tag 'ktest-fix-make-min-failed-build-for-real' of 
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest (2012-02-27 
15:43:05 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes.git master

Bob Peterson (2):
  GFS2: Read in rindex if necessary during unlink
  GFS2: Ensure rindex is uptodate for fallocate

Steven Whitehouse (2):
  GFS2: Fix race between lru_list and glock ref count
  GFS2: Read resource groups on mount

 fs/gfs2/glock.c  |   14 ++
 fs/gfs2/inode.c  |5 +
 fs/gfs2/ops_fstype.c |5 +
 fs/gfs2/rgrp.c   |   13 +
 4 files changed, 25 insertions(+), 12 deletions(-)



signature.asc
Description: This is a digitally signed message part


[Cluster-devel] Corosync 1.99.6 (Fifth beta release of Needle 2.0) available at ftp.corosync.org!

2012-02-28 Thread Jan Friesse
I am pleased to announce the fifth Beta release of our future Corosync 
Needle 2.0. This version should be last Beta, so if you have any patch, 
which can cause future API/ABI/Wire incompatibility, please sent it as 
soon as possible.


Tarball is available immediately from our website at
http://www.corosync.org.

List of changes between Beta-4 (1.99.5) and Beta-5 (1.99.6):
Fabio M. Di Nitto (9):
  votequorum: major rework to fix qdevice API and integration with core
  quorumtool: update man page and help text
  votequorum: fix votequorum_getinfo man page and align struct name
  quorumtool: swap node state and node votes output
  quorumtool: fix version display info
  quorumtools: drop unused option parsing
  quorumtools: fix typo in man page
  quorumtool: make output more human friendly and retain machine 
parsable bits

  quorumtool: improve Membership information output

Changes in quorum made Beta-5 *wire INcompatible* with previous 
versions, so please make sure to upgrade whole cluster.


Testers of this great milestone are more than welcomed. For testing, you
need to install libqb version 0.10.1.

Thanks/congratulations to all people that contributed to achieve this
great milestone.



[Cluster-devel] GFS2: git trees

2012-02-28 Thread Steven Whitehouse
Hi,

Linus has just pulled the fixes tree, so I've rebased the -nmw tree on
top of the latest upstream,

Steve.