aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2015-11-10 18:54:03 +0100
committerDavid Sterba <dsterba@suse.com>2016-01-07 15:20:55 +0100
commit8546b570511f428838129c00e701eda481cd7c13 (patch)
treebf8087d889e778e484afb12af3ee82edd5220e28 /fs/btrfs/ioctl.c
parentb0c0ea6338d5018e02d27c5315084fb1a5d099f6 (diff)
btrfs: preallocate path for snapshot creation at ioctl time
We can also preallocate btrfs_path that's used during pending snapshot creation and avoid another late ENOMEM failure. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 27fc660b0ff3..3d9b27d2176e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -661,7 +661,8 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
pending_snapshot->root_item = kzalloc(sizeof(struct btrfs_root_item),
GFP_NOFS);
- if (!pending_snapshot->root_item) {
+ pending_snapshot->path = btrfs_alloc_path();
+ if (!pending_snapshot->root_item || !pending_snapshot->path) {
ret = -ENOMEM;
goto free_pending;
}
@@ -747,6 +748,7 @@ dec_and_free:
wake_up_atomic_t(&root->will_be_snapshoted);
free_pending:
kfree(pending_snapshot->root_item);
+ btrfs_free_path(pending_snapshot->path);
kfree(pending_snapshot);
return ret;