summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-24 19:10:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-24 19:10:23 -0400
commit9c9fa97a8edbc3668dfc7a25de516e80c146e86f (patch)
tree2dc0e90203796a4b346ce190f9521c3294104058 /fs/ocfs2/alloc.c
parent5184d449600f501a8688069f35c138c6b3bf8b94 (diff)
parent2b38d01b4de8b1bbda7f5f7e91252609557635fc (diff)
Merge branch 'akpm' (patches from Andrew)
Merge updates from Andrew Morton: - a few hot fixes - ocfs2 updates - almost all of -mm (slab-generic, slab, slub, kmemleak, kasan, cleanups, debug, pagecache, memcg, gup, pagemap, memory-hotplug, sparsemem, vmalloc, initialization, z3fold, compaction, mempolicy, oom-kill, hugetlb, migration, thp, mmap, madvise, shmem, zswap, zsmalloc) * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (132 commits) mm/zsmalloc.c: fix a -Wunused-function warning zswap: do not map same object twice zswap: use movable memory if zpool support allocate movable memory zpool: add malloc_support_movable to zpool_driver shmem: fix obsolete comment in shmem_getpage_gfp() mm/madvise: reduce code duplication in error handling paths mm: mmap: increase sockets maximum memory size pgoff for 32bits mm/mmap.c: refine find_vma_prev() with rb_last() riscv: make mmap allocation top-down by default mips: use generic mmap top-down layout and brk randomization mips: replace arch specific way to determine 32bit task with generic version mips: adjust brk randomization offset to fit generic version mips: use STACK_TOP when computing mmap base address mips: properly account for stack randomization and stack guard gap arm: use generic mmap top-down layout and brk randomization arm: use STACK_TOP when computing mmap base address arm: properly account for stack randomization and stack guard gap arm64, mm: make randomization selected by generic topdown mmap layout arm64, mm: move generic mmap layout functions to mm arm64: consider stack randomization for mmap base only when necessary ...
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 0c335b51043d..f9baefc76cf9 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -5993,6 +5993,7 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
5993 struct buffer_head *data_alloc_bh = NULL; 5993 struct buffer_head *data_alloc_bh = NULL;
5994 struct ocfs2_dinode *di; 5994 struct ocfs2_dinode *di;
5995 struct ocfs2_truncate_log *tl; 5995 struct ocfs2_truncate_log *tl;
5996 struct ocfs2_journal *journal = osb->journal;
5996 5997
5997 BUG_ON(inode_trylock(tl_inode)); 5998 BUG_ON(inode_trylock(tl_inode));
5998 5999
@@ -6013,6 +6014,20 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
6013 goto out; 6014 goto out;
6014 } 6015 }
6015 6016
6017 /* Appending truncate log(TA) and and flushing truncate log(TF) are
6018 * two separated transactions. They can be both committed but not
6019 * checkpointed. If crash occurs then, both two transaction will be
6020 * replayed with several already released to global bitmap clusters.
6021 * Then truncate log will be replayed resulting in cluster double free.
6022 */
6023 jbd2_journal_lock_updates(journal->j_journal);
6024 status = jbd2_journal_flush(journal->j_journal);
6025 jbd2_journal_unlock_updates(journal->j_journal);
6026 if (status < 0) {
6027 mlog_errno(status);
6028 goto out;
6029 }
6030
6016 data_alloc_inode = ocfs2_get_system_file_inode(osb, 6031 data_alloc_inode = ocfs2_get_system_file_inode(osb,
6017 GLOBAL_BITMAP_SYSTEM_INODE, 6032 GLOBAL_BITMAP_SYSTEM_INODE,
6018 OCFS2_INVALID_SLOT); 6033 OCFS2_INVALID_SLOT);
@@ -6792,6 +6807,8 @@ void ocfs2_map_and_dirty_page(struct inode *inode, handle_t *handle,
6792 struct page *page, int zero, u64 *phys) 6807 struct page *page, int zero, u64 *phys)
6793{ 6808{
6794 int ret, partial = 0; 6809 int ret, partial = 0;
6810 loff_t start_byte = ((loff_t)page->index << PAGE_SHIFT) + from;
6811 loff_t length = to - from;
6795 6812
6796 ret = ocfs2_map_page_blocks(page, phys, inode, from, to, 0); 6813 ret = ocfs2_map_page_blocks(page, phys, inode, from, to, 0);
6797 if (ret) 6814 if (ret)
@@ -6811,7 +6828,8 @@ void ocfs2_map_and_dirty_page(struct inode *inode, handle_t *handle,
6811 if (ret < 0) 6828 if (ret < 0)
6812 mlog_errno(ret); 6829 mlog_errno(ret);
6813 else if (ocfs2_should_order_data(inode)) { 6830 else if (ocfs2_should_order_data(inode)) {
6814 ret = ocfs2_jbd2_file_inode(handle, inode); 6831 ret = ocfs2_jbd2_inode_add_write(handle, inode,
6832 start_byte, length);
6815 if (ret < 0) 6833 if (ret < 0)
6816 mlog_errno(ret); 6834 mlog_errno(ret);
6817 } 6835 }