aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/configfs/dir.c')
-rw-r--r--fs/configfs/dir.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 9c2358391147..8e93341f3e82 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -553,24 +553,12 @@ static void detach_groups(struct config_group *group)
553 553
554 child = sd->s_dentry; 554 child = sd->s_dentry;
555 555
556 /*
557 * Note: we hide this from lockdep since we have no way
558 * to teach lockdep about recursive
559 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
560 * in an inode tree, which are valid as soon as
561 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
562 * parent inode to one of its children.
563 */
564 lockdep_off();
565 mutex_lock(&child->d_inode->i_mutex); 556 mutex_lock(&child->d_inode->i_mutex);
566 lockdep_on();
567 557
568 configfs_detach_group(sd->s_element); 558 configfs_detach_group(sd->s_element);
569 child->d_inode->i_flags |= S_DEAD; 559 child->d_inode->i_flags |= S_DEAD;
570 560
571 lockdep_off();
572 mutex_unlock(&child->d_inode->i_mutex); 561 mutex_unlock(&child->d_inode->i_mutex);
573 lockdep_on();
574 562
575 d_delete(child); 563 d_delete(child);
576 dput(child); 564 dput(child);
@@ -760,22 +748,11 @@ static int configfs_attach_item(struct config_item *parent_item,
760 * We are going to remove an inode and its dentry but 748 * We are going to remove an inode and its dentry but
761 * the VFS may already have hit and used them. Thus, 749 * the VFS may already have hit and used them. Thus,
762 * we must lock them as rmdir() would. 750 * we must lock them as rmdir() would.
763 *
764 * Note: we hide this from lockdep since we have no way
765 * to teach lockdep about recursive
766 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
767 * in an inode tree, which are valid as soon as
768 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
769 * parent inode to one of its children.
770 */ 751 */
771 lockdep_off();
772 mutex_lock(&dentry->d_inode->i_mutex); 752 mutex_lock(&dentry->d_inode->i_mutex);
773 lockdep_on();
774 configfs_remove_dir(item); 753 configfs_remove_dir(item);
775 dentry->d_inode->i_flags |= S_DEAD; 754 dentry->d_inode->i_flags |= S_DEAD;
776 lockdep_off();
777 mutex_unlock(&dentry->d_inode->i_mutex); 755 mutex_unlock(&dentry->d_inode->i_mutex);
778 lockdep_on();
779 d_delete(dentry); 756 d_delete(dentry);
780 } 757 }
781 } 758 }
@@ -810,25 +787,14 @@ static int configfs_attach_group(struct config_item *parent_item,
810 * 787 *
811 * We must also lock the inode to remove it safely in case of 788 * We must also lock the inode to remove it safely in case of
812 * error, as rmdir() would. 789 * error, as rmdir() would.
813 *
814 * Note: we hide this from lockdep since we have no way
815 * to teach lockdep about recursive
816 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
817 * in an inode tree, which are valid as soon as
818 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
819 * parent inode to one of its children.
820 */ 790 */
821 lockdep_off();
822 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 791 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
823 lockdep_on();
824 ret = populate_groups(to_config_group(item)); 792 ret = populate_groups(to_config_group(item));
825 if (ret) { 793 if (ret) {
826 configfs_detach_item(item); 794 configfs_detach_item(item);
827 dentry->d_inode->i_flags |= S_DEAD; 795 dentry->d_inode->i_flags |= S_DEAD;
828 } 796 }
829 lockdep_off();
830 mutex_unlock(&dentry->d_inode->i_mutex); 797 mutex_unlock(&dentry->d_inode->i_mutex);
831 lockdep_on();
832 if (ret) 798 if (ret)
833 d_delete(dentry); 799 d_delete(dentry);
834 } 800 }
@@ -990,17 +956,7 @@ static int configfs_depend_prep(struct dentry *origin,
990 BUG_ON(!origin || !sd); 956 BUG_ON(!origin || !sd);
991 957
992 /* Lock this guy on the way down */ 958 /* Lock this guy on the way down */
993 /*
994 * Note: we hide this from lockdep since we have no way
995 * to teach lockdep about recursive
996 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
997 * in an inode tree, which are valid as soon as
998 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
999 * parent inode to one of its children.
1000 */
1001 lockdep_off();
1002 mutex_lock(&sd->s_dentry->d_inode->i_mutex); 959 mutex_lock(&sd->s_dentry->d_inode->i_mutex);
1003 lockdep_on();
1004 if (sd->s_element == target) /* Boo-yah */ 960 if (sd->s_element == target) /* Boo-yah */
1005 goto out; 961 goto out;
1006 962
@@ -1014,9 +970,7 @@ static int configfs_depend_prep(struct dentry *origin,
1014 } 970 }
1015 971
1016 /* We looped all our children and didn't find target */ 972 /* We looped all our children and didn't find target */
1017 lockdep_off();
1018 mutex_unlock(&sd->s_dentry->d_inode->i_mutex); 973 mutex_unlock(&sd->s_dentry->d_inode->i_mutex);
1019 lockdep_on();
1020 ret = -ENOENT; 974 ret = -ENOENT;
1021 975
1022out: 976out:
@@ -1036,16 +990,11 @@ static void configfs_depend_rollback(struct dentry *origin,
1036 struct dentry *dentry = item->ci_dentry; 990 struct dentry *dentry = item->ci_dentry;
1037 991
1038 while (dentry != origin) { 992 while (dentry != origin) {
1039 /* See comments in configfs_depend_prep() */
1040 lockdep_off();
1041 mutex_unlock(&dentry->d_inode->i_mutex); 993 mutex_unlock(&dentry->d_inode->i_mutex);
1042 lockdep_on();
1043 dentry = dentry->d_parent; 994 dentry = dentry->d_parent;
1044 } 995 }
1045 996
1046 lockdep_off();
1047 mutex_unlock(&origin->d_inode->i_mutex); 997 mutex_unlock(&origin->d_inode->i_mutex);
1048 lockdep_on();
1049} 998}
1050 999
1051int configfs_depend_item(struct configfs_subsystem *subsys, 1000int configfs_depend_item(struct configfs_subsystem *subsys,
@@ -1380,16 +1329,8 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
1380 } 1329 }
1381 1330
1382 /* Wait until the racing operation terminates */ 1331 /* Wait until the racing operation terminates */
1383 /*
1384 * Note: we hide this from lockdep since we are locked
1385 * with subclass I_MUTEX_NORMAL from vfs_rmdir() (why
1386 * not I_MUTEX_CHILD?), and I_MUTEX_XATTR or
1387 * I_MUTEX_QUOTA are not relevant for the locked inode.
1388 */
1389 lockdep_off();
1390 mutex_lock(wait_mutex); 1332 mutex_lock(wait_mutex);
1391 mutex_unlock(wait_mutex); 1333 mutex_unlock(wait_mutex);
1392 lockdep_on();
1393 } 1334 }
1394 } while (ret == -EAGAIN); 1335 } while (ret == -EAGAIN);
1395 1336