diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c
index 9e155c694a83011149ac034ad278baab1015ab1f..4070810ccfc9f019fd5dc9008a42610f0c5c6d97 100644
--- a/lustre/mds/mds_reint.c
+++ b/lustre/mds/mds_reint.c
@@ -2447,6 +2447,9 @@ cleanup:
                         ldlm_lock_decref(parent_lockh, LCK_PW);
                 else
                         ptlrpc_save_lock(req, parent_lockh, LCK_PW);
+                if (dchild->d_inode && rc && (dchild->d_inode->i_nlink == 0 ||
+                                mds_inode_is_orphan(dchild->d_inode)))
+                        CDEBUG(D_ERROR, "unlink, but return %d\n", rc);
                 l_dput(dchild);
                 l_dput(dchild);
                 l_dput(dparent);