From c3ccaa9a943be49c9f688003cb3d46f037e229e3 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Wed, 15 Dec 2010 17:50:39 +0300 Subject: [PATCH] b=24171 check the init() iterator results properly i=vitaly i=bzzz --- lustre/mdd/mdd_dir.c | 4 ++-- lustre/mdd/mdd_orphans.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index ba0ab43..61a4b4b 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -251,7 +251,7 @@ static int mdd_dir_is_empty(const struct lu_env *env, iops = &obj->do_index_ops->dio_it; it = iops->init(env, obj, BYPASS_CAPA); - if (it != NULL) { + if (!IS_ERR(it)) { result = iops->get(env, it, (const void *)""); if (result > 0) { int i; @@ -270,7 +270,7 @@ static int mdd_dir_is_empty(const struct lu_env *env, iops->put(env, it); iops->fini(env, it); } else - result = -ENOMEM; + result = PTR_ERR(it); RETURN(result); } diff --git a/lustre/mdd/mdd_orphans.c b/lustre/mdd/mdd_orphans.c index 12953a2..6c29665 100644 --- a/lustre/mdd/mdd_orphans.c +++ b/lustre/mdd/mdd_orphans.c @@ -391,7 +391,7 @@ static int orph_index_iterate(const struct lu_env *env, iops = &dor->do_index_ops->dio_it; it = iops->init(env, dor, BYPASS_CAPA); - if (it != NULL) { + if (!IS_ERR(it)) { result = iops->load(env, it, 0); if (result > 0) { /* main cycle */ @@ -443,8 +443,8 @@ next: iops->put(env, it); iops->fini(env, it); } else { - CERROR("not enough memory for clean pending.\n"); - result = -ENOMEM; + result = PTR_ERR(it); + CERROR("Cannot clean pending (%d).\n", result); } RETURN(result); -- 1.8.3.1