Whamcloud - gitweb
Automatically detect when to apply the fixes patch.
[fs/lustre-release.git] / lustre / extN / Makefile.am
index 05ca190..340a550 100644 (file)
@@ -8,12 +8,13 @@ MODULE = extN
 modulefs_DATA = extN.o
 EXTRA_PROGRAMS = extN
 
-EXTNP =
+EXTNP = 
+EXTN_FIXES = ext3-2.4.18-fixes.diff
 # NOTE: If you are not using a RedHat 12.5 or later kernel, then you need to
 #       apply the following patch first, as it fixes a number of bugs in ext3.
 #       You can either apply it as part of the extN build by uncommenting the
 #       line below, or apply it to the source kernel tree and fix ext3 also.
-# EXTNP = ext3-2.4.18-fixes.diff
+# EXTNP = $(EXTN_FIXES)
 EXTNP+= htree-ext3-2.4.18.diff linux-2.4.18ea-0.8.26.diff
 EXTNP+= ext3-2.4.18-ino_sb_macro.diff extN-misc-fixup.diff
 EXTNC = balloc.c bitmap.c dir.c file.c fsync.c ialloc.c inode.c ioctl.c
@@ -97,7 +98,9 @@ patch-stamp: sed-stamp $(EXTNP)
          (cd $(top_srcdir) && patch -p0) < $(srcdir)/extN.patch-$(RELEASE);  \
        else                                                                  \
          echo "If first patch fails, read NOTE in extN/Makefile.am";         \
-         list='$(EXTNP)'; for p in $$list; do                                \
+         list='$(EXTNP)'; \
+         sed '/extN_mark_inode_dirty/q' $(srcdir)/extN.orig/namei.c | tail -2 | grep i_version >/dev/null || list="$(EXTN_FIXES) $$list"; \
+         for p in $$list; do                                \
            echo "applying patch $$p";                                        \
            sed $(SUB) $(srcdir)/$$p |                                        \
              (cd $(top_srcdir) && patch -p1) || exit $$?;                    \