From 383e67217d3f537157f081f115f7267446076860 Mon Sep 17 00:00:00 2001
From: johann <johann>
Date: Fri, 25 May 2007 17:44:49 +0000
Subject: [PATCH] Branch b1_6

Reverve patch from bug 11743 since it breaks SLES9 build.
For the record, the revision associated to the commit was 1.176.2.14.

b=11743
---
 .../patches/export-ext3-2.6-rhel4.patch       | 14 ++++-----
 .../patches/export-ext3-2.6-suse.patch        | 14 ++++-----
 lustre/ChangeLog                              |  8 -----
 .../patches/export-ext3-2.6-rhel4.patch       | 14 ++++-----
 .../patches/export-ext3-2.6-suse.patch        | 14 ++++-----
 lustre/lvfs/fsfilt_ext3.c                     | 29 +++++++------------
 6 files changed, 35 insertions(+), 58 deletions(-)

diff --git a/ldiskfs/kernel_patches/patches/export-ext3-2.6-rhel4.patch b/ldiskfs/kernel_patches/patches/export-ext3-2.6-rhel4.patch
index 9f443b49b8..7b4f0c88f0 100644
--- a/ldiskfs/kernel_patches/patches/export-ext3-2.6-rhel4.patch
+++ b/ldiskfs/kernel_patches/patches/export-ext3-2.6-rhel4.patch
@@ -1,8 +1,8 @@
-Index: linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c
+Index: linux-stage/fs/ext3/super.c
 ===================================================================
---- linux-2.6.9-42.0.10.EL_lustre.1.4.10.orig/fs/ext3/super.c	2007-05-16 08:46:24.000000000 +0200
-+++ linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c	2007-05-16 08:48:58.000000000 +0200
-@@ -123,6 +123,8 @@ void ext3_journal_abort_handle(const cha
+--- linux-stage.orig/fs/ext3/super.c	2005-02-25 14:50:46.077845320 +0200
++++ linux-stage/fs/ext3/super.c	2005-02-25 14:51:32.241827328 +0200
+@@ -123,6 +123,8 @@
  	journal_abort_handle(handle);
  }
  
@@ -11,7 +11,7 @@ Index: linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c
  /* Deal with the reporting of failure conditions on a filesystem such as
   * inconsistencies detected or read IO failures.
   *
-@@ -2064,6 +2066,8 @@ int ext3_force_commit(struct super_block
+@@ -2002,6 +2004,8 @@
  	return ret;
  }
  
@@ -20,15 +20,13 @@ Index: linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c
  /*
   * Ext3 always journals updates to the superblock itself, so we don't
   * have to propagate any other updates to the superblock on disk at this
-@@ -2586,6 +2590,12 @@ int ext3_map_inode_page(struct inode *in
+@@ -2433,6 +2437,10 @@
                          unsigned long *blocks, int *created, int create);
  EXPORT_SYMBOL(ext3_map_inode_page);
  
 +EXPORT_SYMBOL(ext3_xattr_get);
 +EXPORT_SYMBOL(ext3_xattr_set_handle);
 +EXPORT_SYMBOL(ext3_bread);
-+EXPORT_SYMBOL(ext3_journal_start_sb);
-+EXPORT_SYMBOL(__ext3_journal_stop);
 +
  MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
  MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
diff --git a/ldiskfs/kernel_patches/patches/export-ext3-2.6-suse.patch b/ldiskfs/kernel_patches/patches/export-ext3-2.6-suse.patch
index 367a05116b..638b4bf006 100644
--- a/ldiskfs/kernel_patches/patches/export-ext3-2.6-suse.patch
+++ b/ldiskfs/kernel_patches/patches/export-ext3-2.6-suse.patch
@@ -1,8 +1,8 @@
-Index: linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c
+Index: linux-stage/fs/ext3/super.c
 ===================================================================
---- linux-2.6.5-7.283_lustre.1.4.10.orig/fs/ext3/super.c	2007-05-16 08:57:44.000000000 +0200
-+++ linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c	2007-05-16 08:59:11.000000000 +0200
-@@ -116,6 +116,8 @@ void ext3_journal_abort_handle(const cha
+--- linux-stage.orig/fs/ext3/super.c	2004-04-02 16:40:18.000000000 -0500
++++ linux-stage/fs/ext3/super.c	2004-04-02 16:40:18.000000000 -0500
+@@ -115,6 +115,8 @@
  		handle->h_err = err;
  }
  
@@ -11,7 +11,7 @@ Index: linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c
  static char error_buf[1024];
  
  /* Deal with the reporting of failure conditions on a filesystem such as
-@@ -1895,6 +1897,8 @@ int ext3_force_commit(struct super_block
+@@ -1774,6 +1776,8 @@
  	return ret;
  }
  
@@ -20,15 +20,13 @@ Index: linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c
  /*
   * Ext3 always journals updates to the superblock itself, so we don't
   * have to propagate any other updates to the superblock on disk at this
-@@ -2334,6 +2338,12 @@ int ext3_map_inode_page(struct inode *in
+@@ -2088,6 +2092,10 @@
                          unsigned long *blocks, int *created, int create);
  EXPORT_SYMBOL(ext3_map_inode_page);
  
 +EXPORT_SYMBOL(ext3_xattr_get);
 +EXPORT_SYMBOL(ext3_xattr_set_handle);
 +EXPORT_SYMBOL(ext3_bread);
-+EXPORT_SYMBOL(ext3_journal_start_sb);
-+EXPORT_SYMBOL(__ext3_journal_stop);
 +
  MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
  MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index b04a7fa516..539747d09c 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -20,14 +20,6 @@ Bugzilla   : 12538
 Description: sanity-quota.sh quotacheck failed: rc = -22
 Details    : Quotas cannot be enabled on SLES10.
 
-Severity   : normal
-Frequency  : sometimes when underlying device returns I/O errors
-Bugzilla   : 11743
-Description: OSTs not going read-only during write failures
-Details    : OSTs are not remounted read-only when the journal commit threads
-	     get I/O errors because fsfilt_ext3 calls journal_start/stop()
-	     instead of the ext3 wrappers.
-
 Severity   : normal
 Frequency  : liblustre clients only
 Bugzilla   : 12229
diff --git a/lustre/kernel_patches/patches/export-ext3-2.6-rhel4.patch b/lustre/kernel_patches/patches/export-ext3-2.6-rhel4.patch
index 9f443b49b8..7b4f0c88f0 100644
--- a/lustre/kernel_patches/patches/export-ext3-2.6-rhel4.patch
+++ b/lustre/kernel_patches/patches/export-ext3-2.6-rhel4.patch
@@ -1,8 +1,8 @@
-Index: linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c
+Index: linux-stage/fs/ext3/super.c
 ===================================================================
---- linux-2.6.9-42.0.10.EL_lustre.1.4.10.orig/fs/ext3/super.c	2007-05-16 08:46:24.000000000 +0200
-+++ linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c	2007-05-16 08:48:58.000000000 +0200
-@@ -123,6 +123,8 @@ void ext3_journal_abort_handle(const cha
+--- linux-stage.orig/fs/ext3/super.c	2005-02-25 14:50:46.077845320 +0200
++++ linux-stage/fs/ext3/super.c	2005-02-25 14:51:32.241827328 +0200
+@@ -123,6 +123,8 @@
  	journal_abort_handle(handle);
  }
  
@@ -11,7 +11,7 @@ Index: linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c
  /* Deal with the reporting of failure conditions on a filesystem such as
   * inconsistencies detected or read IO failures.
   *
-@@ -2064,6 +2066,8 @@ int ext3_force_commit(struct super_block
+@@ -2002,6 +2004,8 @@
  	return ret;
  }
  
@@ -20,15 +20,13 @@ Index: linux-2.6.9-42.0.10.EL_lustre.1.4.10/fs/ext3/super.c
  /*
   * Ext3 always journals updates to the superblock itself, so we don't
   * have to propagate any other updates to the superblock on disk at this
-@@ -2586,6 +2590,12 @@ int ext3_map_inode_page(struct inode *in
+@@ -2433,6 +2437,10 @@
                          unsigned long *blocks, int *created, int create);
  EXPORT_SYMBOL(ext3_map_inode_page);
  
 +EXPORT_SYMBOL(ext3_xattr_get);
 +EXPORT_SYMBOL(ext3_xattr_set_handle);
 +EXPORT_SYMBOL(ext3_bread);
-+EXPORT_SYMBOL(ext3_journal_start_sb);
-+EXPORT_SYMBOL(__ext3_journal_stop);
 +
  MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
  MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
diff --git a/lustre/kernel_patches/patches/export-ext3-2.6-suse.patch b/lustre/kernel_patches/patches/export-ext3-2.6-suse.patch
index 367a05116b..638b4bf006 100644
--- a/lustre/kernel_patches/patches/export-ext3-2.6-suse.patch
+++ b/lustre/kernel_patches/patches/export-ext3-2.6-suse.patch
@@ -1,8 +1,8 @@
-Index: linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c
+Index: linux-stage/fs/ext3/super.c
 ===================================================================
---- linux-2.6.5-7.283_lustre.1.4.10.orig/fs/ext3/super.c	2007-05-16 08:57:44.000000000 +0200
-+++ linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c	2007-05-16 08:59:11.000000000 +0200
-@@ -116,6 +116,8 @@ void ext3_journal_abort_handle(const cha
+--- linux-stage.orig/fs/ext3/super.c	2004-04-02 16:40:18.000000000 -0500
++++ linux-stage/fs/ext3/super.c	2004-04-02 16:40:18.000000000 -0500
+@@ -115,6 +115,8 @@
  		handle->h_err = err;
  }
  
@@ -11,7 +11,7 @@ Index: linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c
  static char error_buf[1024];
  
  /* Deal with the reporting of failure conditions on a filesystem such as
-@@ -1895,6 +1897,8 @@ int ext3_force_commit(struct super_block
+@@ -1774,6 +1776,8 @@
  	return ret;
  }
  
@@ -20,15 +20,13 @@ Index: linux-2.6.5-7.283_lustre.1.4.10/fs/ext3/super.c
  /*
   * Ext3 always journals updates to the superblock itself, so we don't
   * have to propagate any other updates to the superblock on disk at this
-@@ -2334,6 +2338,12 @@ int ext3_map_inode_page(struct inode *in
+@@ -2088,6 +2092,10 @@
                          unsigned long *blocks, int *created, int create);
  EXPORT_SYMBOL(ext3_map_inode_page);
  
 +EXPORT_SYMBOL(ext3_xattr_get);
 +EXPORT_SYMBOL(ext3_xattr_set_handle);
 +EXPORT_SYMBOL(ext3_bread);
-+EXPORT_SYMBOL(ext3_journal_start_sb);
-+EXPORT_SYMBOL(__ext3_journal_stop);
 +
  MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
  MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c
index f00508925e..17fe4c5b12 100644
--- a/lustre/lvfs/fsfilt_ext3.c
+++ b/lustre/lvfs/fsfilt_ext3.c
@@ -68,15 +68,6 @@
 #define FSFILT_DELETE_TRANS_BLOCKS(sb)    EXT3_DELETE_TRANS_BLOCKS(sb)
 #endif
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define fsfilt_ext3_journal_start(inode, nblocks) \
-                                journal_start(EXT3_JOURNAL(inode),nblocks)
-#define fsfilt_ext3_journal_stop(handle)          journal_stop(handle)
-#else
-#define fsfilt_ext3_journal_start(inode, nblocks) ext3_journal_start(inode, nblocks)
-#define fsfilt_ext3_journal_stop(handle)          ext3_journal_stop(handle)
-#endif
-
 static kmem_cache_t *fcb_cache;
 
 struct fsfilt_cb_data {
@@ -265,7 +256,7 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private,
  journal_start:
         LASSERTF(nblocks > 0, "can't start %d credit transaction\n", nblocks);
         lock_24kernel();
-        handle = fsfilt_ext3_journal_start(inode, nblocks);
+        handle = journal_start(EXT3_JOURNAL(inode), nblocks);
         unlock_24kernel();
 
         if (!IS_ERR(handle))
@@ -404,7 +395,7 @@ static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso,
 
         LASSERTF(needed > 0, "can't start %d credit transaction\n", needed);
         lock_24kernel();
-        handle = fsfilt_ext3_journal_start(fso->fso_dentry->d_inode, needed);
+        handle = journal_start(journal, needed);
         unlock_24kernel();
         if (IS_ERR(handle)) {
                 CERROR("can't get handle for %d credits: rc = %ld\n", needed,
@@ -446,7 +437,7 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
                 handle->h_sync = 1; /* recovery likes this */
 
         lock_24kernel();
-        rc = fsfilt_ext3_journal_stop(handle);
+        rc = journal_stop(handle);
         unlock_24kernel();
 
         return rc;
@@ -472,7 +463,7 @@ static int fsfilt_ext3_commit_async(struct inode *inode, void *h,
         tid = transaction->t_tid;
         /* we don't want to be blocked */
         handle->h_sync = 0;
-        rc = fsfilt_ext3_journal_stop(handle);
+        rc = journal_stop(handle);
         if (rc) {
                 CERROR("error while stopping transaction: %d\n", rc);
                 unlock_24kernel();
@@ -986,7 +977,7 @@ static int ext3_ext_new_extent_cb(struct ext3_extents_tree *tree,
         ext3_up_truncate_sem(inode);
 
         lock_24kernel();
-        handle = fsfilt_ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
+        handle = journal_start(EXT3_JOURNAL(inode), count+EXT3_ALLOC_NEEDED+1);
         unlock_24kernel();
         if (IS_ERR(handle)) {
                 ext3_down_truncate_sem(inode);
@@ -997,7 +988,7 @@ static int ext3_ext_new_extent_cb(struct ext3_extents_tree *tree,
         if (tgen != EXT_GENERATION(tree)) {
                 /* the tree has changed. so path can be invalid at moment */
                 lock_24kernel();
-                fsfilt_ext3_journal_stop(handle);
+                journal_stop(handle);
                 unlock_24kernel();
                 return EXT_REPEAT;
         }
@@ -1032,7 +1023,7 @@ static int ext3_ext_new_extent_cb(struct ext3_extents_tree *tree,
 
 out:
         lock_24kernel();
-        fsfilt_ext3_journal_stop(handle);
+        journal_stop(handle);
         unlock_24kernel();
 map:
         if (err >= 0) {
@@ -1258,6 +1249,7 @@ static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize,
         struct inode *inode = file->f_dentry->d_inode;
         loff_t old_size = inode->i_size, offset = *offs;
         loff_t new_size = inode->i_size;
+        journal_t *journal;
         handle_t *handle;
         int err = 0, block_count = 0, blocksize, size, boffs;
 
@@ -1266,8 +1258,9 @@ static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize,
         block_count = (*offs & (blocksize - 1)) + bufsize;
         block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
 
+        journal = EXT3_SB(inode->i_sb)->s_journal;
         lock_24kernel();
-        handle = fsfilt_ext3_journal_start(inode,
+        handle = journal_start(journal,
                                block_count * FSFILT_DATA_TRANS_BLOCKS(inode->i_sb) + 2);
         unlock_24kernel();
         if (IS_ERR(handle)) {
@@ -1329,7 +1322,7 @@ out:
         }
 
         lock_24kernel();
-        fsfilt_ext3_journal_stop(handle);
+        journal_stop(handle);
         unlock_24kernel();
 
         if (err == 0)
-- 
GitLab