]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.fixes/ocfs2-quota-Initialize-blocks-allocated-to-local-quota-fi.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / ocfs2-quota-Initialize-blocks-allocated-to-local-quota-fi.patch
diff --git a/src/patches/suse-2.6.27.31/patches.fixes/ocfs2-quota-Initialize-blocks-allocated-to-local-quota-fi.patch b/src/patches/suse-2.6.27.31/patches.fixes/ocfs2-quota-Initialize-blocks-allocated-to-local-quota-fi.patch
new file mode 100644 (file)
index 0000000..645fb3b
--- /dev/null
@@ -0,0 +1,149 @@
+From ac60e745d0187b11d9e7f9fcb37e64cc7c02ded0 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Wed, 17 Jun 2009 19:09:19 +0200
+Subject: [PATCH 3/6] ocfs2: Initialize blocks allocated to local quota file
+
+When we extend local quota file, we should initialize data
+in newly allocated block. Firstly because on recovery we could
+parse bogus data, secondly so that block checksums are properly
+computed.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+---
+ fs/ocfs2/quota_local.c |   98 ++++++++++++++++++++++++++++++++++++++++-------
+ 1 files changed, 83 insertions(+), 15 deletions(-)
+
+Index: linux-2.6.27-SLE11_BRANCH/fs/ocfs2/quota_local.c
+===================================================================
+--- linux-2.6.27-SLE11_BRANCH.orig/fs/ocfs2/quota_local.c      2009-07-16 13:26:06.000000000 +0200
++++ linux-2.6.27-SLE11_BRANCH/fs/ocfs2/quota_local.c   2009-07-16 14:00:23.000000000 +0200
+@@ -930,7 +930,7 @@
+       struct ocfs2_local_disk_chunk *dchunk;
+       int status;
+       handle_t *handle;
+-      struct buffer_head *bh = NULL;
++      struct buffer_head *bh = NULL, *dbh = NULL;
+       u64 p_blkno;
+       /* We are protected by dqio_sem so no locking needed */
+@@ -973,7 +973,7 @@
+       dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data;
+-      handle = ocfs2_start_trans(OCFS2_SB(sb), 2);
++      handle = ocfs2_start_trans(OCFS2_SB(sb), 3);
+       if (IS_ERR(handle)) {
+               status = PTR_ERR(handle);
+               mlog_errno(status);
+@@ -998,6 +998,38 @@
+               goto out_trans;
+       }
++      /* Initialize new block with structures */
++      down_read(&OCFS2_I(lqinode)->ip_alloc_sem);
++      status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks + 1,
++                                           &p_blkno, NULL, NULL);
++      up_read(&OCFS2_I(lqinode)->ip_alloc_sem);
++      if (status < 0) {
++              mlog_errno(status);
++              goto out_trans;
++      }
++      dbh = sb_getblk(sb, p_blkno);
++      if (!dbh) {
++              status = -ENOMEM;
++              mlog_errno(status);
++              goto out_trans;
++      }
++      ocfs2_set_new_buffer_uptodate(lqinode, dbh);
++      status = ocfs2_journal_access(handle, lqinode, dbh,
++                                       OCFS2_JOURNAL_ACCESS_CREATE);
++      if (status < 0) {
++              mlog_errno(status);
++              goto out_trans;
++      }
++      lock_buffer(dbh);
++      memset(dbh->b_data, 0, sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE);
++      unlock_buffer(dbh);
++      status = ocfs2_journal_dirty(handle, dbh);
++      if (status < 0) {
++              mlog_errno(status);
++              goto out_trans;
++      }
++
++      /* Update local quotafile info */
+       oinfo->dqi_blocks += 2;
+       oinfo->dqi_chunks++;
+       status = ocfs2_local_write_info(sb, type);
+@@ -1022,6 +1054,7 @@
+       ocfs2_commit_trans(OCFS2_SB(sb), handle);
+ out:
+       brelse(bh);
++      brelse(dbh);
+       kmem_cache_free(ocfs2_qf_chunk_cachep, chunk);
+       return ERR_PTR(status);
+ }
+@@ -1039,6 +1072,8 @@
+       struct ocfs2_local_disk_chunk *dchunk;
+       int epb = ol_quota_entries_per_block(sb);
+       unsigned int chunk_blocks;
++      struct buffer_head *bh;
++      u64 p_blkno;
+       int status;
+       handle_t *handle;
+@@ -1066,12 +1101,46 @@
+               mlog_errno(status);
+               goto out;
+       }
+-      handle = ocfs2_start_trans(OCFS2_SB(sb), 2);
++
++      /* Get buffer from the just added block */
++      down_read(&OCFS2_I(lqinode)->ip_alloc_sem);
++      status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks,
++                                           &p_blkno, NULL, NULL);
++      up_read(&OCFS2_I(lqinode)->ip_alloc_sem);
++      if (status < 0) {
++              mlog_errno(status);
++              goto out;
++      }
++      bh = sb_getblk(sb, p_blkno);
++      if (!bh) {
++              status = -ENOMEM;
++              mlog_errno(status);
++              goto out;
++      }
++      ocfs2_set_new_buffer_uptodate(lqinode, bh);
++
++      handle = ocfs2_start_trans(OCFS2_SB(sb), 3);
+       if (IS_ERR(handle)) {
+               status = PTR_ERR(handle);
+               mlog_errno(status);
+               goto out;
+       }
++      /* Zero created block */
++      status = ocfs2_journal_access(handle, lqinode, bh,
++                               OCFS2_JOURNAL_ACCESS_CREATE);
++      if (status < 0) {
++              mlog_errno(status);
++              goto out_trans;
++      }
++      lock_buffer(bh);
++      memset(bh->b_data, 0, sb->s_blocksize);
++      unlock_buffer(bh);
++      status = ocfs2_journal_dirty(handle, bh);
++      if (status < 0) {
++              mlog_errno(status);
++              goto out_trans;
++      }
++      /* Update chunk header */
+       status = ocfs2_journal_access(handle, lqinode, chunk->qc_headerbh,
+                                OCFS2_JOURNAL_ACCESS_WRITE);
+       if (status < 0) {
+@@ -1088,6 +1157,7 @@
+               mlog_errno(status);
+               goto out_trans;
+       }
++      /* Update file header */
+       oinfo->dqi_blocks++;
+       status = ocfs2_local_write_info(sb, type);
+       if (status < 0) {