[Pm-utils] [PATCH] Prevent journal-commit from overriding /etc/fstab

Nic Case niccase at myway.com
Mon Nov 22 20:28:40 PST 2010


If a user sets the commit parameter in /etc/fstab, the value would have been ignored and reset to the default kernel value of 5 s.  By not 
passing the commit parameter explicitly, the value will be taken from the /etc/fstab file, or if not present in that file, will be reset to the default 
kernel value of 5 s.

Signed off by Nic Case <niccase at myway.com>
---
diff --git a/pm/power.d/journal-commit b/pm/power.d/journal-commit
index 5c0fc16..325e6d5 100644
--- a/pm/power.d/journal-commit
+++ b/pm/power.d/journal-commit
@@ -24,7 +24,7 @@ remount_fs()
 {
        # $1 = filesystem to remount
        # $2 = mount option to change
-       mount -o remount,$2 $1
+       mount -o remount$2 $1
 }
 
 # invoked on an ext3 file system
@@ -32,7 +32,11 @@ handle_ext3()
 {
        # $1 = filesystem to remount
        # $2 = commit time
-       remount_fs $1 "commit=${2}"
+       if [ "$2" = "0" ]; then
+               remount_fs $1 
+       else
+               remount_fs $1 ",commit=${2}" 
+       fi
 }
 
 handle_ext4() { handle_ext3 "$@"; }


More information about the Pm-utils mailing list