Whamcloud - gitweb
Changed quotes for newer bash
[fs/lustre-release.git] / lustre / mds / mds_unlink_open.c
index 127adc8..c480885 100644 (file)
 
 #include "mds_internal.h"
 
-static int mds_osc_destroy_orphan(struct mds_obd *mds,
-                                  struct inode *inode,
-                                  struct lov_mds_md *lmm,
-                                  int lmm_size,
-                                  struct llog_cookie *logcookies,
-                                  int log_unlink)
+/*
+ * used when destroying orphanes and from mds_reint_unlink() when MDS wants to
+ * destroy objects on OSS.
+ */
+int
+mds_unlink_object(struct mds_obd *mds, struct inode *inode,
+                  struct lov_mds_md *lmm, int lmm_size,
+                  struct llog_cookie *logcookies,
+                  int log_unlink, int async)
 {
         struct lov_stripe_md *lsm = NULL;
         struct obd_trans_info oti = { 0 };
@@ -78,11 +81,14 @@ static int mds_osc_destroy_orphan(struct mds_obd *mds,
                 oti.oti_logcookies = logcookies;
         }
 
+        CDEBUG(D_INODE, "destroy OSS object %d/%d\n",
+               (int)oa->o_id, (int)oa->o_gr);
+
+        if (async)
+                oti.oti_flags |= OBD_MODE_ASYNC;
+        
         rc = obd_destroy(mds->mds_dt_exp, oa, lsm, &oti);
         obdo_free(oa);
-        if (rc)
-                CDEBUG(D_INODE, "destroy orphan objid 0x"LPX64" on ost error "
-                       "%d\n", lsm->lsm_object_id, rc);
 out_free_memmd:
         obd_free_memmd(mds->mds_dt_exp, &lsm);
         RETURN(rc);
@@ -100,6 +106,7 @@ static int mds_unlink_orphan(struct obd_device *obd, struct dentry *dchild,
         ENTRY;
 
         LASSERT(mds->mds_dt_obd != NULL);
+        LASSERT(obd->obd_recovering == 0);
 
         /* We don't need to do any of these other things for orhpan dirs,
          * especially not mds_get_md (may get a default LOV EA, bug 4554) */
@@ -147,8 +154,8 @@ static int mds_unlink_orphan(struct obd_device *obd, struct dentry *dchild,
                 if (!rc)
                         rc = err;
         } else if (!rc) {
-                rc = mds_osc_destroy_orphan(mds, inode, lmm, lmm_size,
-                                            logcookies, log_unlink);
+                rc = mds_unlink_object(mds, inode, lmm, lmm_size,
+                                       logcookies, log_unlink, 0);
         }
 
         if (logcookies != NULL)
@@ -174,6 +181,7 @@ int mds_cleanup_orphans(struct obd_device *obd)
         int rc = 0, item = 0, namlen;
         ENTRY;
 
+        LASSERT(obd->obd_recovering == 0);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         dentry = dget(mds->mds_pending_dir);
         if (IS_ERR(dentry))
@@ -230,8 +238,7 @@ int mds_cleanup_orphans(struct obd_device *obd)
 
                 child_inode = dchild->d_inode;
                 DOWN_READ_I_ALLOC_SEM(child_inode);
-                if (mds_inode_is_orphan(child_inode) &&
-                    mds_orphan_open_count(child_inode)) {
+                if (mds_orphan_open_count(child_inode)) {
                         UP_READ_I_ALLOC_SEM(child_inode);
                         CWARN("orphan %s re-opened during recovery\n", d_name);
                         GOTO(next, rc = 0);