]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch...
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Jul 2020 13:10:11 +0000 (15:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Jul 2020 13:10:11 +0000 (15:10 +0200)
queue-4.14/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch [deleted file]
queue-4.14/series
queue-4.19/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch [deleted file]
queue-4.19/series
queue-5.4/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch [deleted file]
queue-5.4/series
queue-5.7/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch [deleted file]
queue-5.7/series

diff --git a/queue-4.14/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch b/queue-4.14/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
deleted file mode 100644 (file)
index 7954123..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-From fa91e4aa1716004ea8096d5185ec0451e206aea0 Mon Sep 17 00:00:00 2001
-From: Qu Wenruo <wqu@suse.com>
-Date: Fri, 17 Jul 2020 15:12:05 +0800
-Subject: btrfs: qgroup: fix data leak caused by race between writeback and truncate
-
-From: Qu Wenruo <wqu@suse.com>
-
-commit fa91e4aa1716004ea8096d5185ec0451e206aea0 upstream.
-
-[BUG]
-When running tests like generic/013 on test device with btrfs quota
-enabled, it can normally lead to data leak, detected at unmount time:
-
-  BTRFS warning (device dm-3): qgroup 0/5 has unreleased space, type 0 rsv 4096
-  ------------[ cut here ]------------
-  WARNING: CPU: 11 PID: 16386 at fs/btrfs/disk-io.c:4142 close_ctree+0x1dc/0x323 [btrfs]
-  RIP: 0010:close_ctree+0x1dc/0x323 [btrfs]
-  Call Trace:
-   btrfs_put_super+0x15/0x17 [btrfs]
-   generic_shutdown_super+0x72/0x110
-   kill_anon_super+0x18/0x30
-   btrfs_kill_super+0x17/0x30 [btrfs]
-   deactivate_locked_super+0x3b/0xa0
-   deactivate_super+0x40/0x50
-   cleanup_mnt+0x135/0x190
-   __cleanup_mnt+0x12/0x20
-   task_work_run+0x64/0xb0
-   __prepare_exit_to_usermode+0x1bc/0x1c0
-   __syscall_return_slowpath+0x47/0x230
-   do_syscall_64+0x64/0xb0
-   entry_SYSCALL_64_after_hwframe+0x44/0xa9
-  ---[ end trace caf08beafeca2392 ]---
-  BTRFS error (device dm-3): qgroup reserved space leaked
-
-[CAUSE]
-In the offending case, the offending operations are:
-2/6: writev f2X[269 1 0 0 0 0] [1006997,67,288] 0
-2/7: truncate f2X[269 1 0 0 48 1026293] 18388 0
-
-The following sequence of events could happen after the writev():
-       CPU1 (writeback)                |               CPU2 (truncate)
------------------------------------------------------------------
-btrfs_writepages()                     |
-|- extent_write_cache_pages()          |
-   |- Got page for 1003520             |
-   |  1003520 is Dirty, no writeback   |
-   |  So (!clear_page_dirty_for_io())   |
-   |  gets called for it               |
-   |- Now page 1003520 is Clean.       |
-   |                                   | btrfs_setattr()
-   |                                   | |- btrfs_setsize()
-   |                                   |    |- truncate_setsize()
-   |                                   |       New i_size is 18388
-   |- __extent_writepage()             |
-   |  |- page_offset() > i_size                |
-      |- btrfs_invalidatepage()                |
-        |- Page is clean, so no qgroup |
-           callback executed
-
-This means, the qgroup reserved data space is not properly released in
-btrfs_invalidatepage() as the page is Clean.
-
-[FIX]
-Instead of checking the dirty bit of a page, call
-btrfs_qgroup_free_data() unconditionally in btrfs_invalidatepage().
-
-As qgroup rsv are completely bound to the QGROUP_RESERVED bit of
-io_tree, not bound to page status, thus we won't cause double freeing
-anyway.
-
-Fixes: 0b34c261e235 ("btrfs: qgroup: Prevent qgroup->reserved from going subzero")
-CC: stable@vger.kernel.org # 4.14+
-Reviewed-by: Josef Bacik <josef@toxicpanda.com>
-Signed-off-by: Qu Wenruo <wqu@suse.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- fs/btrfs/inode.c |   23 ++++++++++-------------
- 1 file changed, 10 insertions(+), 13 deletions(-)
-
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -9197,20 +9197,17 @@ again:
-       /*
-        * Qgroup reserved space handler
-        * Page here will be either
--       * 1) Already written to disk
--       *    In this case, its reserved space is released from data rsv map
--       *    and will be freed by delayed_ref handler finally.
--       *    So even we call qgroup_free_data(), it won't decrease reserved
--       *    space.
--       * 2) Not written to disk
--       *    This means the reserved space should be freed here. However,
--       *    if a truncate invalidates the page (by clearing PageDirty)
--       *    and the page is accounted for while allocating extent
--       *    in btrfs_check_data_free_space() we let delayed_ref to
--       *    free the entire extent.
-+       * 1) Already written to disk or ordered extent already submitted
-+       *    Then its QGROUP_RESERVED bit in io_tree is already cleaned.
-+       *    Qgroup will be handled by its qgroup_record then.
-+       *    btrfs_qgroup_free_data() call will do nothing here.
-+       *
-+       * 2) Not written to disk yet
-+       *    Then btrfs_qgroup_free_data() call will clear the QGROUP_RESERVED
-+       *    bit of its io_tree, and free the qgroup reserved data space.
-+       *    Since the IO will never happen for this page.
-        */
--      if (PageDirty(page))
--              btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-+      btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-       if (!inode_evicting) {
-               clear_extent_bit(tree, page_start, page_end,
-                                EXTENT_LOCKED | EXTENT_DIRTY |
index ff2b0b4d7d113923f94acb7612697bb316b1cd72..0f317adb2ceaa3be7af749ff970804bcc68d5a54 100644 (file)
@@ -17,5 +17,4 @@ alsa-info-drop-warn_on-from-buffer-null-sanity-check.patch
 asoc-rt5670-correct-rt5670_ldo_sel_mask.patch
 btrfs-fix-double-free-on-ulist-after-backref-resolution-failure.patch
 btrfs-fix-mount-failure-caused-by-race-with-umount.patch
-btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
 btrfs-fix-page-leaks-after-failure-to-lock-page-for-delalloc.patch
diff --git a/queue-4.19/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch b/queue-4.19/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
deleted file mode 100644 (file)
index d130480..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-From fa91e4aa1716004ea8096d5185ec0451e206aea0 Mon Sep 17 00:00:00 2001
-From: Qu Wenruo <wqu@suse.com>
-Date: Fri, 17 Jul 2020 15:12:05 +0800
-Subject: btrfs: qgroup: fix data leak caused by race between writeback and truncate
-
-From: Qu Wenruo <wqu@suse.com>
-
-commit fa91e4aa1716004ea8096d5185ec0451e206aea0 upstream.
-
-[BUG]
-When running tests like generic/013 on test device with btrfs quota
-enabled, it can normally lead to data leak, detected at unmount time:
-
-  BTRFS warning (device dm-3): qgroup 0/5 has unreleased space, type 0 rsv 4096
-  ------------[ cut here ]------------
-  WARNING: CPU: 11 PID: 16386 at fs/btrfs/disk-io.c:4142 close_ctree+0x1dc/0x323 [btrfs]
-  RIP: 0010:close_ctree+0x1dc/0x323 [btrfs]
-  Call Trace:
-   btrfs_put_super+0x15/0x17 [btrfs]
-   generic_shutdown_super+0x72/0x110
-   kill_anon_super+0x18/0x30
-   btrfs_kill_super+0x17/0x30 [btrfs]
-   deactivate_locked_super+0x3b/0xa0
-   deactivate_super+0x40/0x50
-   cleanup_mnt+0x135/0x190
-   __cleanup_mnt+0x12/0x20
-   task_work_run+0x64/0xb0
-   __prepare_exit_to_usermode+0x1bc/0x1c0
-   __syscall_return_slowpath+0x47/0x230
-   do_syscall_64+0x64/0xb0
-   entry_SYSCALL_64_after_hwframe+0x44/0xa9
-  ---[ end trace caf08beafeca2392 ]---
-  BTRFS error (device dm-3): qgroup reserved space leaked
-
-[CAUSE]
-In the offending case, the offending operations are:
-2/6: writev f2X[269 1 0 0 0 0] [1006997,67,288] 0
-2/7: truncate f2X[269 1 0 0 48 1026293] 18388 0
-
-The following sequence of events could happen after the writev():
-       CPU1 (writeback)                |               CPU2 (truncate)
------------------------------------------------------------------
-btrfs_writepages()                     |
-|- extent_write_cache_pages()          |
-   |- Got page for 1003520             |
-   |  1003520 is Dirty, no writeback   |
-   |  So (!clear_page_dirty_for_io())   |
-   |  gets called for it               |
-   |- Now page 1003520 is Clean.       |
-   |                                   | btrfs_setattr()
-   |                                   | |- btrfs_setsize()
-   |                                   |    |- truncate_setsize()
-   |                                   |       New i_size is 18388
-   |- __extent_writepage()             |
-   |  |- page_offset() > i_size                |
-      |- btrfs_invalidatepage()                |
-        |- Page is clean, so no qgroup |
-           callback executed
-
-This means, the qgroup reserved data space is not properly released in
-btrfs_invalidatepage() as the page is Clean.
-
-[FIX]
-Instead of checking the dirty bit of a page, call
-btrfs_qgroup_free_data() unconditionally in btrfs_invalidatepage().
-
-As qgroup rsv are completely bound to the QGROUP_RESERVED bit of
-io_tree, not bound to page status, thus we won't cause double freeing
-anyway.
-
-Fixes: 0b34c261e235 ("btrfs: qgroup: Prevent qgroup->reserved from going subzero")
-CC: stable@vger.kernel.org # 4.14+
-Reviewed-by: Josef Bacik <josef@toxicpanda.com>
-Signed-off-by: Qu Wenruo <wqu@suse.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- fs/btrfs/inode.c |   23 ++++++++++-------------
- 1 file changed, 10 insertions(+), 13 deletions(-)
-
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -8879,20 +8879,17 @@ again:
-       /*
-        * Qgroup reserved space handler
-        * Page here will be either
--       * 1) Already written to disk
--       *    In this case, its reserved space is released from data rsv map
--       *    and will be freed by delayed_ref handler finally.
--       *    So even we call qgroup_free_data(), it won't decrease reserved
--       *    space.
--       * 2) Not written to disk
--       *    This means the reserved space should be freed here. However,
--       *    if a truncate invalidates the page (by clearing PageDirty)
--       *    and the page is accounted for while allocating extent
--       *    in btrfs_check_data_free_space() we let delayed_ref to
--       *    free the entire extent.
-+       * 1) Already written to disk or ordered extent already submitted
-+       *    Then its QGROUP_RESERVED bit in io_tree is already cleaned.
-+       *    Qgroup will be handled by its qgroup_record then.
-+       *    btrfs_qgroup_free_data() call will do nothing here.
-+       *
-+       * 2) Not written to disk yet
-+       *    Then btrfs_qgroup_free_data() call will clear the QGROUP_RESERVED
-+       *    bit of its io_tree, and free the qgroup reserved data space.
-+       *    Since the IO will never happen for this page.
-        */
--      if (PageDirty(page))
--              btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-+      btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-       if (!inode_evicting) {
-               clear_extent_bit(tree, page_start, page_end,
-                                EXTENT_LOCKED | EXTENT_DIRTY |
index 165f2a8187609ff180d5ec043de1a1a2b7b4e174..74bce920ef93598afdb3986d0e8da7b4cd2a551c 100644 (file)
@@ -21,5 +21,4 @@ alsa-info-drop-warn_on-from-buffer-null-sanity-check.patch
 asoc-rt5670-correct-rt5670_ldo_sel_mask.patch
 btrfs-fix-double-free-on-ulist-after-backref-resolution-failure.patch
 btrfs-fix-mount-failure-caused-by-race-with-umount.patch
-btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
 btrfs-fix-page-leaks-after-failure-to-lock-page-for-delalloc.patch
diff --git a/queue-5.4/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch b/queue-5.4/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
deleted file mode 100644 (file)
index 562a1b2..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-From fa91e4aa1716004ea8096d5185ec0451e206aea0 Mon Sep 17 00:00:00 2001
-From: Qu Wenruo <wqu@suse.com>
-Date: Fri, 17 Jul 2020 15:12:05 +0800
-Subject: btrfs: qgroup: fix data leak caused by race between writeback and truncate
-
-From: Qu Wenruo <wqu@suse.com>
-
-commit fa91e4aa1716004ea8096d5185ec0451e206aea0 upstream.
-
-[BUG]
-When running tests like generic/013 on test device with btrfs quota
-enabled, it can normally lead to data leak, detected at unmount time:
-
-  BTRFS warning (device dm-3): qgroup 0/5 has unreleased space, type 0 rsv 4096
-  ------------[ cut here ]------------
-  WARNING: CPU: 11 PID: 16386 at fs/btrfs/disk-io.c:4142 close_ctree+0x1dc/0x323 [btrfs]
-  RIP: 0010:close_ctree+0x1dc/0x323 [btrfs]
-  Call Trace:
-   btrfs_put_super+0x15/0x17 [btrfs]
-   generic_shutdown_super+0x72/0x110
-   kill_anon_super+0x18/0x30
-   btrfs_kill_super+0x17/0x30 [btrfs]
-   deactivate_locked_super+0x3b/0xa0
-   deactivate_super+0x40/0x50
-   cleanup_mnt+0x135/0x190
-   __cleanup_mnt+0x12/0x20
-   task_work_run+0x64/0xb0
-   __prepare_exit_to_usermode+0x1bc/0x1c0
-   __syscall_return_slowpath+0x47/0x230
-   do_syscall_64+0x64/0xb0
-   entry_SYSCALL_64_after_hwframe+0x44/0xa9
-  ---[ end trace caf08beafeca2392 ]---
-  BTRFS error (device dm-3): qgroup reserved space leaked
-
-[CAUSE]
-In the offending case, the offending operations are:
-2/6: writev f2X[269 1 0 0 0 0] [1006997,67,288] 0
-2/7: truncate f2X[269 1 0 0 48 1026293] 18388 0
-
-The following sequence of events could happen after the writev():
-       CPU1 (writeback)                |               CPU2 (truncate)
------------------------------------------------------------------
-btrfs_writepages()                     |
-|- extent_write_cache_pages()          |
-   |- Got page for 1003520             |
-   |  1003520 is Dirty, no writeback   |
-   |  So (!clear_page_dirty_for_io())   |
-   |  gets called for it               |
-   |- Now page 1003520 is Clean.       |
-   |                                   | btrfs_setattr()
-   |                                   | |- btrfs_setsize()
-   |                                   |    |- truncate_setsize()
-   |                                   |       New i_size is 18388
-   |- __extent_writepage()             |
-   |  |- page_offset() > i_size                |
-      |- btrfs_invalidatepage()                |
-        |- Page is clean, so no qgroup |
-           callback executed
-
-This means, the qgroup reserved data space is not properly released in
-btrfs_invalidatepage() as the page is Clean.
-
-[FIX]
-Instead of checking the dirty bit of a page, call
-btrfs_qgroup_free_data() unconditionally in btrfs_invalidatepage().
-
-As qgroup rsv are completely bound to the QGROUP_RESERVED bit of
-io_tree, not bound to page status, thus we won't cause double freeing
-anyway.
-
-Fixes: 0b34c261e235 ("btrfs: qgroup: Prevent qgroup->reserved from going subzero")
-CC: stable@vger.kernel.org # 4.14+
-Reviewed-by: Josef Bacik <josef@toxicpanda.com>
-Signed-off-by: Qu Wenruo <wqu@suse.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- fs/btrfs/inode.c |   23 ++++++++++-------------
- 1 file changed, 10 insertions(+), 13 deletions(-)
-
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -9072,20 +9072,17 @@ again:
-       /*
-        * Qgroup reserved space handler
-        * Page here will be either
--       * 1) Already written to disk
--       *    In this case, its reserved space is released from data rsv map
--       *    and will be freed by delayed_ref handler finally.
--       *    So even we call qgroup_free_data(), it won't decrease reserved
--       *    space.
--       * 2) Not written to disk
--       *    This means the reserved space should be freed here. However,
--       *    if a truncate invalidates the page (by clearing PageDirty)
--       *    and the page is accounted for while allocating extent
--       *    in btrfs_check_data_free_space() we let delayed_ref to
--       *    free the entire extent.
-+       * 1) Already written to disk or ordered extent already submitted
-+       *    Then its QGROUP_RESERVED bit in io_tree is already cleaned.
-+       *    Qgroup will be handled by its qgroup_record then.
-+       *    btrfs_qgroup_free_data() call will do nothing here.
-+       *
-+       * 2) Not written to disk yet
-+       *    Then btrfs_qgroup_free_data() call will clear the QGROUP_RESERVED
-+       *    bit of its io_tree, and free the qgroup reserved data space.
-+       *    Since the IO will never happen for this page.
-        */
--      if (PageDirty(page))
--              btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-+      btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-       if (!inode_evicting) {
-               clear_extent_bit(tree, page_start, page_end, EXTENT_LOCKED |
-                                EXTENT_DELALLOC | EXTENT_DELALLOC_NEW |
index ccd3f979edda9995c08202cd88c0ce54cc2fa028..3be1db13ed5881a8c6586108f1fa9b180485151b 100644 (file)
@@ -32,5 +32,4 @@ alsa-info-drop-warn_on-from-buffer-null-sanity-check.patch
 asoc-rt5670-correct-rt5670_ldo_sel_mask.patch
 btrfs-fix-double-free-on-ulist-after-backref-resolution-failure.patch
 btrfs-fix-mount-failure-caused-by-race-with-umount.patch
-btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
 btrfs-fix-page-leaks-after-failure-to-lock-page-for-delalloc.patch
diff --git a/queue-5.7/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch b/queue-5.7/btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
deleted file mode 100644 (file)
index 3216690..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-From fa91e4aa1716004ea8096d5185ec0451e206aea0 Mon Sep 17 00:00:00 2001
-From: Qu Wenruo <wqu@suse.com>
-Date: Fri, 17 Jul 2020 15:12:05 +0800
-Subject: btrfs: qgroup: fix data leak caused by race between writeback and truncate
-
-From: Qu Wenruo <wqu@suse.com>
-
-commit fa91e4aa1716004ea8096d5185ec0451e206aea0 upstream.
-
-[BUG]
-When running tests like generic/013 on test device with btrfs quota
-enabled, it can normally lead to data leak, detected at unmount time:
-
-  BTRFS warning (device dm-3): qgroup 0/5 has unreleased space, type 0 rsv 4096
-  ------------[ cut here ]------------
-  WARNING: CPU: 11 PID: 16386 at fs/btrfs/disk-io.c:4142 close_ctree+0x1dc/0x323 [btrfs]
-  RIP: 0010:close_ctree+0x1dc/0x323 [btrfs]
-  Call Trace:
-   btrfs_put_super+0x15/0x17 [btrfs]
-   generic_shutdown_super+0x72/0x110
-   kill_anon_super+0x18/0x30
-   btrfs_kill_super+0x17/0x30 [btrfs]
-   deactivate_locked_super+0x3b/0xa0
-   deactivate_super+0x40/0x50
-   cleanup_mnt+0x135/0x190
-   __cleanup_mnt+0x12/0x20
-   task_work_run+0x64/0xb0
-   __prepare_exit_to_usermode+0x1bc/0x1c0
-   __syscall_return_slowpath+0x47/0x230
-   do_syscall_64+0x64/0xb0
-   entry_SYSCALL_64_after_hwframe+0x44/0xa9
-  ---[ end trace caf08beafeca2392 ]---
-  BTRFS error (device dm-3): qgroup reserved space leaked
-
-[CAUSE]
-In the offending case, the offending operations are:
-2/6: writev f2X[269 1 0 0 0 0] [1006997,67,288] 0
-2/7: truncate f2X[269 1 0 0 48 1026293] 18388 0
-
-The following sequence of events could happen after the writev():
-       CPU1 (writeback)                |               CPU2 (truncate)
------------------------------------------------------------------
-btrfs_writepages()                     |
-|- extent_write_cache_pages()          |
-   |- Got page for 1003520             |
-   |  1003520 is Dirty, no writeback   |
-   |  So (!clear_page_dirty_for_io())   |
-   |  gets called for it               |
-   |- Now page 1003520 is Clean.       |
-   |                                   | btrfs_setattr()
-   |                                   | |- btrfs_setsize()
-   |                                   |    |- truncate_setsize()
-   |                                   |       New i_size is 18388
-   |- __extent_writepage()             |
-   |  |- page_offset() > i_size                |
-      |- btrfs_invalidatepage()                |
-        |- Page is clean, so no qgroup |
-           callback executed
-
-This means, the qgroup reserved data space is not properly released in
-btrfs_invalidatepage() as the page is Clean.
-
-[FIX]
-Instead of checking the dirty bit of a page, call
-btrfs_qgroup_free_data() unconditionally in btrfs_invalidatepage().
-
-As qgroup rsv are completely bound to the QGROUP_RESERVED bit of
-io_tree, not bound to page status, thus we won't cause double freeing
-anyway.
-
-Fixes: 0b34c261e235 ("btrfs: qgroup: Prevent qgroup->reserved from going subzero")
-CC: stable@vger.kernel.org # 4.14+
-Reviewed-by: Josef Bacik <josef@toxicpanda.com>
-Signed-off-by: Qu Wenruo <wqu@suse.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- fs/btrfs/inode.c |   23 ++++++++++-------------
- 1 file changed, 10 insertions(+), 13 deletions(-)
-
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -8509,20 +8509,17 @@ again:
-       /*
-        * Qgroup reserved space handler
-        * Page here will be either
--       * 1) Already written to disk
--       *    In this case, its reserved space is released from data rsv map
--       *    and will be freed by delayed_ref handler finally.
--       *    So even we call qgroup_free_data(), it won't decrease reserved
--       *    space.
--       * 2) Not written to disk
--       *    This means the reserved space should be freed here. However,
--       *    if a truncate invalidates the page (by clearing PageDirty)
--       *    and the page is accounted for while allocating extent
--       *    in btrfs_check_data_free_space() we let delayed_ref to
--       *    free the entire extent.
-+       * 1) Already written to disk or ordered extent already submitted
-+       *    Then its QGROUP_RESERVED bit in io_tree is already cleaned.
-+       *    Qgroup will be handled by its qgroup_record then.
-+       *    btrfs_qgroup_free_data() call will do nothing here.
-+       *
-+       * 2) Not written to disk yet
-+       *    Then btrfs_qgroup_free_data() call will clear the QGROUP_RESERVED
-+       *    bit of its io_tree, and free the qgroup reserved data space.
-+       *    Since the IO will never happen for this page.
-        */
--      if (PageDirty(page))
--              btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-+      btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);
-       if (!inode_evicting) {
-               clear_extent_bit(tree, page_start, page_end, EXTENT_LOCKED |
-                                EXTENT_DELALLOC | EXTENT_DELALLOC_NEW |
index 4ca16e45e35ff21dd22e88a1271afeeeb58524de..5330d63bece34d39487a581780d3e8fe78e8e3d7 100644 (file)
@@ -37,5 +37,4 @@ asoc-intel-cht_bsw_rt5672-change-bus-format-to-i2s-2-channel.patch
 s390-cpum_cf-perf-change-dflt_ccerror-counter-name.patch
 btrfs-fix-double-free-on-ulist-after-backref-resolution-failure.patch
 btrfs-fix-mount-failure-caused-by-race-with-umount.patch
-btrfs-qgroup-fix-data-leak-caused-by-race-between-writeback-and-truncate.patch
 btrfs-fix-page-leaks-after-failure-to-lock-page-for-delalloc.patch