diff options
author | Qu Wenruo <wqu@suse.com> | 2021-08-06 16:12:33 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-10-26 19:05:18 +0200 |
commit | cae796868042e73fbda5056d2528cd0b815f9c08 (patch) | |
tree | 364efa31f165ebf1de0326dcb3099d7895846be9 /fs/btrfs/ioctl.c | |
parent | 1ccc2e8a8648b10b4f198793f78f2521e96f6d36 (diff) | |
download | lwn-cae796868042e73fbda5056d2528cd0b815f9c08.tar.gz lwn-cae796868042e73fbda5056d2528cd0b815f9c08.zip |
btrfs: defrag: also check PagePrivate for subpage cases in cluster_pages_for_defrag()
In function cluster_pages_for_defrag() we have a window where we unlock
page, either start the ordered range or read the content from disk.
When we re-lock the page, we need to make sure it still has the correct
page->private for subpage.
Thus add the extra PagePrivate check here to handle subpage cases
properly.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 033726aed96e..b8b30e11a226 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1278,7 +1278,8 @@ again: * we unlocked the page above, so we need check if * it was released or not. */ - if (page->mapping != inode->i_mapping) { + if (page->mapping != inode->i_mapping || + !PagePrivate(page)) { unlock_page(page); put_page(page); goto again; @@ -1296,7 +1297,7 @@ again: } } - if (page->mapping != inode->i_mapping) { + if (page->mapping != inode->i_mapping || !PagePrivate(page)) { unlock_page(page); put_page(page); goto again; |