Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Linux-ha-cvs digest..." Today's Topics: 1. Linux-HA CVS: resources by lars from (linux-ha-cvs@lists.linux-ha.org) 2. Linux-HA CVS: lrm by davidlee from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Thu, 22 Jun 2006 12:13:53 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: resources by lars from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : lars Host : Project : linux-ha Module : resources Dir : linux-ha/resources/OCF Modified Files: Filesystem.in Log Message: On a failed mount, cleanup OCFS2. (This would happen by the "stop" which would be issued a bit later anyway, but this is slightly cleaner.) Move helper functions into a common block. =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/Filesystem.in,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- Filesystem.in 21 Jun 2006 20:43:00 -0000 1.30 +++ Filesystem.in 22 Jun 2006 18:13:53 -0000 1.31 @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Filesystem.in,v 1.30 2006/06/21 20:43:00 lars Exp $ +# $Id: Filesystem.in,v 1.31 2006/06/22 18:13:53 lars Exp $ # # Support: [EMAIL PROTECTED] # License: GNU General Public License (GPL) @@ -95,7 +95,7 @@ usage() { cat <<-EOT usage: $0 {start|stop|status|monitor|validate-all|meta-data} - $Id: Filesystem.in,v 1.30 2006/06/21 20:43:00 lars Exp $ + $Id: Filesystem.in,v 1.31 2006/06/22 18:13:53 lars Exp $ EOT } @@ -206,12 +206,100 @@ fi } +determine_blockdevice() { + if [ $blockdevice == "yes" ]; then + return + fi + + # Get the current real device name, if possible. + # (specified devname could be -L or -U...) + case "$FSTYPE" in + nfs|smbfs|cifs) ;; + *) DEVICE=`list_mounts | grep " $MOUNTPOINT " | cut -d' ' -f1` + if [ -b "$DEVICE" ]; then + blockdevice=yes + fi + ;; + esac +} + # Lists all filesystems potentially mounted under a given path, # excluding the path itself. list_submounts() { list_mounts | grep " $1/" | cut -d' ' -f2 | sort -r } +ocfs2_cleanup() { + # We'll never see the post-stop notification. We're gone now, + # have unmounted, and thus should remove the membership. + # + # (Do so regardless of whether we were unmounted already, + # because the admin might have manually unmounted but not + # cleared up the membership directory. Bad admin, no cookie.) + # + if [ ! -d "$OCFS2_FS_ROOT" ]; then + ocf_log info "$OCFS2_FS_ROOT: Filesystem membership already gone." + else + ocf_log info "$OCFS2_FS_ROOT: Removing membership directory." + rm -rf $OCFS2_FS_ROOT/ + fi +} + +ocfs2_init() +{ + # Check & initialize the OCFS2 specific variables. + if [ -z "$OCF_RESKEY_CRM_meta_clone_max" ]; then + ocf_log err "ocfs2 must be run as a clone." + exit $OCF_ERR_GENERIC + fi + + if [ $blockdevice = "no" ]; then + ocf_log err "$DEVICE: ocfs2 needs a block device instead." + exit $OCF_ERR_GENERIC + fi + + for f in "$OCF_RESKEY_ocfs2_configfs" /sys/kernel/config/cluster /configfs/cluster ; do + if [ -n "$f" -a -d "$f" ]; then + OCFS2_CONFIGFS="$f" + break + fi + done + if [ ! -d "$OCFS2_CONFIGFS" ]; then + ocf_log err "ocfs2 needs configfs mounted." + exit $OCF_ERR_GENERIC + fi + + OCFS2_UUID=$(mounted.ocfs2 -d $DEVICE|tail -1|awk '{print $3}'|tr -d -- -|tr a-z A-Z) + if [ -z "$OCFS2_UUID" -o "$OCFS2_UUID" = "UUID" ]; then + ocf_log err "$DEVICE: Could not determine ocfs2 UUID." + exit $OCF_ERR_GENERIC + fi + + if [ -n "$OCF_RESKEY_ocfs2_cluster" ]; then + OCFS2_CLUSTER=$(echo $OCF_RESKEY_ocfs2_cluster | tr a-z A-Z) + else + OCFS2_CLUSTER=$(find "$OCFS2_CONFIGFS" -maxdepth 1 -mindepth 1 -type d -printf %f 2>/dev/null) + set -- $OCFS2_CLUSTER + local n="$#" + if [ $n -gt 1 ]; then + ocf_log err "$OCFS2_CLUSTER: several clusters found." + exit $OCF_ERR_GENERIC + fi + if [ $n -eq 0 ]; then + ocf_log err "$OCFS2_CONFIGFS: no clusters found." + exit $OCF_ERR_GENERIC + fi + fi + + OCFS2_CLUSTER_ROOT="$OCFS2_CONFIGFS/$OCFS2_CLUSTER" + if [ ! -d "$OCFS2_CLUSTER_ROOT" ]; then + ocf_log err "$OCFS2_CLUSTER: Cluster doesn't exist. Maybe o2cb hasn't been run?" + exit $OCF_ERR_GENERIC + fi + + OCFS2_FS_ROOT=$OCFS2_CLUSTER_ROOT/heartbeat/$OCFS2_UUID +} + # # START: Start up the filesystem # @@ -300,10 +388,13 @@ if [ $? -ne 0 ]; then ocf_log err "Couldn't mount filesystem $DEVICE on $MOUNTPOINT" + if [ "$FSTYPE" = "ocfs2" ]; then + ocfs2_cleanup + fi return $OCF_ERR_GENERIC fi - return $? + return 0 } # end of Filesystem_start @@ -449,39 +540,6 @@ done } -ocfs2_cleanup() { - # We'll never see the post-stop notification. We're gone now, - # have unmounted, and thus should remove the membership. - # - # (Do so regardless of whether we were unmounted already, - # because the admin might have manually unmounted but not - # cleared up the membership directory. Bad admin, no cookie.) - # - if [ ! -d "$OCFS2_FS_ROOT" ]; then - ocf_log info "$OCFS2_FS_ROOT: Filesystem membership already gone." - else - ocf_log info "$OCFS2_FS_ROOT: Removing membership directory." - rm -rf $OCFS2_FS_ROOT/ - fi -} - -determine_blockdevice() { - if [ $blockdevice == "yes" ]; then - return - fi - - # Get the current real device name, if possible. - # (specified devname could be -L or -U...) - case "$FSTYPE" in - nfs|smbfs|cifs) ;; - *) DEVICE=`list_mounts | grep " $MOUNTPOINT " | cut -d' ' -f1` - if [ -b "$DEVICE" ]; then - blockdevice=yes - fi - ;; - esac -} - # # STOP: Unmount the filesystem # @@ -599,61 +657,6 @@ return $OCF_SUCCESS } -ocfs2_init() -{ - # Check & initialize the OCFS2 specific variables. - if [ -z "$OCF_RESKEY_CRM_meta_clone_max" ]; then - ocf_log err "ocfs2 must be run as a clone." - exit $OCF_ERR_GENERIC - fi - - if [ $blockdevice = "no" ]; then - ocf_log err "$DEVICE: ocfs2 needs a block device instead." - exit $OCF_ERR_GENERIC - fi - - for f in "$OCF_RESKEY_ocfs2_configfs" /sys/kernel/config/cluster /configfs/cluster ; do - if [ -n "$f" -a -d "$f" ]; then - OCFS2_CONFIGFS="$f" - break - fi - done - if [ ! -d "$OCFS2_CONFIGFS" ]; then - ocf_log err "ocfs2 needs configfs mounted." - exit $OCF_ERR_GENERIC - fi - - OCFS2_UUID=$(mounted.ocfs2 -d $DEVICE|tail -1|awk '{print $3}'|tr -d -- -|tr a-z A-Z) - if [ -z "$OCFS2_UUID" -o "$OCFS2_UUID" = "UUID" ]; then - ocf_log err "$DEVICE: Could not determine ocfs2 UUID." - exit $OCF_ERR_GENERIC - fi - - if [ -n "$OCF_RESKEY_ocfs2_cluster" ]; then - OCFS2_CLUSTER=$(echo $OCF_RESKEY_ocfs2_cluster | tr a-z A-Z) - else - OCFS2_CLUSTER=$(find "$OCFS2_CONFIGFS" -maxdepth 1 -mindepth 1 -type d -printf %f 2>/dev/null) - set -- $OCFS2_CLUSTER - local n="$#" - if [ $n -gt 1 ]; then - ocf_log err "$OCFS2_CLUSTER: several clusters found." - exit $OCF_ERR_GENERIC - fi - if [ $n -eq 0 ]; then - ocf_log err "$OCFS2_CONFIGFS: no clusters found." - exit $OCF_ERR_GENERIC - fi - fi - - OCFS2_CLUSTER_ROOT="$OCFS2_CONFIGFS/$OCFS2_CLUSTER" - if [ ! -d "$OCFS2_CLUSTER_ROOT" ]; then - ocf_log err "$OCFS2_CLUSTER: Cluster doesn't exist. Maybe o2cb hasn't been run?" - exit $OCF_ERR_GENERIC - fi - - OCFS2_FS_ROOT=$OCFS2_CLUSTER_ROOT/heartbeat/$OCFS2_UUID -} - # Check the arguments passed to this script if [ $# -ne 1 ] ------------------------------ Message: 2 Date: Thu, 22 Jun 2006 15:00:58 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: lrm by davidlee from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : davidlee Host : Project : linux-ha Module : lrm Dir : linux-ha/lrm/admin Modified Files: lrmadmin.c Log Message: Beware null pointer in printf(%s) =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/lrm/admin/lrmadmin.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- lrmadmin.c 22 Jun 2006 10:33:22 -0000 1.39 +++ lrmadmin.c 22 Jun 2006 21:00:57 -0000 1.40 @@ -1,4 +1,4 @@ -/* $Id: lrmadmin.c,v 1.39 2006/06/22 10:33:22 sunjd Exp $ */ +/* $Id: lrmadmin.c,v 1.40 2006/06/22 21:00:57 davidlee Exp $ */ /* File: lrmadmin.c * Description: A adminstration tool for Local Resource Manager * @@ -569,7 +569,7 @@ } printf("op_status: %d\n", op->op_status); printf("return code: %d\n", op->rc); - printf("output data: \n%s\n", op->output); + printf("output data: \n%s\n", (op->output ? op->output : "[null]")); printf("---------------------------------------\n\n"); ret_value = op->op_status; } @@ -982,6 +982,9 @@ /* * $Log: lrmadmin.c,v $ + * Revision 1.40 2006/06/22 21:00:57 davidlee + * Beware null pointer in printf(%s) + * * Revision 1.39 2006/06/22 10:33:22 sunjd * (bug1301): make a better output * ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 31, Issue 86 ********************************************