cluster: STABLE3 - gfs-kernel: Flock on GFS fs file will error with "Resource tempory unavailable" for EWOULDBLOCK
by Abhijith Das
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: bc271e80a8221d264d269a74ccf6e46c4b6cce4d
Parent: 04f7da379c163876eb346f3828de0ff152e25f5a
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Thu Feb 11 10:48:24 2010 -0600
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Thu Feb 11 10:52:23 2010 -0600
gfs-kernel: Flock on GFS fs file will error with "Resource tempory unavailable" for EWOULDBLOCK
This patch allows a process to queue multiple flocks
through multiple descriptors and the behavior is similar
to that of GFS2. This patch also eliminates the race
condition involving a single process where a holder from
a previous unlock that has still not completely been
dequeued prevents a subsequent non-blocking flock from
going through and instead returns EAGAIN. This patch will
cause the non-blocking request to block until the
aforementioned unlock holder has been cleared.
rhbz#515717
---
gfs-kernel/src/gfs/glock.c | 74 +++++++++++++++++++++++++++++++----------
gfs-kernel/src/gfs/glock.h | 2 +
gfs-kernel/src/gfs/incore.h | 2 +
gfs-kernel/src/gfs/ops_file.c | 15 ++++----
4 files changed, 67 insertions(+), 26 deletions(-)
diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c
index 3040c60..80f4466 100644
--- a/gfs-kernel/src/gfs/glock.c
+++ b/gfs-kernel/src/gfs/glock.c
@@ -986,6 +986,33 @@ state_change(struct gfs_glock *gl, unsigned int new_state)
gl->gl_state = new_state;
}
+static int gfs_glock_demote_wait(void *word)
+{
+ schedule();
+ return 0;
+}
+
+static void gfs_wait_on_demote(struct gfs_glock *gl)
+{
+ might_sleep();
+ wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs_glock_demote_wait, TASK_UNINTERRUPTIBLE);
+}
+
+static void gfs_demote_wake(struct gfs_glock *gl)
+{
+ clear_bit(GLF_DEMOTE, &gl->gl_flags);
+ smp_mb__after_clear_bit();
+ wake_up_bit(&gl->gl_flags, GLF_DEMOTE);
+}
+
+void gfs_glock_dq_wait(struct gfs_holder *gh)
+{
+ struct gfs_glock *gl = gh->gh_gl;
+ set_bit(GLF_DEMOTE, &gl->gl_flags);
+ gfs_glock_dq(gh);
+ gfs_wait_on_demote(gl);
+}
+
/**
* xmote_bh - Called after the lock module is done acquiring a lock
* @gl: The glock in question
@@ -1091,6 +1118,8 @@ xmote_bh(struct gfs_glock *gl, unsigned int ret)
gl->gl_req_bh = NULL;
clear_bit(GLF_LOCK, &gl->gl_flags);
run_queue(gl);
+ if (test_bit(GLF_DEMOTE, &gl->gl_flags))
+ gfs_demote_wake(gl);
spin_unlock(&gl->gl_spin);
}
@@ -1200,8 +1229,9 @@ drop_bh(struct gfs_glock *gl, unsigned int ret)
gl->gl_req_bh = NULL;
clear_bit(GLF_LOCK, &gl->gl_flags);
run_queue(gl);
- spin_unlock(&gl->gl_spin);
-
+ if (test_bit(GLF_DEMOTE, &gl->gl_flags))
+ gfs_demote_wake(gl);
+ spin_unlock(&gl->gl_spin);
glock_put(gl);
if (gh) {
@@ -1312,6 +1342,11 @@ glock_wait_internal(struct gfs_holder *gh)
if (gl->gl_req_gh != gh &&
!test_bit(HIF_HOLDER, &gh->gh_iflags) &&
!list_empty(&gh->gh_list)) {
+ if (gh->gh_flags & GL_FLOCK &&
+ list_empty(&gl->gl_holders)) {
+ spin_unlock(&gl->gl_spin);
+ goto skip_try_flag;
+ }
list_del_init(&gh->gh_list);
gh->gh_error = GLR_TRYFAILED;
if (test_bit(HIF_RECURSE, &gh->gh_iflags))
@@ -1323,6 +1358,7 @@ glock_wait_internal(struct gfs_holder *gh)
spin_unlock(&gl->gl_spin);
}
+skip_try_flag:
if ((gh->gh_flags & LM_FLAG_PRIORITY) &&
!(gh->gh_flags & GL_NOCANCEL_OTHER))
do_cancels(gh);
@@ -1402,13 +1438,14 @@ add_to_queue(struct gfs_holder *gh)
if (tmp_gh->gh_owner == gh->gh_owner) {
/* Make sure pre-existing holder is compatible
with this new one. */
- if (gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
- !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
- gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
- !(gh->gh_flags & GL_LOCAL_EXCL)) ||
- gfs_assert_warn(sdp, relaxed_state_ok(gl->gl_state,
- gh->gh_state,
- gh->gh_flags)))
+ if (!(gh->gh_flags & GL_FLOCK) &&
+ (gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
+ !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
+ gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
+ !(gh->gh_flags & GL_LOCAL_EXCL)) ||
+ gfs_assert_warn(sdp, relaxed_state_ok(gl->gl_state,
+ gh->gh_state,
+ gh->gh_flags))))
goto fail;
/* We're good! Grant the hold. */
@@ -1430,15 +1467,16 @@ add_to_queue(struct gfs_holder *gh)
tmp_gh = list_entry(tmp, struct gfs_holder, gh_list);
if (tmp_gh->gh_owner == gh->gh_owner) {
/* Yes, make sure it is compatible with new */
- if (gfs_assert_warn(sdp, test_bit(HIF_PROMOTE,
- &tmp_gh->gh_iflags)) ||
- gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
- !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
- gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
- !(gh->gh_flags & GL_LOCAL_EXCL)) ||
- gfs_assert_warn(sdp, relaxed_state_ok(tmp_gh->gh_state,
- gh->gh_state,
- gh->gh_flags)))
+ if (!(gh->gh_flags & GL_FLOCK) &&
+ (gfs_assert_warn(sdp, test_bit(HIF_PROMOTE,
+ &tmp_gh->gh_iflags)) ||
+ gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
+ !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
+ gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
+ !(gh->gh_flags & GL_LOCAL_EXCL)) ||
+ gfs_assert_warn(sdp, relaxed_state_ok(tmp_gh->gh_state,
+ gh->gh_state,
+ gh->gh_flags))))
goto fail;
/* OK, make sure they're marked, so
diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h
index a0342b1..9de5e94 100644
--- a/gfs-kernel/src/gfs/glock.h
+++ b/gfs-kernel/src/gfs/glock.h
@@ -21,6 +21,7 @@
#define GL_SYNC (0x00000800) /* Sync to disk when no more holders */
#define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */
#define GL_NOCANCEL_OTHER (0x00004000) /* Don't cancel other locks for this */
+#define GL_FLOCK (0x00008000) /* This is an flock */
#define GLR_TRYFAILED (13)
#define GLR_CANCELED (14)
@@ -96,6 +97,7 @@ int gfs_glock_nq(struct gfs_holder *gh);
int gfs_glock_poll(struct gfs_holder *gh);
int gfs_glock_wait(struct gfs_holder *gh);
void gfs_glock_dq(struct gfs_holder *gh);
+void gfs_glock_dq_wait(struct gfs_holder *gh);
void gfs_glock_prefetch(struct gfs_glock *gl, unsigned int state, int flags);
void gfs_glock_force_drop(struct gfs_glock *gl);
diff --git a/gfs-kernel/src/gfs/incore.h b/gfs-kernel/src/gfs/incore.h
index 1e00fc2..921b79d 100644
--- a/gfs-kernel/src/gfs/incore.h
+++ b/gfs-kernel/src/gfs/incore.h
@@ -474,6 +474,8 @@ struct gfs_holder {
* (demote/greedy) holders */
#define GLF_GREEDY (7) /* This lock is ignoring callbacks
* (requests from other nodes) for now */
+#define GLF_DEMOTE (8) /* This is used to check for unflock completion
+ * different from HIF_DEMOTE */
struct gfs_glock {
struct list_head gl_list; /* Link to hb_list in one of superblock's
diff --git a/gfs-kernel/src/gfs/ops_file.c b/gfs-kernel/src/gfs/ops_file.c
index 6a64958..e675772 100644
--- a/gfs-kernel/src/gfs/ops_file.c
+++ b/gfs-kernel/src/gfs/ops_file.c
@@ -1732,7 +1732,8 @@ do_flock(struct file *file, int cmd, struct file_lock *fl)
int error = 0;
state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
- flags = ((IS_SETLKW(cmd)) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE;
+ flags = ((IS_SETLKW(cmd)) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE
+ | GL_FLOCK;
down(&fp->f_fl_lock);
@@ -1740,21 +1741,19 @@ do_flock(struct file *file, int cmd, struct file_lock *fl)
if (gl) {
if (fl_gh->gh_state == state)
goto out;
- gfs_glock_hold(gl);
flock_lock_file_wait(file,
- &(struct file_lock){.fl_type = F_UNLCK});
- gfs_glock_dq_uninit(fl_gh);
+ &(struct file_lock){.fl_type = F_UNLCK});
+ gfs_glock_dq_wait(fl_gh);
+ gfs_holder_reinit(state, flags, fl_gh);
} else {
error = gfs_glock_get(ip->i_sbd,
ip->i_num.no_formal_ino, &gfs_flock_glops,
CREATE, &gl);
if (error)
goto out;
+ gfs_holder_init(gl, state, flags, fl_gh);
+ gfs_glock_put(gl);
}
-
- gfs_holder_init(gl, state, flags, fl_gh);
- gfs_glock_put(gl);
-
error = gfs_glock_nq(fl_gh);
if (error) {
gfs_holder_uninit(fl_gh);
14 years, 2 months
cluster: RHEL55 - gfs-kernel: Flock on GFS fs file will error with "Resource tempory unavailable" for EWOULDBLOCK
by Abhijith Das
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 35a706710435104eeb5782658ca15a3179fb3e93
Parent: 59cdde95dbad76b573eb93b88fb7e69ca0b7a9ea
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Thu Feb 11 10:48:24 2010 -0600
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Thu Feb 11 10:48:24 2010 -0600
gfs-kernel: Flock on GFS fs file will error with "Resource tempory unavailable" for EWOULDBLOCK
This patch allows a process to queue multiple flocks
through multiple descriptors and the behavior is similar
to that of GFS2. This patch also eliminates the race
condition involving a single process where a holder from
a previous unlock that has still not completely been
dequeued prevents a subsequent non-blocking flock from
going through and instead returns EAGAIN. This patch will
cause the non-blocking request to block until the
aforementioned unlock holder has been cleared.
rhbz#515717
---
gfs-kernel/src/gfs/glock.c | 74 +++++++++++++++++++++++++++++++----------
gfs-kernel/src/gfs/glock.h | 2 +
gfs-kernel/src/gfs/incore.h | 2 +
gfs-kernel/src/gfs/ops_file.c | 15 ++++----
4 files changed, 67 insertions(+), 26 deletions(-)
diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c
index 1cb6e7e..493d2a1 100644
--- a/gfs-kernel/src/gfs/glock.c
+++ b/gfs-kernel/src/gfs/glock.c
@@ -999,6 +999,33 @@ state_change(struct gfs_glock *gl, unsigned int new_state)
gl->gl_state = new_state;
}
+static int gfs_glock_demote_wait(void *word)
+{
+ schedule();
+ return 0;
+}
+
+static void gfs_wait_on_demote(struct gfs_glock *gl)
+{
+ might_sleep();
+ wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs_glock_demote_wait, TASK_UNINTERRUPTIBLE);
+}
+
+static void gfs_demote_wake(struct gfs_glock *gl)
+{
+ clear_bit(GLF_DEMOTE, &gl->gl_flags);
+ smp_mb__after_clear_bit();
+ wake_up_bit(&gl->gl_flags, GLF_DEMOTE);
+}
+
+void gfs_glock_dq_wait(struct gfs_holder *gh)
+{
+ struct gfs_glock *gl = gh->gh_gl;
+ set_bit(GLF_DEMOTE, &gl->gl_flags);
+ gfs_glock_dq(gh);
+ gfs_wait_on_demote(gl);
+}
+
/**
* xmote_bh - Called after the lock module is done acquiring a lock
* @gl: The glock in question
@@ -1104,6 +1131,8 @@ xmote_bh(struct gfs_glock *gl, unsigned int ret)
gl->gl_req_bh = NULL;
clear_bit(GLF_LOCK, &gl->gl_flags);
run_queue(gl);
+ if (test_bit(GLF_DEMOTE, &gl->gl_flags))
+ gfs_demote_wake(gl);
spin_unlock(&gl->gl_spin);
}
@@ -1213,8 +1242,9 @@ drop_bh(struct gfs_glock *gl, unsigned int ret)
gl->gl_req_bh = NULL;
clear_bit(GLF_LOCK, &gl->gl_flags);
run_queue(gl);
- spin_unlock(&gl->gl_spin);
-
+ if (test_bit(GLF_DEMOTE, &gl->gl_flags))
+ gfs_demote_wake(gl);
+ spin_unlock(&gl->gl_spin);
glock_put(gl);
if (gh) {
@@ -1325,6 +1355,11 @@ glock_wait_internal(struct gfs_holder *gh)
if (gl->gl_req_gh != gh &&
!test_bit(HIF_HOLDER, &gh->gh_iflags) &&
!list_empty(&gh->gh_list)) {
+ if (gh->gh_flags & GL_FLOCK &&
+ list_empty(&gl->gl_holders)) {
+ spin_unlock(&gl->gl_spin);
+ goto skip_try_flag;
+ }
list_del_init(&gh->gh_list);
gh->gh_error = GLR_TRYFAILED;
if (test_bit(HIF_RECURSE, &gh->gh_iflags))
@@ -1336,6 +1371,7 @@ glock_wait_internal(struct gfs_holder *gh)
spin_unlock(&gl->gl_spin);
}
+skip_try_flag:
if ((gh->gh_flags & LM_FLAG_PRIORITY) &&
!(gh->gh_flags & GL_NOCANCEL_OTHER))
do_cancels(gh);
@@ -1415,13 +1451,14 @@ add_to_queue(struct gfs_holder *gh)
if (tmp_gh->gh_owner == gh->gh_owner) {
/* Make sure pre-existing holder is compatible
with this new one. */
- if (gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
- !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
- gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
- !(gh->gh_flags & GL_LOCAL_EXCL)) ||
- gfs_assert_warn(sdp, relaxed_state_ok(gl->gl_state,
- gh->gh_state,
- gh->gh_flags)))
+ if (!(gh->gh_flags & GL_FLOCK) &&
+ (gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
+ !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
+ gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
+ !(gh->gh_flags & GL_LOCAL_EXCL)) ||
+ gfs_assert_warn(sdp, relaxed_state_ok(gl->gl_state,
+ gh->gh_state,
+ gh->gh_flags))))
goto fail;
/* We're good! Grant the hold. */
@@ -1443,15 +1480,16 @@ add_to_queue(struct gfs_holder *gh)
tmp_gh = list_entry(tmp, struct gfs_holder, gh_list);
if (tmp_gh->gh_owner == gh->gh_owner) {
/* Yes, make sure it is compatible with new */
- if (gfs_assert_warn(sdp, test_bit(HIF_PROMOTE,
- &tmp_gh->gh_iflags)) ||
- gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
- !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
- gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
- !(gh->gh_flags & GL_LOCAL_EXCL)) ||
- gfs_assert_warn(sdp, relaxed_state_ok(tmp_gh->gh_state,
- gh->gh_state,
- gh->gh_flags)))
+ if (!(gh->gh_flags & GL_FLOCK) &&
+ (gfs_assert_warn(sdp, test_bit(HIF_PROMOTE,
+ &tmp_gh->gh_iflags)) ||
+ gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
+ !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
+ gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
+ !(gh->gh_flags & GL_LOCAL_EXCL)) ||
+ gfs_assert_warn(sdp, relaxed_state_ok(tmp_gh->gh_state,
+ gh->gh_state,
+ gh->gh_flags))))
goto fail;
/* OK, make sure they're marked, so
diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h
index 3fd0ddb..4182fa8 100644
--- a/gfs-kernel/src/gfs/glock.h
+++ b/gfs-kernel/src/gfs/glock.h
@@ -34,6 +34,7 @@
#define GL_SYNC (0x00000800) /* Sync to disk when no more holders */
#define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */
#define GL_NOCANCEL_OTHER (0x00004000) /* Don't cancel other locks for this */
+#define GL_FLOCK (0x00008000) /* This is an flock */
#define GLR_TRYFAILED (13)
#define GLR_CANCELED (14)
@@ -109,6 +110,7 @@ int gfs_glock_nq(struct gfs_holder *gh);
int gfs_glock_poll(struct gfs_holder *gh);
int gfs_glock_wait(struct gfs_holder *gh);
void gfs_glock_dq(struct gfs_holder *gh);
+void gfs_glock_dq_wait(struct gfs_holder *gh);
void gfs_glock_prefetch(struct gfs_glock *gl, unsigned int state, int flags);
void gfs_glock_force_drop(struct gfs_glock *gl);
diff --git a/gfs-kernel/src/gfs/incore.h b/gfs-kernel/src/gfs/incore.h
index 841b852..9c4f467 100644
--- a/gfs-kernel/src/gfs/incore.h
+++ b/gfs-kernel/src/gfs/incore.h
@@ -487,6 +487,8 @@ struct gfs_holder {
* (demote/greedy) holders */
#define GLF_GREEDY (7) /* This lock is ignoring callbacks
* (requests from other nodes) for now */
+#define GLF_DEMOTE (8) /* This is used to check for unflock completion
+ * different from HIF_DEMOTE */
struct gfs_glock {
struct list_head gl_list; /* Link to hb_list in one of superblock's
diff --git a/gfs-kernel/src/gfs/ops_file.c b/gfs-kernel/src/gfs/ops_file.c
index 148fb67..440fbf6 100644
--- a/gfs-kernel/src/gfs/ops_file.c
+++ b/gfs-kernel/src/gfs/ops_file.c
@@ -1731,7 +1731,8 @@ do_flock(struct file *file, int cmd, struct file_lock *fl)
int error = 0;
state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
- flags = ((IS_SETLKW(cmd)) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE;
+ flags = ((IS_SETLKW(cmd)) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE
+ | GL_FLOCK;
down(&fp->f_fl_lock);
@@ -1739,21 +1740,19 @@ do_flock(struct file *file, int cmd, struct file_lock *fl)
if (gl) {
if (fl_gh->gh_state == state)
goto out;
- gfs_glock_hold(gl);
flock_lock_file_wait(file,
- &(struct file_lock){.fl_type = F_UNLCK});
- gfs_glock_dq_uninit(fl_gh);
+ &(struct file_lock){.fl_type = F_UNLCK});
+ gfs_glock_dq_wait(fl_gh);
+ gfs_holder_reinit(state, flags, fl_gh);
} else {
error = gfs_glock_get(ip->i_sbd,
ip->i_num.no_formal_ino, &gfs_flock_glops,
CREATE, &gl);
if (error)
goto out;
+ gfs_holder_init(gl, state, flags, fl_gh);
+ gfs_glock_put(gl);
}
-
- gfs_holder_init(gl, state, flags, fl_gh);
- gfs_glock_put(gl);
-
error = gfs_glock_nq(fl_gh);
if (error) {
gfs_holder_uninit(fl_gh);
14 years, 2 months
cluster: RHEL55 - fsck.gfs2: Use fsck.ext3's method of dealing with root mounts
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 59cdde95dbad76b573eb93b88fb7e69ca0b7a9ea
Parent: 5c6b9d216ad358e83ae6f5307f1622427c878afc
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Feb 11 08:24:53 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Feb 11 09:20:07 2010 -0600
fsck.gfs2: Use fsck.ext3's method of dealing with root mounts
This patch scraps the old way of determining if a gfs2 file
system is mounted and does it the way fsck.ext3 does.
rhbz#557128
---
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/misc.c | 115 ++++++++++++++++++++++++++++++------------------
2 files changed, 73 insertions(+), 43 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 9958980..167aef0 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -664,6 +664,7 @@ uint32_t compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
uint32_t bsize1, int diptrs, int inptrs);
void compute_constants(struct gfs2_sbd *sdp);
int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount);
+int is_gfs2(struct gfs2_sbd *sdp);
void check_for_gfs2(struct gfs2_sbd *sdp);
void mount_gfs2_meta(struct gfs2_sbd *sdp);
void cleanup_metafs(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index bcccba9..2c475a0 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -27,6 +27,8 @@
#include <sys/file.h>
#include <dirent.h>
#include <linux/kdev_t.h>
+#include <sys/statfs.h>
+#include <mntent.h>
#include "libgfs2.h"
@@ -107,57 +109,82 @@ compute_constants(struct gfs2_sbd *sdp)
int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
{
- FILE *fp = fopen("/proc/mounts", "r");
- char buffer[PATH_MAX];
- char fstype[80];
- int fsdump, fspass, ret;
- char fspath[PATH_MAX];
- char fsoptions[PATH_MAX];
- char *realname;
+ FILE *fp;
+ struct mntent *mnt;
+ dev_t file_dev=0, file_rdev=0;
+ ino_t file_ino=0;
+ struct stat st_buf;
*ro_mount = 0;
- realname = realpath(sdp->path_name, NULL);
- if (!realname) {
- perror(sdp->path_name);
+ if ((fp = setmntent("/proc/mounts", "r")) == NULL) {
+ perror("open: /proc/mounts");
return 0;
}
- if (fp == NULL) {
- perror("open: /proc/mounts");
- exit(EXIT_FAILURE);
+ if (stat(sdp->path_name, &st_buf) == 0) {
+ if (S_ISBLK(st_buf.st_mode)) {
+#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
+ file_rdev = st_buf.st_rdev;
+#endif /* __GNU__ */
+ } else {
+ file_dev = st_buf.st_dev;
+ file_ino = st_buf.st_ino;
+ }
}
- while ((fgets(buffer, PATH_MAX - 1, fp)) != NULL) {
- buffer[PATH_MAX - 1] = 0;
-
- if (strstr(buffer, "0") == 0)
- continue;
-
- if ((ret = sscanf(buffer, "%s %s %s %s %d %d",
- sdp->device_name, fspath,
- fstype, fsoptions, &fsdump, &fspass)) != 6)
- continue;
-
- if (strcmp(fstype, "gfs2") != 0)
- continue;
-
+ while ((mnt = getmntent (fp)) != NULL) {
/* Check if they specified the device instead of mnt point */
- if (strcmp(sdp->device_name, realname) == 0)
- strcpy(sdp->path_name, fspath); /* fix it */
- else if (strcmp(fspath, realname) != 0)
- continue;
+ if (strcmp(sdp->device_name, mnt->mnt_fsname) == 0) {
+ strcpy(sdp->path_name, mnt->mnt_dir); /* fix it */
+ break;
+ }
+ if (strcmp(sdp->path_name, mnt->mnt_dir) == 0) {
+ strcpy(sdp->device_name, mnt->mnt_fsname); /* fix it */
+ break;
+ }
+ if (stat(mnt->mnt_fsname, &st_buf) == 0) {
+ if (S_ISBLK(st_buf.st_mode)) {
+#ifndef __GNU__
+ if (file_rdev && (file_rdev == st_buf.st_rdev))
+ break;
+#endif /* __GNU__ */
+ } else {
+ if (file_dev && ((file_dev == st_buf.st_dev) &&
+ (file_ino == st_buf.st_ino)))
+ break;
+ }
+ }
+ }
+ endmntent (fp);
+ if (mnt == NULL)
+ return 0;
+ if (stat(mnt->mnt_dir, &st_buf) < 0) {
+ if (errno == ENOENT)
+ return 0;
+ }
+ /* Can't trust fstype because / has "rootfs". */
+ if (file_rdev && (st_buf.st_dev != file_rdev))
+ return 0;
+ if (hasmntopt(mnt, MNTOPT_RO))
+ *ro_mount = 1;
+ return 1; /* mounted */
+}
- if (strncmp(fsoptions, "ro,", 3) == 0 ||
- strcmp(fsoptions, "ro") == 0)
- *ro_mount = 1;
- fclose(fp);
- if (strncmp(sdp->device_name, "/dev/loop", 9) == 0)
- die("Cannot perform this operation on a loopback GFS2 mount.\n");
+int is_gfs2(struct gfs2_sbd *sdp)
+{
+ int fd, rc;
+ struct gfs2_sb sb;
- free(realname);
- return 1; /* mounted */
- }
- fclose(fp);
- free(realname);
- return 0; /* not mounted */
+ fd = open(sdp->device_name, O_RDWR);
+ if (fd < 0)
+ return 0;
+
+ rc = 0;
+ if (lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK, SEEK_SET) >= 0 &&
+ read(fd, &sb, sizeof(sb)) == sizeof(sb) &&
+ be32_to_cpu(sb.sb_header.mh_magic) == GFS2_MAGIC &&
+ be32_to_cpu(sb.sb_header.mh_type) == GFS2_METATYPE_SB)
+ rc = 1;
+ close(fd);
+ return rc;
}
void
@@ -167,6 +194,8 @@ check_for_gfs2(struct gfs2_sbd *sdp)
if (!is_pathname_mounted(sdp, &ro))
die("gfs2 Filesystem %s is not mounted.\n", sdp->path_name);
+ if (!is_gfs2(sdp))
+ die("Filesystem %s is not GFS2.\n", sdp->path_name);
}
static void
14 years, 2 months
cluster: STABLE3 - fsck.gfs2: Use fsck.ext3's method of dealing with root mounts
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 04f7da379c163876eb346f3828de0ff152e25f5a
Parent: 369493ab6772a1d2f657f964ea72f2d8bb3ea854
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Feb 11 09:14:14 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Feb 11 09:14:14 2010 -0600
fsck.gfs2: Use fsck.ext3's method of dealing with root mounts
This patch scraps the old way of determining if a gfs2 file
system is mounted and does it the way fsck.ext3 does.
rhbz#557128
---
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/misc.c | 114 +++++++++++++++++++++++++++++------------------
2 files changed, 71 insertions(+), 44 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index d89194c..6aa9e2d 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -599,6 +599,7 @@ extern int compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs);
extern int compute_constants(struct gfs2_sbd *sdp);
extern int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount);
+extern int is_gfs2(struct gfs2_sbd *sdp);
extern int find_gfs2_meta(struct gfs2_sbd *sdp);
extern int dir_exists(const char *dir);
extern int check_for_gfs2(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 5ccdab4..ffa0dba 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -15,6 +15,7 @@
#include <dirent.h>
#include <linux/kdev_t.h>
#include <sys/sysmacros.h>
+#include <mntent.h>
#include "libgfs2.h"
@@ -99,58 +100,81 @@ int compute_constants(struct gfs2_sbd *sdp)
int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
{
FILE *fp;
- char buffer[PATH_MAX];
- char fstype[80];
- int fsdump, fspass, ret;
- char fspath[PATH_MAX];
- char fsoptions[PATH_MAX];
- char *realname;
+ struct mntent *mnt;
+ dev_t file_dev=0, file_rdev=0;
+ ino_t file_ino=0;
+ struct stat st_buf;
*ro_mount = 0;
- realname = realpath(sdp->path_name, NULL);
- if (!realname)
+ if ((fp = setmntent("/proc/mounts", "r")) == NULL) {
+ perror("open: /proc/mounts");
return 0;
- fp = fopen("/proc/mounts", "r");
- if (fp == NULL) {
- free(realname);
+ }
+ if (stat(sdp->path_name, &st_buf) == 0) {
+ if (S_ISBLK(st_buf.st_mode)) {
+#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
+ file_rdev = st_buf.st_rdev;
+#endif /* __GNU__ */
+ } else {
+ file_dev = st_buf.st_dev;
+ file_ino = st_buf.st_ino;
+ }
+ }
+ while ((mnt = getmntent (fp)) != NULL) {
+ /* Check if they specified the device instead of mnt point */
+ if (strcmp(sdp->device_name, mnt->mnt_fsname) == 0) {
+ strcpy(sdp->path_name, mnt->mnt_dir); /* fix it */
+ break;
+ }
+ if (strcmp(sdp->path_name, mnt->mnt_dir) == 0) {
+ strcpy(sdp->device_name, mnt->mnt_fsname); /* fix it */
+ break;
+ }
+ if (stat(mnt->mnt_fsname, &st_buf) == 0) {
+ if (S_ISBLK(st_buf.st_mode)) {
+#ifndef __GNU__
+ if (file_rdev && (file_rdev == st_buf.st_rdev))
+ break;
+#endif /* __GNU__ */
+ } else {
+ if (file_dev && ((file_dev == st_buf.st_dev) &&
+ (file_ino == st_buf.st_ino)))
+ break;
+ }
+ }
+ }
+ endmntent (fp);
+ if (mnt == NULL)
return 0;
+ if (stat(mnt->mnt_dir, &st_buf) < 0) {
+ if (errno == ENOENT)
+ return 0;
}
- while ((fgets(buffer, PATH_MAX - 1, fp)) != NULL) {
- buffer[PATH_MAX - 1] = 0;
-
- if (strstr(buffer, "0") == 0)
- continue;
-
- ret = sscanf(buffer, "%s %s %s %s %d %d", sdp->device_name,
- fspath, fstype, fsoptions, &fsdump, &fspass);
- if (6 != ret)
- continue;
-
- if (strcmp(fstype, "gfs2") != 0)
- continue;
+ /* Can't trust fstype because / has "rootfs". */
+ if (file_rdev && (st_buf.st_dev != file_rdev))
+ return 0;
+ if (hasmntopt(mnt, MNTOPT_RO))
+ *ro_mount = 1;
+ return 1; /* mounted */
+}
- /* Check if they specified the device instead of mnt point */
- if (strcmp(sdp->device_name, realname) == 0)
- strcpy(sdp->path_name, fspath); /* fix it */
- else if (strcmp(fspath, realname) != 0)
- continue;
+int is_gfs2(struct gfs2_sbd *sdp)
+{
+ int fd, rc;
+ struct gfs2_sb sb;
- if (strncmp(fsoptions, "ro,", 3) == 0 ||
- strcmp(fsoptions, "ro") == 0)
- *ro_mount = 1;
- fclose(fp);
- free(realname);
- if (strncmp(sdp->device_name, "/dev/loop", 9) == 0) {
- errno = EINVAL;
- return 0;
- }
+ fd = open(sdp->device_name, O_RDWR);
+ if (fd < 0)
+ return 0;
- return 1;
- }
- free(realname);
- fclose(fp);
- errno = EINVAL;
- return 0;
+ rc = 0;
+ if (lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK, SEEK_SET) >= 0 &&
+ read(fd, &sb, sizeof(sb)) == sizeof(sb) &&
+ be32_to_cpu(sb.sb_header.mh_magic) == GFS2_MAGIC &&
+ be32_to_cpu(sb.sb_header.mh_type) == GFS2_METATYPE_SB)
+ rc = 1;
+ close(fd);
+ return rc;
}
int check_for_gfs2(struct gfs2_sbd *sdp)
@@ -159,6 +183,8 @@ int check_for_gfs2(struct gfs2_sbd *sdp)
if (!is_pathname_mounted(sdp, &ro))
return -1;
+ if (!is_gfs2(sdp))
+ return -1;
return 0;
}
14 years, 2 months
gfs2-utils: master - fsck.gfs2: Use fsck.ext3's method of dealing with root mounts
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 8390aba13d23264c8abefb067d0d640581ed350a
Parent: 8407be4c4ee5711a7e0be50444aeff4ba7f0ee26
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Feb 11 09:14:14 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Feb 11 09:16:47 2010 -0600
fsck.gfs2: Use fsck.ext3's method of dealing with root mounts
This patch scraps the old way of determining if a gfs2 file
system is mounted and does it the way fsck.ext3 does.
rhbz#557128
---
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/misc.c | 114 +++++++++++++++++++++++++++++------------------
2 files changed, 71 insertions(+), 44 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index d89194c..6aa9e2d 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -599,6 +599,7 @@ extern int compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs);
extern int compute_constants(struct gfs2_sbd *sdp);
extern int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount);
+extern int is_gfs2(struct gfs2_sbd *sdp);
extern int find_gfs2_meta(struct gfs2_sbd *sdp);
extern int dir_exists(const char *dir);
extern int check_for_gfs2(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 6a1425a..aac91ff 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -17,6 +17,7 @@
#include <dirent.h>
#include <linux/kdev_t.h>
#include <sys/sysmacros.h>
+#include <mntent.h>
#include "libgfs2.h"
@@ -101,58 +102,81 @@ int compute_constants(struct gfs2_sbd *sdp)
int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
{
FILE *fp;
- char buffer[PATH_MAX];
- char fstype[80];
- int fsdump, fspass, ret;
- char fspath[PATH_MAX];
- char fsoptions[PATH_MAX];
- char *realname;
+ struct mntent *mnt;
+ dev_t file_dev=0, file_rdev=0;
+ ino_t file_ino=0;
+ struct stat st_buf;
*ro_mount = 0;
- realname = realpath(sdp->path_name, NULL);
- if (!realname)
+ if ((fp = setmntent("/proc/mounts", "r")) == NULL) {
+ perror("open: /proc/mounts");
return 0;
- fp = fopen("/proc/mounts", "r");
- if (fp == NULL) {
- free(realname);
+ }
+ if (stat(sdp->path_name, &st_buf) == 0) {
+ if (S_ISBLK(st_buf.st_mode)) {
+#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
+ file_rdev = st_buf.st_rdev;
+#endif /* __GNU__ */
+ } else {
+ file_dev = st_buf.st_dev;
+ file_ino = st_buf.st_ino;
+ }
+ }
+ while ((mnt = getmntent (fp)) != NULL) {
+ /* Check if they specified the device instead of mnt point */
+ if (strcmp(sdp->device_name, mnt->mnt_fsname) == 0) {
+ strcpy(sdp->path_name, mnt->mnt_dir); /* fix it */
+ break;
+ }
+ if (strcmp(sdp->path_name, mnt->mnt_dir) == 0) {
+ strcpy(sdp->device_name, mnt->mnt_fsname); /* fix it */
+ break;
+ }
+ if (stat(mnt->mnt_fsname, &st_buf) == 0) {
+ if (S_ISBLK(st_buf.st_mode)) {
+#ifndef __GNU__
+ if (file_rdev && (file_rdev == st_buf.st_rdev))
+ break;
+#endif /* __GNU__ */
+ } else {
+ if (file_dev && ((file_dev == st_buf.st_dev) &&
+ (file_ino == st_buf.st_ino)))
+ break;
+ }
+ }
+ }
+ endmntent (fp);
+ if (mnt == NULL)
return 0;
+ if (stat(mnt->mnt_dir, &st_buf) < 0) {
+ if (errno == ENOENT)
+ return 0;
}
- while ((fgets(buffer, PATH_MAX - 1, fp)) != NULL) {
- buffer[PATH_MAX - 1] = 0;
-
- if (strstr(buffer, "0") == 0)
- continue;
-
- ret = sscanf(buffer, "%s %s %s %s %d %d", sdp->device_name,
- fspath, fstype, fsoptions, &fsdump, &fspass);
- if (6 != ret)
- continue;
-
- if (strcmp(fstype, "gfs2") != 0)
- continue;
+ /* Can't trust fstype because / has "rootfs". */
+ if (file_rdev && (st_buf.st_dev != file_rdev))
+ return 0;
+ if (hasmntopt(mnt, MNTOPT_RO))
+ *ro_mount = 1;
+ return 1; /* mounted */
+}
- /* Check if they specified the device instead of mnt point */
- if (strcmp(sdp->device_name, realname) == 0)
- strcpy(sdp->path_name, fspath); /* fix it */
- else if (strcmp(fspath, realname) != 0)
- continue;
+int is_gfs2(struct gfs2_sbd *sdp)
+{
+ int fd, rc;
+ struct gfs2_sb sb;
- if (strncmp(fsoptions, "ro,", 3) == 0 ||
- strcmp(fsoptions, "ro") == 0)
- *ro_mount = 1;
- fclose(fp);
- free(realname);
- if (strncmp(sdp->device_name, "/dev/loop", 9) == 0) {
- errno = EINVAL;
- return 0;
- }
+ fd = open(sdp->device_name, O_RDWR);
+ if (fd < 0)
+ return 0;
- return 1;
- }
- free(realname);
- fclose(fp);
- errno = EINVAL;
- return 0;
+ rc = 0;
+ if (lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK, SEEK_SET) >= 0 &&
+ read(fd, &sb, sizeof(sb)) == sizeof(sb) &&
+ be32_to_cpu(sb.sb_header.mh_magic) == GFS2_MAGIC &&
+ be32_to_cpu(sb.sb_header.mh_type) == GFS2_METATYPE_SB)
+ rc = 1;
+ close(fd);
+ return rc;
}
int check_for_gfs2(struct gfs2_sbd *sdp)
@@ -161,6 +185,8 @@ int check_for_gfs2(struct gfs2_sbd *sdp)
if (!is_pathname_mounted(sdp, &ro))
return -1;
+ if (!is_gfs2(sdp))
+ return -1;
return 0;
}
14 years, 2 months
cluster: STABLE3 - rgmanager: Make relocate-to-offline consistent
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 369493ab6772a1d2f657f964ea72f2d8bb3ea854
Parent: d1e2d3b644b09c2a47f47775910e61b5ee5abf5c
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Feb 10 14:12:40 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Feb 10 17:55:04 2010 -0500
rgmanager: Make relocate-to-offline consistent
Relocating (note: not migrating) a service is supposed
to try other hosts if the specified target is offline.
This works correctly when central_processing is enabled,
but not in standard mode. This patch fixes the errant
behavior.
Resolves: rhbz#536157
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 029100e..d9f02b3 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1669,18 +1669,17 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
/* TODO: simplify this and don't keep alloc/freeing
member lists */
allowed_nodes = member_list();
- /* Avoid even bothering the other node if we can */
- m = memb_id_to_p(allowed_nodes, preferred_target);
- if (!m) {
- free_member_list(allowed_nodes);
- return RG_EINVAL;
- }
- count_resource_groups_local(m);
- if (m->cn_svcexcl ||
- (m->cn_svccount && is_exclusive(svcName))) {
- free_member_list(allowed_nodes);
- return RG_EDEPEND;
+ m = memb_id_to_p(allowed_nodes, preferred_target);
+ if (m && m->cn_member) {
+ count_resource_groups_local(m);
+ if (m->cn_svcexcl ||
+ (m->cn_svccount && is_exclusive(svcName))) {
+ free_member_list(allowed_nodes);
+ return RG_EDEPEND;
+ }
+ } else {
+ target = preferred_target = -1;
}
free_member_list(allowed_nodes);
}
14 years, 2 months
cluster: RHEL55 - rgmanager: Make relocate-to-offline consistent
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5c6b9d216ad358e83ae6f5307f1622427c878afc
Parent: c35975aa2c0819482e29ca6e391f5a9f15dbcea9
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Feb 10 14:12:40 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Feb 10 17:36:24 2010 -0500
rgmanager: Make relocate-to-offline consistent
Relocating (note: not migrating) a service is supposed
to try other hosts if the specified target is offline.
This works correctly when central_processing is enabled,
but not in standard mode. This patch fixes the errant
behavior.
Resolves: rhbz#536157
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index ce5189c..49464d5 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1731,18 +1731,17 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
/* TODO: simplify this and don't keep alloc/freeing
member lists */
allowed_nodes = member_list();
- /* Avoid even bothering the other node if we can */
- m = memb_id_to_p(allowed_nodes, preferred_target);
- if (!m) {
- free_member_list(allowed_nodes);
- return RG_EINVAL;
- }
- count_resource_groups_local(m);
- if (m->cn_svcexcl ||
- (m->cn_svccount && is_exclusive(svcName))) {
- free_member_list(allowed_nodes);
- return RG_EDEPEND;
+ m = memb_id_to_p(allowed_nodes, preferred_target);
+ if (m && m->cn_member) {
+ count_resource_groups_local(m);
+ if (m->cn_svcexcl ||
+ (m->cn_svccount && is_exclusive(svcName))) {
+ free_member_list(allowed_nodes);
+ return RG_EDEPEND;
+ }
+ } else {
+ target = preferred_target = -1;
}
free_member_list(allowed_nodes);
}
14 years, 2 months
cluster: STABLE3 - gfs2_edit savemeta: Don't release indirect buffers too soon
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: d1e2d3b644b09c2a47f47775910e61b5ee5abf5c
Parent: 66bca4ef66d93c8bd0ce12915698e32cb2b16654
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Feb 10 13:46:58 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Wed Feb 10 14:01:29 2010 -0600
gfs2_edit savemeta: Don't release indirect buffers too soon
This patch fixes a regression in the "gfs2_edit savemeta" command
whereby system files such as journals were not being saved.
The function that processes indirect block lists was releasing
buffers in a fashion that works okay with the old buf.c
assumptions but too soon for the new buf.c assumptions.
rhbz#455300
---
gfs2/edit/savemeta.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 6df3a4b..496a7d2 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -298,9 +298,7 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
}
if (height != hgt) { /* If not at max height */
nbh = bread(&sbd, indir_block);
- osi_list_add_prev(&nbh->b_altlist,
- cur_list);
- brelse(nbh);
+ osi_list_add_prev(&nbh->b_altlist, cur_list);
}
} /* for all data on the indirect block */
}
14 years, 2 months
gfs2-utils: master - gfs2_edit savemeta: Don't release indirect buffers too soon
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 8407be4c4ee5711a7e0be50444aeff4ba7f0ee26
Parent: 71f46b8688811540f0bfd53b63b55915a5b34ebc
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Feb 10 13:46:58 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Wed Feb 10 13:58:38 2010 -0600
gfs2_edit savemeta: Don't release indirect buffers too soon
This patch fixes a regression in the "gfs2_edit savemeta" command
whereby system files such as journals were not being saved.
The function that processes indirect block lists was releasing
buffers in a fashion that works okay with the old buf.c
assumptions but too soon for the new buf.c assumptions.
rhbz#455300
---
gfs2/edit/savemeta.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 44adaf0..45c9cb7 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -300,9 +300,7 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
}
if (height != hgt) { /* If not at max height */
nbh = bread(&sbd, indir_block);
- osi_list_add_prev(&nbh->b_altlist,
- cur_list);
- brelse(nbh);
+ osi_list_add_prev(&nbh->b_altlist, cur_list);
}
} /* for all data on the indirect block */
}
14 years, 2 months
resource-agents: master - resource-agents: isAlive error logging for file systems
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git...
Commit: 1004e18909a4a9039de835ee29034ecf42b6157d
Parent: 83c569553c8fe3dbfbb158958a52e2f227c185dd
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Feb 10 12:11:33 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Feb 10 14:06:14 2010 -0500
resource-agents: isAlive error logging for file systems
This change adapts two different patch sets, one
contributed by Nick Downs.
It fixes:
- isAlive logging for all file systems
- file naming during isAlive checks for cluster
file systems
Resolves: rhbz#562237
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/clusterfs.sh | 15 +++++++++++----
rgmanager/src/resources/fs.sh.in | 13 ++++++++++---
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index 8558d5f..0ccc93d 100644
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -424,8 +424,9 @@ Device $dev is mounted on $tmp_mp instead of $mp"
#
isAlive()
{
+ declare errcode
declare mount_point
- declare file=".writable_test"
+ declare file=".writable_test.$(hostname)"
declare rw
if [ $# -ne 1 ]; then
@@ -444,8 +445,10 @@ isAlive()
# depth 10 test (read test)
ls $mount_point > /dev/null 2> /dev/null
- if [ $? -ne 0 ]; then
- return $NO
+ errcode=$?
+ if [ $errcode -ne 0 ]; then
+ ocf_log err "clusterfs:${OCF_RESKEY_name}: isAlive failed read test on [$mount_point]. Return code: $errcode"
+ return $NO
fi
[ $OCF_CHECK_LEVEL -lt 20 ] && return $YES
@@ -468,7 +471,11 @@ isAlive()
fi
done
touch $file > /dev/null 2> /dev/null
- [ $? -ne 0 ] && return $NO
+ errcode=$?
+ if [ $errcode -ne 0 ]; then
+ ocf_log err "clusterfs:${OCF_RESKEY_name}: isAlive failed write test on [$mount_point]. Return code: $errcode"
+ return $NO
+ fi
rm -f $file > /dev/null 2> /dev/null
fi
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 65cff9c..1454295 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -620,6 +620,7 @@ isMounted () {
#
isAlive()
{
+ declare errcode
declare mount_point
declare file=".writable_test"
declare rw
@@ -640,8 +641,10 @@ isAlive()
# depth 10 test (read test)
ls $mount_point > /dev/null 2> /dev/null
- if [ $? -ne 0 ]; then
- return $NO
+ errcode=$?
+ if [ $errcode -ne 0 ]; then
+ ocf_log err "fs:${OCF_RESKEY_name}: isAlive failed read test on [$mount_point]. Return code: $errcode"
+ return $NO
fi
[ $OCF_CHECK_LEVEL -lt 20 ] && return $YES
@@ -664,7 +667,11 @@ isAlive()
fi
done
touch $file > /dev/null 2> /dev/null
- [ $? -ne 0 ] && return $NO
+ errcode=$?
+ if [ $errcode -ne 0 ]; then
+ ocf_log err "fs:${OCF_RESKEY_name}: isAlive failed write test on [$mount_point]. Return code: $errcode"
+ return $NO
+ fi
rm -f $file > /dev/null 2> /dev/null
fi
14 years, 2 months