X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Fofd%2Fofd_fs.c;h=f20617be45483eb5310e27775fb4aece7355b04d;hb=e9472c54ac820c3a0db2318a6ef894c3971e6e0b;hp=0686a6b1210b264a59492a690121cd9da592301e;hpb=ae052f9f2e2699389617cbd12cc815f77f7e499b;p=fs%2Flustre-release.git diff --git a/lustre/ofd/ofd_fs.c b/lustre/ofd/ofd_fs.c index 0686a6b..f20617b 100644 --- a/lustre/ofd/ofd_fs.c +++ b/lustre/ofd/ofd_fs.c @@ -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, 2017, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -111,7 +111,7 @@ void ofd_seq_put(const struct lu_env *env, struct ofd_seq *oseq) if (atomic_dec_and_test(&oseq->os_refc)) { LASSERT(list_empty(&oseq->os_list)); LASSERT(oseq->os_lastid_obj != NULL); - lu_object_put(env, &oseq->os_lastid_obj->do_lu); + dt_object_put(env, oseq->os_lastid_obj); OBD_FREE_PTR(oseq); } } @@ -181,8 +181,12 @@ u64 ofd_seq_last_oid(struct ofd_seq *oseq) void ofd_seq_last_oid_set(struct ofd_seq *oseq, u64 id) { spin_lock(&oseq->os_last_oid_lock); - if (likely(ostid_id(&oseq->os_oi) < id)) - ostid_set_id(&oseq->os_oi, id); + if (likely(ostid_id(&oseq->os_oi) < id)) { + if (ostid_set_id(&oseq->os_oi, id)) { + CERROR("Bad %llu to set " DOSTID "\n", + (unsigned long long)id, POSTID(&oseq->os_oi)); + } + } spin_unlock(&oseq->os_last_oid_lock); } @@ -212,6 +216,9 @@ int ofd_seq_last_oid_write(const struct lu_env *env, struct ofd_device *ofd, ENTRY; + if (ofd->ofd_osd->dd_rdonly) + RETURN(0); + tmp = cpu_to_le64(ofd_seq_last_oid(oseq)); info->fti_buf.lb_buf = &tmp; @@ -249,7 +256,7 @@ out: * * LWP is lightweight proxy - simplified connection between * servers. It is used for FID Location Database (FLDB) and - * sequence (SEQ) client-server interations. + * sequence (SEQ) client-server interactions. * * This function is used during server cleanup process to free * LWP items that were previously set up upon OFD start. @@ -400,16 +407,21 @@ struct ofd_seq *ofd_seq_load(const struct lu_env *env, struct ofd_device *ofd, mutex_init(&oseq->os_create_lock); spin_lock_init(&oseq->os_last_oid_lock); ostid_set_seq(&oseq->os_oi, seq); + oseq->os_last_id_synced = 0; atomic_set(&oseq->os_refc, 1); + atomic_set(&oseq->os_precreate_in_progress, 0); - rc = dt_attr_get(env, dob, &info->fti_attr, BYPASS_CAPA); + rc = dt_attr_get(env, dob, &info->fti_attr); if (rc) GOTO(cleanup, rc); if (info->fti_attr.la_size == 0) { /* object is just created, initialize last id */ - ofd_seq_last_oid_set(oseq, OFD_INIT_OBJID); + if (OBD_FAIL_CHECK(OBD_FAIL_OFD_SET_OID)) + ofd_seq_last_oid_set(oseq, 0xffffff00); + else + ofd_seq_last_oid_set(oseq, OFD_INIT_OBJID); ofd_seq_last_oid_write(env, ofd, oseq); } else if (info->fti_attr.la_size == sizeof(lastid)) { info->fti_off = 0; @@ -424,7 +436,7 @@ struct ofd_seq *ofd_seq_load(const struct lu_env *env, struct ofd_device *ofd, } ofd_seq_last_oid_set(oseq, le64_to_cpu(lastid)); } else { - CERROR("%s: corrupted size "LPU64" LAST_ID of seq "LPX64"\n", + CERROR("%s: corrupted size %llu LAST_ID of seq %#llx\n", ofd_name(ofd), (__u64)info->fti_attr.la_size, seq); GOTO(cleanup, rc = -EINVAL); } @@ -677,7 +689,7 @@ void ofd_fs_cleanup(const struct lu_env *env, struct ofd_device *ofd) ofd_name(ofd), rc); if (ofd->ofd_health_check_file) { - lu_object_put(env, &ofd->ofd_health_check_file->do_lu); + dt_object_put(env, ofd->ofd_health_check_file); ofd->ofd_health_check_file = NULL; }