]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
btrfs: Handle btrfs_set_extent_delalloc failure in relocate_file_extent_cluster
authorNikolay Borisov <nborisov@suse.com>
Wed, 31 Jan 2018 15:14:02 +0000 (17:14 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 1 Mar 2018 15:16:12 +0000 (16:16 +0100)
Essentially duplicate the error handling from the above block which
handles the !PageUptodate(page) case and additionally clear
EXTENT_BOUNDARY.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c

index f0c3f00e97cbe76e1fa8484efc8933842856c8d5..cd2298d185dd121bd1412e571a07952c343b0ab5 100644 (file)
@@ -3268,8 +3268,22 @@ static int relocate_file_extent_cluster(struct inode *inode,
                        nr++;
                }
 
-               btrfs_set_extent_delalloc(inode, page_start, page_end, 0, NULL,
-                                         0);
+               ret = btrfs_set_extent_delalloc(inode, page_start, page_end, 0,
+                                               NULL, 0);
+               if (ret) {
+                       unlock_page(page);
+                       put_page(page);
+                       btrfs_delalloc_release_metadata(BTRFS_I(inode),
+                                                        PAGE_SIZE);
+                       btrfs_delalloc_release_extents(BTRFS_I(inode),
+                                                      PAGE_SIZE);
+
+                       clear_extent_bits(&BTRFS_I(inode)->io_tree,
+                                         page_start, page_end,
+                                         EXTENT_LOCKED | EXTENT_BOUNDARY);
+                       goto out;
+
+               }
                set_page_dirty(page);
 
                unlock_extent(&BTRFS_I(inode)->io_tree,