aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/dir.c14
-rw-r--r--fs/configfs/symlink.c6
2 files changed, 13 insertions, 7 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 2495f23e33f4..cb5ea44846af 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -370,6 +370,9 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex
370 struct configfs_dirent *sd; 370 struct configfs_dirent *sd;
371 int ret; 371 int ret;
372 372
373 /* Mark that we're trying to drop the group */
374 parent_sd->s_type |= CONFIGFS_USET_DROPPING;
375
373 ret = -EBUSY; 376 ret = -EBUSY;
374 if (!list_empty(&parent_sd->s_links)) 377 if (!list_empty(&parent_sd->s_links))
375 goto out; 378 goto out;
@@ -385,8 +388,6 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex
385 *wait_mutex = &sd->s_dentry->d_inode->i_mutex; 388 *wait_mutex = &sd->s_dentry->d_inode->i_mutex;
386 return -EAGAIN; 389 return -EAGAIN;
387 } 390 }
388 /* Mark that we're trying to drop the group */
389 sd->s_type |= CONFIGFS_USET_DROPPING;
390 391
391 /* 392 /*
392 * Yup, recursive. If there's a problem, blame 393 * Yup, recursive. If there's a problem, blame
@@ -414,12 +415,11 @@ static void configfs_detach_rollback(struct dentry *dentry)
414 struct configfs_dirent *parent_sd = dentry->d_fsdata; 415 struct configfs_dirent *parent_sd = dentry->d_fsdata;
415 struct configfs_dirent *sd; 416 struct configfs_dirent *sd;
416 417
417 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { 418 parent_sd->s_type &= ~CONFIGFS_USET_DROPPING;
418 if (sd->s_type & CONFIGFS_USET_DEFAULT) { 419
420 list_for_each_entry(sd, &parent_sd->s_children, s_sibling)
421 if (sd->s_type & CONFIGFS_USET_DEFAULT)
419 configfs_detach_rollback(sd->s_dentry); 422 configfs_detach_rollback(sd->s_dentry);
420 sd->s_type &= ~CONFIGFS_USET_DROPPING;
421 }
422 }
423} 423}
424 424
425static void detach_attrs(struct config_item * item) 425static void detach_attrs(struct config_item * item)
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index 0004d18c40ac..c12801a12c34 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -78,6 +78,12 @@ static int create_link(struct config_item *parent_item,
78 if (sl) { 78 if (sl) {
79 sl->sl_target = config_item_get(item); 79 sl->sl_target = config_item_get(item);
80 spin_lock(&configfs_dirent_lock); 80 spin_lock(&configfs_dirent_lock);
81 if (target_sd->s_type & CONFIGFS_USET_DROPPING) {
82 spin_unlock(&configfs_dirent_lock);
83 config_item_put(item);
84 kfree(sl);
85 return -ENOENT;
86 }
81 list_add(&sl->sl_list, &target_sd->s_links); 87 list_add(&sl->sl_list, &target_sd->s_links);
82 spin_unlock(&configfs_dirent_lock); 88 spin_unlock(&configfs_dirent_lock);
83 ret = configfs_create_link(sl, parent_item->ci_dentry, 89 ret = configfs_create_link(sl, parent_item->ci_dentry,