]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/configfs/dir.c
Merge branch 'x86/cpu' into x86/x2apic
[linux-2.6-omap-h63xx.git] / fs / configfs / dir.c
index 7a8db78a91d22949fbd1b0df6fb116a392033426..8e93341f3e82048b7f0f07d4edc6cf2e654c3f93 100644 (file)
@@ -1311,16 +1311,18 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
         * Ensure that no racing symlink() will make detach_prep() fail while
         * the new link is temporarily attached
         */
-       mutex_lock(&configfs_symlink_mutex);
-       spin_lock(&configfs_dirent_lock);
        do {
                struct mutex *wait_mutex;
 
+               mutex_lock(&configfs_symlink_mutex);
+               spin_lock(&configfs_dirent_lock);
                ret = configfs_detach_prep(dentry, &wait_mutex);
-               if (ret) {
+               if (ret)
                        configfs_detach_rollback(dentry);
-                       spin_unlock(&configfs_dirent_lock);
-                       mutex_unlock(&configfs_symlink_mutex);
+               spin_unlock(&configfs_dirent_lock);
+               mutex_unlock(&configfs_symlink_mutex);
+
+               if (ret) {
                        if (ret != -EAGAIN) {
                                config_item_put(parent_item);
                                return ret;
@@ -1329,13 +1331,8 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
                        /* Wait until the racing operation terminates */
                        mutex_lock(wait_mutex);
                        mutex_unlock(wait_mutex);
-
-                       mutex_lock(&configfs_symlink_mutex);
-                       spin_lock(&configfs_dirent_lock);
                }
        } while (ret == -EAGAIN);
-       spin_unlock(&configfs_dirent_lock);
-       mutex_unlock(&configfs_symlink_mutex);
 
        /* Get a working ref for the duration of this function */
        item = configfs_get_config_item(dentry);