Commit 44460570 authored by Vladimir Saveliev's avatar Vladimir Saveliev Committed by Oleg Drokin
Browse files

LU-12704 lov: check all entries in lov_flush_composite

Check all layout entries for DOM layout and exit with
-ENODATA if no one exists. Caller consider that as valid
case due to layout change.

Define llo_flush methods for all layouts as required
by lov_dispatch().

Patch cleans up also cl_dom_size field in cl_layout which
was used in previous ll_dom_lock_cancel() implementation

Run lov_flush_composite under down_read lov->lo_type_guard to avoid
race with layout change.

Fixes: 707bab62

 ("LU-12296 llite: improve ll_dom_lock_cancel")

Test-Parameters testlist=racer
Signed-off-by: default avatarMikhail Pershin <mpershin@whamcloud.com>
Signed-off-by: default avatarVladimir Saveliev <c17830@cray.com>
Change-Id: I4e7b1b201bb1a669fe0d8f0f728467e579ef3512
Reviewed-on: https://review.whamcloud.com/36368

Reviewed-by: default avatarAndreas Dilger <adilger@whamcloud.com>
Tested-by: default avatarjenkins <devops@whamcloud.com>
Tested-by: default avatarMaloo <maloo@whamcloud.com>
Reviewed-by: default avatarOleg Drokin <green@whamcloud.com>
parent 316eddce
......@@ -290,8 +290,6 @@ struct cl_layout {
struct lu_buf cl_buf;
/** size of layout in lov_mds_md format. */
size_t cl_size;
/** size of DoM component if exists or zero otherwise */
u64 cl_dom_comp_size;
/** Layout generation. */
u32 cl_layout_gen;
/** whether layout is a composite one */
......
......@@ -205,6 +205,12 @@ static int ll_dom_lock_cancel(struct inode *inode, struct ldlm_lock *lock)
/* reach MDC layer to flush data under the DoM ldlm lock */
rc = cl_object_flush(env, lli->lli_clob, lock);
if (rc == -ENODATA) {
CDEBUG(D_INODE, "inode "DFID" layout has no DoM stripe\n",
PFID(ll_inode2fid(inode)));
/* most likely result of layout change, do nothing */
rc = 0;
}
cl_env_put(env, &refcheck);
RETURN(rc);
......
......@@ -1061,15 +1061,25 @@ static int lov_flush_composite(const struct lu_env *env,
struct ldlm_lock *lock)
{
struct lov_object *lov = cl2lov(obj);
struct lovsub_object *lovsub;
struct lov_layout_entry *lle;
int rc = -ENODATA;
ENTRY;
if (!lsme_is_dom(lov->lo_lsm->lsm_entries[0]))
RETURN(-EINVAL);
lov_foreach_layout_entry(lov, lle) {
if (!lsme_is_dom(lle->lle_lsme))
continue;
rc = cl_object_flush(env, lovsub2cl(lle->lle_dom.lo_dom), lock);
break;
}
RETURN(rc);
}
lovsub = lov->u.composite.lo_entries[0].lle_dom.lo_dom;
RETURN(cl_object_flush(env, lovsub2cl(lovsub), lock));
static int lov_flush_empty(const struct lu_env *env, struct cl_object *obj,
struct ldlm_lock *lock)
{
return 0;
}
const static struct lov_layout_operations lov_dispatch[] = {
......@@ -1082,6 +1092,7 @@ const static struct lov_layout_operations lov_dispatch[] = {
.llo_lock_init = lov_lock_init_empty,
.llo_io_init = lov_io_init_empty,
.llo_getattr = lov_attr_get_empty,
.llo_flush = lov_flush_empty,
},
[LLT_RELEASED] = {
.llo_init = lov_init_released,
......@@ -1092,6 +1103,7 @@ const static struct lov_layout_operations lov_dispatch[] = {
.llo_lock_init = lov_lock_init_empty,
.llo_io_init = lov_io_init_released,
.llo_getattr = lov_attr_get_empty,
.llo_flush = lov_flush_empty,
},
[LLT_COMP] = {
.llo_init = lov_init_composite,
......@@ -1113,6 +1125,7 @@ const static struct lov_layout_operations lov_dispatch[] = {
.llo_lock_init = lov_lock_init_empty,
.llo_io_init = lov_io_init_empty,
.llo_getattr = lov_attr_get_empty,
.llo_flush = lov_flush_empty,
},
};
......@@ -2081,18 +2094,8 @@ static int lov_object_layout_get(const struct lu_env *env,
cl->cl_size = lov_comp_md_size(lsm);
cl->cl_layout_gen = lsm->lsm_layout_gen;
cl->cl_dom_comp_size = 0;
cl->cl_is_released = lsm->lsm_is_released;
if (lsm_is_composite(lsm->lsm_magic)) {
struct lov_stripe_md_entry *lsme = lsm->lsm_entries[0];
cl->cl_is_composite = true;
if (lsme_is_dom(lsme))
cl->cl_dom_comp_size = lsme->lsme_extent.e_end;
} else {
cl->cl_is_composite = false;
}
cl->cl_is_composite = lsm_is_composite(lsm->lsm_magic);
rc = lov_lsm_pack(lsm, buf->lb_buf, buf->lb_len);
lov_lsm_put(lsm);
......@@ -2119,7 +2122,8 @@ static loff_t lov_object_maxbytes(struct cl_object *obj)
static int lov_object_flush(const struct lu_env *env, struct cl_object *obj,
struct ldlm_lock *lock)
{
return LOV_2DISPATCH_NOLOCK(cl2lov(obj), llo_flush, env, obj, lock);
return LOV_2DISPATCH_MAYLOCK(cl2lov(obj), llo_flush, true, env, obj,
lock);
}
static const struct cl_object_operations lov_ops = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment