- fix ext4 "preen" fsck at mount.

This commit is contained in:
Ian Kent 2009-11-10 03:13:04 +00:00
parent 62a2e0fa94
commit 2b02d9b82a
2 changed files with 189 additions and 1 deletions

View File

@ -0,0 +1,183 @@
autofs-5.0.5 - fix ext4 fsck at mount
From: Ian Kent <raven@themaw.net>
Autofs performs a "preen" fsck at max mount count for ext2 and ext3, but not
ext4.
---
Makefile.conf.in | 3 ++
configure | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++
configure.in | 1
include/config.h.in | 6 ++++
modules/Makefile | 10 ++++++--
modules/mount_ext2.c | 11 ++++----
6 files changed, 87 insertions(+), 7 deletions(-)
--- autofs-5.0.4.orig/Makefile.conf.in
+++ autofs-5.0.4/Makefile.conf.in
@@ -44,6 +44,9 @@ EXT2FS = @HAVE_E2FSCK@
# Support for calling e3fsck when mounting ext3 filesystems
EXT3FS = @HAVE_E3FSCK@
+# Support for calling e4fsck when mounting ext4 filesystems
+EXT4FS = @HAVE_E4FSCK@
+
LEX = @PATH_LEX@
YACC = @PATH_YACC@
RPCGEN = @PATH_RPCGEN@
--- autofs-5.0.4.orig/configure
+++ autofs-5.0.4/configure
@@ -668,6 +668,8 @@ PATH_LEX
LEX
HAVE_MODPROBE
MODPROBE
+HAVE_E4FSCK
+E4FSCK
HAVE_E3FSCK
E3FSCK
HAVE_E2FSCK
@@ -3407,6 +3409,67 @@ else
HAVE_E3FSCK=0
fi
+for ac_prog in fsck.ext4 e4fsck
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_E4FSCK+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $E4FSCK in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_E4FSCK="$E4FSCK" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $searchpath
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_E4FSCK="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+E4FSCK=$ac_cv_path_E4FSCK
+if test -n "$E4FSCK"; then
+ { $as_echo "$as_me:$LINENO: result: $E4FSCK" >&5
+$as_echo "$E4FSCK" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$E4FSCK" && break
+done
+
+if test -n "$E4FSCK"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_E4FSCK 1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PATH_E4FSCK "$E4FSCK"
+_ACEOF
+
+ HAVE_E4FSCK=1
+else
+ HAVE_E4FSCK=0
+fi
+
for ac_prog in modprobe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
--- autofs-5.0.4.orig/configure.in
+++ autofs-5.0.4/configure.in
@@ -131,6 +131,7 @@ AF_PATH_INCLUDE(MOUNT, mount, /bin/mount
AF_PATH_INCLUDE(UMOUNT, umount, /bin/umount, $searchpath)
AF_PATH_INCLUDE(E2FSCK, fsck.ext2 e2fsck, , $searchpath)
AF_PATH_INCLUDE(E3FSCK, fsck.ext3 e3fsck, , $searchpath)
+AF_PATH_INCLUDE(E4FSCK, fsck.ext4 e4fsck, , $searchpath)
AF_PATH_INCLUDE(MODPROBE, modprobe, , $searchpath)
AF_CHECK_PROG(LEX, flex lex, , $searchpath)
--- autofs-5.0.4.orig/include/config.h.in
+++ autofs-5.0.4/include/config.h.in
@@ -18,6 +18,9 @@
/* define if you have E3FSCK */
#undef HAVE_E3FSCK
+/* define if you have E4FSCK */
+#undef HAVE_E4FSCK
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -93,6 +96,9 @@
/* define if you have E3FSCK */
#undef PATH_E3FSCK
+/* define if you have E4FSCK */
+#undef PATH_E4FSCK
+
/* define if you have LEX */
#undef PATH_LEX
--- autofs-5.0.4.orig/modules/Makefile
+++ autofs-5.0.4/modules/Makefile
@@ -69,10 +69,16 @@ ifeq ($(EXT2FS), 1)
ifeq ($(EXT3FS), 1)
ln -fs mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext3.so
endif
-else
- ifeq ($(EXT3FS), 1)
+ ifeq ($(EXT4FS), 1)
+ ln -fs mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext4.so
+ endif
+else ifeq ($(EXT3FS), 1)
mv $(INSTALLROOT)$(autofslibdir)/mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext3.so
+ ifeq ($(EXT4FS), 1)
+ ln -fs mount_ext3.so $(INSTALLROOT)$(autofslibdir)/mount_ext4.so
endif
+else ifeq ($(EXT4FS), 1)
+ mv $(INSTALLROOT)$(autofslibdir)/mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext4.so
endif
#
--- autofs-5.0.4.orig/modules/mount_ext2.c
+++ autofs-5.0.4/modules/mount_ext2.c
@@ -83,13 +83,14 @@ int mount_mount(struct autofs_point *ap,
ro = 1;
}
+ fsck_prog = PATH_E2FSCK;
#ifdef HAVE_E3FSCK
- if (!strcmp(fstype,"ext3") || !strcmp(fstype,"auto"))
+ if (!strcmp(fstype,"ext3"))
fsck_prog = PATH_E3FSCK;
- else
- fsck_prog = PATH_E2FSCK;
-#else
- fsck_prog = PATH_E2FSCK;
+#endif
+#ifdef HAVE_E4FSCK
+ if (!strcmp(fstype,"ext4"))
+ fsck_prog = PATH_E4FSCK;
#endif
if (ro) {
debug(ap->logopt,

View File

@ -4,7 +4,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.5
Release: 4%{?dist}
Release: 5%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -18,6 +18,7 @@ Patch5: autofs-5.0.5-fix-libxml2-workaround-configure.patch
Patch6: autofs-5.0.5-more-code-analysis-corrections.patch
Patch7: autofs-5.0.5-fix-backwards-ifndef-INET6.patch
Patch8: autofs-5.0.5-fix-stale-init-for-file-map-instance.patch
Patch9: autofs-5.0.5-fix-ext4-fsck-at-mount.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
Requires: kernel >= 2.6.17
@ -67,6 +68,7 @@ echo %{version}-%{release} > .version
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -119,6 +121,9 @@ fi
%{_libdir}/autofs/
%changelog
* Tue Nov 10 2009 Ian Kent <ikent@redhat.com> - 1:5.0.5-5
- fix ext4 "preen" fsck at mount.
* Mon Nov 9 2009 Ian Kent <ikent@redhat.com> - 1:5.0.5-4
- fix stale initialization for file map instance patch was not applied.