Commit 47be12e4eec84c1846f29af64fe25a396b57a026

Authored by Tao Ma
Committed by Mark Fasheh
1 parent 64e71303e4

ocfs2: Access and dirty the buffer_head in mark_written.

In __ocfs2_mark_extent_written, when we meet with the situation
of c_split_covers_rec, the old solution just replace the extent
record and forget to access and dirty the buffer_head. This will
cause a problem when the unwritten extent is in an extent block.
So access and dirty it.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>

Showing 1 changed file with 26 additions and 1 deletions Side-by-side Diff

... ... @@ -4796,6 +4796,29 @@
4796 4796 return ret;
4797 4797 }
4798 4798  
  4799 +static int ocfs2_replace_extent_rec(struct inode *inode,
  4800 + handle_t *handle,
  4801 + struct ocfs2_path *path,
  4802 + struct ocfs2_extent_list *el,
  4803 + int split_index,
  4804 + struct ocfs2_extent_rec *split_rec)
  4805 +{
  4806 + int ret;
  4807 +
  4808 + ret = ocfs2_path_bh_journal_access(handle, inode, path,
  4809 + path_num_items(path) - 1);
  4810 + if (ret) {
  4811 + mlog_errno(ret);
  4812 + goto out;
  4813 + }
  4814 +
  4815 + el->l_recs[split_index] = *split_rec;
  4816 +
  4817 + ocfs2_journal_dirty(handle, path_leaf_bh(path));
  4818 +out:
  4819 + return ret;
  4820 +}
  4821 +
4799 4822 /*
4800 4823 * Mark part or all of the extent record at split_index in the leaf
4801 4824 * pointed to by path as written. This removes the unwritten
... ... @@ -4885,7 +4908,9 @@
4885 4908  
4886 4909 if (ctxt.c_contig_type == CONTIG_NONE) {
4887 4910 if (ctxt.c_split_covers_rec)
4888   - el->l_recs[split_index] = *split_rec;
  4911 + ret = ocfs2_replace_extent_rec(inode, handle,
  4912 + path, el,
  4913 + split_index, split_rec);
4889 4914 else
4890 4915 ret = ocfs2_split_and_insert(inode, handle, path, et,
4891 4916 &last_eb_bh, split_index,