diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index dd5938a7de21..6228a304b547 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4242,7 +4242,9 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4242 | filp->f_pos = 2; | 4242 | filp->f_pos = 2; |
4243 | } | 4243 | } |
4244 | path = btrfs_alloc_path(); | 4244 | path = btrfs_alloc_path(); |
4245 | path->reada = 2; | 4245 | if (!path) |
4246 | return -ENOMEM; | ||
4247 | path->reada = 1; | ||
4246 | 4248 | ||
4247 | btrfs_set_key_type(&key, key_type); | 4249 | btrfs_set_key_type(&key, key_type); |
4248 | key.offset = filp->f_pos; | 4250 | key.offset = filp->f_pos; |
@@ -5043,7 +5045,15 @@ again: | |||
5043 | 5045 | ||
5044 | if (!path) { | 5046 | if (!path) { |
5045 | path = btrfs_alloc_path(); | 5047 | path = btrfs_alloc_path(); |
5046 | BUG_ON(!path); | 5048 | if (!path) { |
5049 | err = -ENOMEM; | ||
5050 | goto out; | ||
5051 | } | ||
5052 | /* | ||
5053 | * Chances are we'll be called again, so go ahead and do | ||
5054 | * readahead | ||
5055 | */ | ||
5056 | path->reada = 1; | ||
5047 | } | 5057 | } |
5048 | 5058 | ||
5049 | ret = btrfs_lookup_file_extent(trans, root, path, | 5059 | ret = btrfs_lookup_file_extent(trans, root, path, |