Whamcloud - gitweb
LU-5147 doc: design docs in documentation dir
[fs/lustre-release.git] / lustre / ofd / ofd_dev.c
index e4ddf91..d5a880c 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014 Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -42,7 +42,7 @@
  * The OBD Filter Device (OFD) module belongs to the Object Storage
  * Server stack and connects the RPC oriented Unified Target (TGT)
  * layer (see lustre/include/lu_target.h) to the storage oriented OSD
- * layer (see lustre/doc/osd-api.txt).
+ * layer (see Documentation/osd-api.txt).
  *
  *     TGT
  *      |      DT and OBD APIs
@@ -167,6 +167,7 @@ static int ofd_stack_init(const struct lu_env *env,
        struct lu_device        *d;
        struct ofd_thread_info  *info = ofd_info(env);
        struct lustre_mount_info *lmi;
+       struct lustre_mount_data *lmd;
        int                      rc;
        char                    *osdname;
 
@@ -178,6 +179,10 @@ static int ofd_stack_init(const struct lu_env *env,
                RETURN(-ENODEV);
        }
 
+       lmd = s2lsi(lmi->lmi_sb)->lsi_lmd;
+       if (lmd != NULL && lmd->lmd_flags & LMD_FLG_SKIP_LFSCK)
+               m->ofd_skip_lfsck = 1;
+
        /* find bottom osd */
        OBD_ALLOC(osdname, MTI_NAME_MAXLEN);
        if (osdname == NULL)
@@ -1561,6 +1566,7 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
        struct ofd_seq          *oseq;
        int                      rc = 0, diff;
        int                      sync_trans = 0;
+       long                     granted = 0;
 
        ENTRY;
 
@@ -1698,10 +1704,12 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
                if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
                    !(oa->o_flags & OBD_FL_DELORPHAN)) {
                        /* don't enforce grant during orphan recovery */
-                       rc = ofd_grant_create(tsi->tsi_env,
-                                             ofd_obd(ofd)->obd_self_export,
-                                             &diff);
-                       if (rc) {
+                       granted = ofd_grant_create(tsi->tsi_env,
+                                                 ofd_obd(ofd)->obd_self_export,
+                                                  &diff);
+                       if (granted < 0) {
+                               rc = granted;
+                               granted = 0;
                                CDEBUG(D_HA, "%s: failed to acquire grant "
                                       "space for precreate (%d): rc = %d\n",
                                       ofd_name(ofd), diff, rc);
@@ -1716,12 +1724,17 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
                 * LFSCK will eventually clean up any orphans. LU-14 */
                if (diff > 5 * OST_MAX_PRECREATE) {
                        diff = OST_MAX_PRECREATE / 2;
-                       LCONSOLE_WARN("%s: precreate FID "DOSTID" is over %u "
-                                     "larger than the LAST_ID "DOSTID", only "
-                                     "precreating the last %u objects.\n",
-                                     ofd_name(ofd), POSTID(&oa->o_oi),
-                                     5 * OST_MAX_PRECREATE,
-                                     POSTID(&oseq->os_oi), diff);
+                       LCONSOLE_WARN("%s: Too many FIDs to precreate "
+                                     "OST replaced or reformatted: "
+                                     "LFSCK will clean up",
+                                     ofd_name(ofd));
+
+                       CDEBUG(D_HA, "%s: precreate FID "DOSTID" is over "
+                              "%u larger than the LAST_ID "DOSTID", only "
+                              "precreating the last %u objects.\n",
+                              ofd_name(ofd), POSTID(&oa->o_oi),
+                              5 * OST_MAX_PRECREATE,
+                              POSTID(&oseq->os_oi), diff);
                        ofd_seq_last_oid_set(oseq, ostid_id(&oa->o_oi) - diff);
                }
 
@@ -1768,9 +1781,11 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
                               ofd_name(ofd), rc);
 
                if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
-                   !(oa->o_flags & OBD_FL_DELORPHAN))
-                       ofd_grant_commit(tsi->tsi_env,
-                                        ofd_obd(ofd)->obd_self_export, rc);
+                   !(oa->o_flags & OBD_FL_DELORPHAN)) {
+                       ofd_grant_commit(ofd_obd(ofd)->obd_self_export, granted,
+                                        rc);
+                       granted = 0;
+               }
 
                ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq));
        }
@@ -2646,6 +2661,11 @@ static struct tgt_opc_slice ofd_common_slice[] = {
                .tos_hs         = tgt_lfsck_handlers
        },
        {
+               .tos_opc_start  = SEC_FIRST_OPC,
+               .tos_opc_end    = SEC_LAST_OPC,
+               .tos_hs         = tgt_sec_ctx_handlers
+       },
+       {
                .tos_hs         = NULL
        }
 };
@@ -2782,7 +2802,7 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
 
        info = ofd_info_init(env, NULL);
        if (info == NULL)
-               RETURN(-EFAULT);
+               GOTO(err_fini_proc, rc = -EFAULT);
 
        rc = ofd_stack_init(env, m, cfg);
        if (rc) {
@@ -3050,8 +3070,9 @@ static void __exit ofd_exit(void)
        class_unregister_type(LUSTRE_OST_NAME);
 }
 
-MODULE_AUTHOR("Intel Corporation. <https://www.hpdd.intel.com/>");
+MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
 MODULE_DESCRIPTION("Lustre Object Filtering Device");
+MODULE_VERSION(LUSTRE_VERSION_STRING);
 MODULE_LICENSE("GPL");
 
 module_init(ofd_init);