summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/alloc.c10
-rw-r--r--fs/ocfs2/localalloc.c6
2 files changed, 7 insertions, 9 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index d1348fc4ca6d..0c335b51043d 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -6191,17 +6191,17 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
6191 if (le16_to_cpu(tl->tl_used)) { 6191 if (le16_to_cpu(tl->tl_used)) {
6192 trace_ocfs2_truncate_log_recovery_num(le16_to_cpu(tl->tl_used)); 6192 trace_ocfs2_truncate_log_recovery_num(le16_to_cpu(tl->tl_used));
6193 6193
6194 *tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL); 6194 /*
6195 * Assuming the write-out below goes well, this copy will be
6196 * passed back to recovery for processing.
6197 */
6198 *tl_copy = kmemdup(tl_bh->b_data, tl_bh->b_size, GFP_KERNEL);
6195 if (!(*tl_copy)) { 6199 if (!(*tl_copy)) {
6196 status = -ENOMEM; 6200 status = -ENOMEM;
6197 mlog_errno(status); 6201 mlog_errno(status);
6198 goto bail; 6202 goto bail;
6199 } 6203 }
6200 6204
6201 /* Assuming the write-out below goes well, this copy
6202 * will be passed back to recovery for processing. */
6203 memcpy(*tl_copy, tl_bh->b_data, tl_bh->b_size);
6204
6205 /* All we need to do to clear the truncate log is set 6205 /* All we need to do to clear the truncate log is set
6206 * tl_used. */ 6206 * tl_used. */
6207 tl->tl_used = 0; 6207 tl->tl_used = 0;
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index f03674afbd30..158e5af767fd 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -424,12 +424,11 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
424 bh = osb->local_alloc_bh; 424 bh = osb->local_alloc_bh;
425 alloc = (struct ocfs2_dinode *) bh->b_data; 425 alloc = (struct ocfs2_dinode *) bh->b_data;
426 426
427 alloc_copy = kmalloc(bh->b_size, GFP_NOFS); 427 alloc_copy = kmemdup(alloc, bh->b_size, GFP_NOFS);
428 if (!alloc_copy) { 428 if (!alloc_copy) {
429 status = -ENOMEM; 429 status = -ENOMEM;
430 goto out_commit; 430 goto out_commit;
431 } 431 }
432 memcpy(alloc_copy, alloc, bh->b_size);
433 432
434 status = ocfs2_journal_access_di(handle, INODE_CACHE(local_alloc_inode), 433 status = ocfs2_journal_access_di(handle, INODE_CACHE(local_alloc_inode),
435 bh, OCFS2_JOURNAL_ACCESS_WRITE); 434 bh, OCFS2_JOURNAL_ACCESS_WRITE);
@@ -1272,13 +1271,12 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
1272 * local alloc shutdown won't try to double free main bitmap 1271 * local alloc shutdown won't try to double free main bitmap
1273 * bits. Make a copy so the sync function knows which bits to 1272 * bits. Make a copy so the sync function knows which bits to
1274 * free. */ 1273 * free. */
1275 alloc_copy = kmalloc(osb->local_alloc_bh->b_size, GFP_NOFS); 1274 alloc_copy = kmemdup(alloc, osb->local_alloc_bh->b_size, GFP_NOFS);
1276 if (!alloc_copy) { 1275 if (!alloc_copy) {
1277 status = -ENOMEM; 1276 status = -ENOMEM;
1278 mlog_errno(status); 1277 mlog_errno(status);
1279 goto bail; 1278 goto bail;
1280 } 1279 }
1281 memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size);
1282 1280
1283 status = ocfs2_journal_access_di(handle, 1281 status = ocfs2_journal_access_di(handle,
1284 INODE_CACHE(local_alloc_inode), 1282 INODE_CACHE(local_alloc_inode),