summaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/attributes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus/attributes.c')
-rw-r--r--fs/hfsplus/attributes.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c
index 2bab6b3cdba4..e6d554476db4 100644
--- a/fs/hfsplus/attributes.c
+++ b/fs/hfsplus/attributes.c
@@ -217,6 +217,11 @@ int hfsplus_create_attr(struct inode *inode,
217 if (err) 217 if (err)
218 goto failed_init_create_attr; 218 goto failed_init_create_attr;
219 219
220 /* Fail early and avoid ENOSPC during the btree operation */
221 err = hfs_bmap_reserve(fd.tree, fd.tree->depth + 1);
222 if (err)
223 goto failed_create_attr;
224
220 if (name) { 225 if (name) {
221 err = hfsplus_attr_build_key(sb, fd.search_key, 226 err = hfsplus_attr_build_key(sb, fd.search_key,
222 inode->i_ino, name); 227 inode->i_ino, name);
@@ -313,6 +318,11 @@ int hfsplus_delete_attr(struct inode *inode, const char *name)
313 if (err) 318 if (err)
314 return err; 319 return err;
315 320
321 /* Fail early and avoid ENOSPC during the btree operation */
322 err = hfs_bmap_reserve(fd.tree, fd.tree->depth);
323 if (err)
324 goto out;
325
316 if (name) { 326 if (name) {
317 err = hfsplus_attr_build_key(sb, fd.search_key, 327 err = hfsplus_attr_build_key(sb, fd.search_key,
318 inode->i_ino, name); 328 inode->i_ino, name);