diff -r 7b25263a3fdc heartbeat/Filesystem
--- a/heartbeat/Filesystem Sun May 16 13:49:37 2010 +0200
+++ b/heartbeat/Filesystem Wed May 26 11:40:05 2010 +0900
@@ -16,6 +16,7 @@
# OCF_RESKEY_fstype
# OCF_RESKEY_options
# OCF_RESKEY_statusfile_prefix
+# OCF_RESKEY_run_fsck
#
#OCF_RESKEY_device : name of block device for the filesystem. e.g. /dev/sda1, /dev/md0
# Or a -U or -L option for mount, or an NFS mount specification
@@ -23,6 +24,7 @@
#OCF_RESKEY_fstype : optional name of the filesystem type. e.g. ext2
#OCF_RESKEY_options : options to be given to the mount command via -o
#OCF_RESKEY_statusfile_prefix : the prefix used for a status file for monitoring
+#OCF_RESKEY_run_fsck : fsck execution mode: auto(default)/force/no
#
#
# This assumes you want to manage a filesystem on a shared (SCSI) bus,
@@ -151,6 +153,18 @@
+
+
+Specify how to decide whether to run fsck or not.
+
+"auto" : decide to run fsck depending on the fstype(default)
+"force" : always run fsck regardless of the fstype
+"no" : do not run fsck ever.
+
+run_fsck
+
+
+
@@ -379,6 +393,25 @@
fi
}
+is_fsck_needed() {
+ case $OCF_RESKEY_run_fsck in
+ force) true;;
+ no) false;;
+ ""|auto)
+ case $FSTYPE in
+ ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre)
+ false;;
+ *)
+ true;;
+ esac;;
+ *)
+ ocf_log warn "Invalid parameter value for fsck: '$OCF_RESKEY_run_fsck'; 'auto' is used."
+ OCF_RESKEY_run_fsck="auto"
+ is_fsck_needed;;
+ esac
+}
+
+
#
# START: Start up the filesystem
#
@@ -430,12 +463,7 @@
exit $OCF_ERR_INSTALLED
fi
- if
- case $FSTYPE in
- ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre) false;;
- *) true;;
- esac
- then
+ if is_fsck_needed; then
ocf_log info "Starting filesystem check on $DEVICE"
if [ -z "$FSTYPE" ]; then
$FSCK -p $DEVICE