Whamcloud - gitweb
LU-3935 scrub: support dryrun mode OI scrub
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_compat.c
index 2dbd4e4..c6ac60c 100644 (file)
@@ -1120,15 +1120,28 @@ 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)
-                       rc = vfs_unlink(src_parent, src_child);
+                   inode->i_mode & S_ISGID) {
+                       bh = osd_ldiskfs_find_entry(src_parent, src_child, &de,
+                                                   NULL);
+                       if (unlikely(bh == NULL)) {
+                               mutex_unlock(&src_parent->i_mutex);
+                               ldiskfs_journal_stop(jh);
+                               RETURN(0);
+                       }
+
+                       rc = ldiskfs_delete_entry(jh, src_parent, de, bh);
+                       brelse(bh);
+                       if (rc == 0) {
+                               drop_nlink(inode);
+                               ll_dirty_inode(inode, I_DIRTY_DATASYNC);
+                       }
+               }
+               mutex_unlock(&src_parent->i_mutex);
                ldiskfs_journal_stop(jh);
                RETURN(rc);
        }