Patch "btrfs: clear ordered flag on cleaning up ordered extents" has been added to the 4.13-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
btrfs: clear ordered flag on cleaning up ordered extents
to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
btrfs-clear-ordered-flag-on-cleaning-up-ordered-extents.patch
and it can be found in the queue-4.13 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
63d71450c8d817649a79e37d685523f988b9cc98Mon Sep 17 00:00:00 2001
From: Naohiro Aota <[email protected]>
Date: Fri, 1 Sep 2017 17:58:47 +0900
Subject: btrfs: clear ordered flag on cleaning up ordered extents
From: Naohiro Aota <[email protected]>
commit 63d71450c8d817649a79e37d685523f988b9cc98 upstream.
Commit 524272607e88 ("btrfs: Handle delalloc error correctly to avoid ordered extent hang") introduced btrfs_cleanup_ordered_extents() to cleanup submitted ordered extents. However, it does not clear the ordered bit (Private2) of corresponding pages. Thus, the following BUG occurs from free_pages_check_bad() (on btrfs/125 with nospace_cache).
BUG: Bad page state in process btrfs pfn:3fa787 page:ffffdf2acfe9e1c0 count:0 mapcount:0 mapping: (null) index:0xd flags: 0x8000000000002008(uptodate|private_2) raw: 8000000000002008 0000000000000000 000000000000000d 00000000ffffffff raw: ffffdf2acf5c1b20 ffffb443802238b0 0000000000000000 0000000000000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
bad because of flags: 0x2000(private_2)
This patch clears the flag same as other places calling btrfs_dec_test_ordered_pending() for every page in the specified range.
--- fs/btrfs/inode.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/btrfs/inode.c +12 -0
@@ -135,6 +135,18 @@ static inline void btrfs_cleanup_orderedconst u64 offset, const u64 bytes) { + unsigned long index = offset >> PAGE_SHIFT; +unsigned long end_index = (offset + bytes -1 ) >>PAGE_SHIFT ; +struct page *page; + +while (index <= end_index) { + page =find_get_page (inode->i_mapping, index); + index++; +if (!page) +continue ; +ClearPagePrivate2 (page); +put_page (page); + }return __endio_write_update_ordered (inode, offset +PAGE_SIZE , bytes -PAGE_SIZE , false); }
Patches currently in stable-queue which might be from [email protected] are
queue-4.13/btrfs-propagate-error-to-btrfs_cmp_data_prepare-caller.patch queue-4.13/btrfs-fix-null-pointer-dereference-from-free_reloc_roots.patch queue-4.13/btrfs-clear-ordered-flag-on-cleaning-up-ordered-extents.patch queue-4.13/btrfs-finish-ordered-extent-cleaning-if-no-progress-is-found.patch