#include <linux/rhashtable.h>
#include <linux/workqueue.h>
-#include <lprocfs_status.h>
#include <uapi/linux/lustre/lustre_idl.h>
+#include <uapi/linux/lustre/lustre_ver.h>
+#include <lprocfs_status.h>
#include <lustre_dlm.h>
struct mds_client_data;
return !!(exp_connect_flags2(exp) & OBD_CONNECT2_DOM_LVB);
}
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 20, 53, 0)
+/* Only needed for interop with older MDS and 2.16+ OSS for rolling upgrade.
+ * This is typically unsupported for long periods, especially between large
+ * large version differences, so assume this is always true in the future
+ * and the OBD_CONNECT2_REPLAY_CREATE flag can be removed/reused in 2.21+.
+ */
+static inline bool exp_connect_replay_create(struct obd_export *exp)
+{
+ return exp_connect_flags2(exp) & OBD_CONNECT2_REPLAY_CREATE;
+}
+
+static inline bool imp_connect_replay_create(struct obd_import *imp)
+{
+ struct obd_connect_data *ocd = &imp->imp_connect_data;
+
+ return (ocd->ocd_connect_flags & OBD_CONNECT_FLAGS2) &&
+ (ocd->ocd_connect_flags2 & OBD_CONNECT2_REPLAY_CREATE);
+}
+#else
+#define exp_connect_replay_create(exp) true
+#define imp_connect_replay_create(exp) true
+#endif
+
enum {
/* archive_ids in array format */
KKUC_CT_DATA_ARRAY_MAGIC = 0x092013cea,
#define OBD_CONNECT2_ENCRYPT_NAME 0x8000000ULL /* name encrypt */
#define OBD_CONNECT2_DMV_IMP_INHERIT 0x20000000ULL /* client handle DMV inheritance */
#define OBD_CONNECT2_ENCRYPT_FID2PATH 0x40000000ULL /* fid2path enc file */
+/* For MDS+OSS rolling upgrade interop with 2.16+older, ignored after 2.20.53 */
+#define OBD_CONNECT2_REPLAY_CREATE 0x80000000ULL /* replay OST_CREATE */
/* XXX README XXX README XXX README XXX README XXX README XXX README XXX
* Please DO NOT add OBD_CONNECT flags before first ensuring that this value
* is not in use by some other branch/patch. Email adilger@whamcloud.com
#define OST_CONNECT_SUPPORTED2 (OBD_CONNECT2_LOCKAHEAD | OBD_CONNECT2_INC_XID |\
OBD_CONNECT2_ENCRYPT | OBD_CONNECT2_LSEEK |\
- OBD_CONNECT2_REP_MBITS)
+ OBD_CONNECT2_REP_MBITS |\
+ OBD_CONNECT2_REPLAY_CREATE)
#define ECHO_CONNECT_SUPPORTED (OBD_CONNECT_FID | OBD_CONNECT_FLAGS2)
#define ECHO_CONNECT_SUPPORTED2 OBD_CONNECT2_REP_MBITS
if (data == NULL)
GOTO(out_cleanup, rc = -ENOMEM);
- data->ocd_connect_flags = OBD_CONNECT_INDEX | OBD_CONNECT_VERSION;
+ data->ocd_connect_flags = OBD_CONNECT_INDEX | OBD_CONNECT_VERSION |
+ OBD_CONNECT_FLAGS2;
data->ocd_version = LUSTRE_VERSION_CODE;
data->ocd_index = index;
OBD_CONNECT_PINGLESS |
OBD_CONNECT_LFSCK |
OBD_CONNECT_BULK_MBITS;
+ data->ocd_connect_flags2 = OBD_CONNECT2_REPLAY_CREATE;
data->ocd_group = tgt_index;
ltd = &lod->lod_ost_descs;
"mkdir_replay", /* 0x10000000 */
"dmv_imp_inherit", /* 0x20000000 */
"encryption_fid2path", /* 0x40000000 */
+ "replay_create", /* 0x80000000 */
NULL
};
}
if (diff > 0) {
time64_t enough_time = ktime_get_seconds() + DISK_TIMEOUT;
+ bool trans_local;
u64 next_id;
int created = 0;
int count;
}
}
-
+ trans_local = !exp_connect_replay_create(req->rq_export);
while (diff > 0) {
next_id = ofd_seq_last_oid(oseq) + 1;
count = ofd_precreate_batch(ofd, (int)diff);
}
rc = ofd_precreate_objects(tsi->tsi_env, ofd, next_id,
- oseq, count, sync_trans);
+ oseq, count, sync_trans,
+ trans_local);
if (rc > 0) {
created += rc;
diff -= rc;
int ofd_object_ff_update(const struct lu_env *env, struct ofd_object *fo,
const struct obdo *oa, struct filter_fid *ff);
int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
- u64 id, struct ofd_seq *oseq, int nr, int sync);
+ u64 id, struct ofd_seq *oseq, int nr, int sync,
+ bool trans_local);
static inline void ofd_object_put(const struct lu_env *env,
struct ofd_object *fo)
int count = ofd_precreate_batch(ofd, diff);
rc = ofd_precreate_objects(env, ofd, next_id,
- oseq, count, sync);
+ oseq, count, sync,
+ false);
if (rc < 0) {
mutex_unlock(&oseq->os_create_lock);
ofd_seq_put(env, oseq);
next_id = ofd_seq_last_oid(oseq) + 1;
count = ofd_precreate_batch(ofd, (int)diff);
- rc = ofd_precreate_objects(env, ofd, next_id, oseq, count, 0);
+ rc = ofd_precreate_objects(env, ofd, next_id, oseq, count, 0, false);
if (rc < 0) {
CERROR("%s: unable to precreate: rc = %d\n",
ofd_name(ofd), rc);
#include <dt_object.h>
#include <lustre_lfsck.h>
+#include <lustre_export.h>
#include "ofd_internal.h"
* update the inode. The ctime = 0 case is also handled specially in
* osd_inode_setattr(). See LU-221, LU-1042 for details.
*
- * \param[in] env execution environment
- * \param[in] ofd OFD device
- * \param[in] id object ID to start precreation from
- * \param[in] oseq object sequence
- * \param[in] nr number of objects to precreate
- * \param[in] sync synchronous precreation flag
+ * \param[in] env execution environment
+ * \param[in] ofd OFD device
+ * \param[in] id object ID to start precreation from
+ * \param[in] oseq object sequence
+ * \param[in] nr number of objects to precreate
+ * \param[in] sync synchronous precreation flag
+ * \param[in] trans_local start local transaction
*
* \retval 0 if successful
* \retval negative value on error
*/
int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
- u64 id, struct ofd_seq *oseq, int nr, int sync)
+ u64 id, struct ofd_seq *oseq, int nr, int sync,
+ bool trans_local)
{
struct ofd_thread_info *info = ofd_info(env);
struct ofd_object *fo = NULL;
}
}
- rc = dt_trans_start(env, ofd->ofd_osd, th);
+ /* Only needed for MDS+OSS rolling upgrade interop with 2.16+older. */
+ if (unlikely(trans_local))
+ rc = dt_trans_start_local(env, ofd->ofd_osd, th);
+ else
+ rc = dt_trans_start(env, ofd->ofd_osd, th);
if (rc)
GOTO(trans_stop, rc);
RETURN(-ENOMEM);
req->rq_request_portal = OST_CREATE_PORTAL;
+ /* We should not resend create request - anyway we will have delorphan
+ * and kill these objects.
+ * Only needed for MDS+OSS rolling upgrade interop with 2.16+older.
+ */
+ if (unlikely(!imp_connect_replay_create(imp)))
+ req->rq_no_delay = req->rq_no_resend = 1;
+
/* Delorphan happens only with a first MDT-OST connect. resend/replay
* handles objects creation on reconnects, no need to do delorhpan
* in this case.
struct osp_thread_info *osi = osp_env_info(env);
struct lu_fid *last_fid = &osi->osi_fid;
struct ptlrpc_request *req = NULL;
- struct obd_import *imp;
+ struct obd_import *imp = d->opd_obd->u.cli.cl_import;
struct ost_body *body;
int update_status = 0;
int rc;
* all precreate requests uses resend/replay flags to support OST
* failover/reconnect.
*/
- if (d->opd_cleanup_orphans_done) {
+ if (d->opd_cleanup_orphans_done && imp_connect_replay_create(imp)) {
rc = osp_get_lastfid_from_ost(env, d, false);
RETURN(0);
}
(long long)(int)offsetof(struct obd_connect_data, paddingF));
LASSERTF((int)sizeof(((struct obd_connect_data *)0)->paddingF) == 8, "found %lld\n",
(long long)(int)sizeof(((struct obd_connect_data *)0)->paddingF));
+
LASSERTF(OBD_CONNECT_RDONLY == 0x1ULL, "found 0x%.16llxULL\n",
OBD_CONNECT_RDONLY);
LASSERTF(OBD_CONNECT_INDEX == 0x2ULL, "found 0x%.16llxULL\n",
OBD_CONNECT_OBDOPACK);
LASSERTF(OBD_CONNECT_FLAGS2 == 0x8000000000000000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT_FLAGS2);
+
LASSERTF(OBD_CONNECT2_FILE_SECCTX == 0x1ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_FILE_SECCTX);
LASSERTF(OBD_CONNECT2_LOCKAHEAD == 0x2ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_DMV_IMP_INHERIT);
LASSERTF(OBD_CONNECT2_ENCRYPT_FID2PATH == 0x40000000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_ENCRYPT_FID2PATH);
+ LASSERTF(OBD_CONNECT2_REPLAY_CREATE == 0x80000000ULL, "found 0x%.16llxULL\n",
+ OBD_CONNECT2_REPLAY_CREATE);
+
LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)OBD_CKSUM_CRC32);
LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
CHECK_MEMBER(obd_connect_data, paddingE);
CHECK_MEMBER(obd_connect_data, paddingF);
+ BLANK_LINE();
CHECK_DEFINE_64X(OBD_CONNECT_RDONLY);
CHECK_DEFINE_64X(OBD_CONNECT_INDEX);
CHECK_DEFINE_64X(OBD_CONNECT_MDS);
CHECK_DEFINE_64X(OBD_CONNECT_BULK_MBITS);
CHECK_DEFINE_64X(OBD_CONNECT_OBDOPACK);
CHECK_DEFINE_64X(OBD_CONNECT_FLAGS2);
+ BLANK_LINE();
CHECK_DEFINE_64X(OBD_CONNECT2_FILE_SECCTX);
CHECK_DEFINE_64X(OBD_CONNECT2_LOCKAHEAD);
CHECK_DEFINE_64X(OBD_CONNECT2_DIR_MIGRATE);
CHECK_DEFINE_64X(OBD_CONNECT2_ENCRYPT_NAME);
CHECK_DEFINE_64X(OBD_CONNECT2_DMV_IMP_INHERIT);
CHECK_DEFINE_64X(OBD_CONNECT2_ENCRYPT_FID2PATH);
+ CHECK_DEFINE_64X(OBD_CONNECT2_REPLAY_CREATE);
+ BLANK_LINE();
CHECK_VALUE_X(OBD_CKSUM_CRC32);
CHECK_VALUE_X(OBD_CKSUM_ADLER);
CHECK_VALUE_X(OBD_CKSUM_CRC32C);
OBD_CONNECT_OBDOPACK);
LASSERTF(OBD_CONNECT_FLAGS2 == 0x8000000000000000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT_FLAGS2);
+
LASSERTF(OBD_CONNECT2_FILE_SECCTX == 0x1ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_FILE_SECCTX);
LASSERTF(OBD_CONNECT2_LOCKAHEAD == 0x2ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_DMV_IMP_INHERIT);
LASSERTF(OBD_CONNECT2_ENCRYPT_FID2PATH == 0x40000000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_ENCRYPT_FID2PATH);
+ LASSERTF(OBD_CONNECT2_REPLAY_CREATE == 0x80000000ULL, "found 0x%.16llxULL\n",
+ OBD_CONNECT2_REPLAY_CREATE);
+
LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)OBD_CKSUM_CRC32);
LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",