aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-11-25 09:31:28 -0500
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:40:25 -0500
commitaf09e51b6810d3408db1c0e956b3b0687b0e3723 (patch)
tree1a77fce2998b9cf3a2d26dd1158803045bdf846f /fs/ocfs2
parent85eb8b73d66530bb7b931789ae7a5ec9744eed34 (diff)
ocfs2: Fix oops when extending quota files
We have to mark buffer as uptodate before calling ocfs2_journal_access() and ocfs2_set_buffer_uptodate() does not do this for us. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/quota_global.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 2bdcddd3f1c4..8fceb0c49b3e 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -174,7 +174,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
174 struct inode *gqinode = oinfo->dqi_gqinode; 174 struct inode *gqinode = oinfo->dqi_gqinode;
175 int offset = off & (sb->s_blocksize - 1); 175 int offset = off & (sb->s_blocksize - 1);
176 sector_t blk = off >> sb->s_blocksize_bits; 176 sector_t blk = off >> sb->s_blocksize_bits;
177 int err = 0, new = 0; 177 int err = 0, new = 0, ja_type;
178 struct buffer_head *bh = NULL; 178 struct buffer_head *bh = NULL;
179 handle_t *handle = journal_current_handle(); 179 handle_t *handle = journal_current_handle();
180 180
@@ -207,32 +207,28 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
207 if ((offset || len < sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE) && 207 if ((offset || len < sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE) &&
208 !new) { 208 !new) {
209 err = ocfs2_read_quota_block(gqinode, blk, &bh); 209 err = ocfs2_read_quota_block(gqinode, blk, &bh);
210 if (err) { 210 ja_type = OCFS2_JOURNAL_ACCESS_WRITE;
211 mlog_errno(err);
212 return err;
213 }
214 err = ocfs2_journal_access(handle, gqinode, bh,
215 OCFS2_JOURNAL_ACCESS_WRITE);
216 } else { 211 } else {
217 bh = ocfs2_get_quota_block(gqinode, blk, &err); 212 bh = ocfs2_get_quota_block(gqinode, blk, &err);
218 if (!bh) { 213 ja_type = OCFS2_JOURNAL_ACCESS_CREATE;
219 mlog_errno(err);
220 return err;
221 }
222 err = ocfs2_journal_access(handle, gqinode, bh,
223 OCFS2_JOURNAL_ACCESS_CREATE);
224 } 214 }
225 if (err < 0) { 215 if (err) {
226 brelse(bh); 216 mlog_errno(err);
227 goto out; 217 return err;
228 } 218 }
229 lock_buffer(bh); 219 lock_buffer(bh);
230 if (new) 220 if (new)
231 memset(bh->b_data, 0, sb->s_blocksize); 221 memset(bh->b_data, 0, sb->s_blocksize);
232 memcpy(bh->b_data + offset, data, len); 222 memcpy(bh->b_data + offset, data, len);
233 flush_dcache_page(bh->b_page); 223 flush_dcache_page(bh->b_page);
224 set_buffer_uptodate(bh);
234 unlock_buffer(bh); 225 unlock_buffer(bh);
235 ocfs2_set_buffer_uptodate(gqinode, bh); 226 ocfs2_set_buffer_uptodate(gqinode, bh);
227 err = ocfs2_journal_access(handle, gqinode, bh, ja_type);
228 if (err < 0) {
229 brelse(bh);
230 goto out;
231 }
236 err = ocfs2_journal_dirty(handle, bh); 232 err = ocfs2_journal_dirty(handle, bh);
237 brelse(bh); 233 brelse(bh);
238 if (err < 0) 234 if (err < 0)