Whamcloud - gitweb
LU-3706 scrub: fix mutex leak in osd_obj_map_recover()
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_compat.c
index f86da33..2dbd4e4 100644 (file)
@@ -1121,11 +1121,16 @@ int osd_obj_map_recover(struct osd_thread_info *info,
                 *      So keep it there before we have suitable solution. */
                brelse(bh);
 
+               mutex_unlock(&dir->i_mutex);
+               mutex_unlock(&src_parent->i_mutex);
+
+               rc = -EEXIST;
                /* If the src object has never been modified, then remove it. */
                if (inode->i_size == 0 && inode->i_mode & S_ISUID &&
                    inode->i_mode & S_ISGID)
-                       vfs_unlink(src_parent, src_child);
-               GOTO(unlock_src, rc = 0);
+                       rc = vfs_unlink(src_parent, src_child);
+               ldiskfs_journal_stop(jh);
+               RETURN(rc);
        }
 
        bh = osd_ldiskfs_find_entry(src_parent, src_child, &de, NULL);
@@ -1143,8 +1148,6 @@ int osd_obj_map_recover(struct osd_thread_info *info,
 
 unlock:
        mutex_unlock(&dir->i_mutex);
-
-unlock_src:
        mutex_unlock(&src_parent->i_mutex);
        ldiskfs_journal_stop(jh);
        return rc;