From 7a79e2b47b7d9078757c73a13578a3f728fb4ad6 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 26 Feb 2009 18:53:41 +0000 Subject: [PATCH] b=18606 i=adilger i=johann use pool of "all" if specified pool is empty --- lustre/lov/lov_pack.c | 29 ++++++++++++++--------------- lustre/tests/sanity.sh | 2 ++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 7fd5470..383c701 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -58,7 +58,7 @@ void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm) { struct lov_ost_data_v1 *lod; int i; - + CDEBUG(level, "objid "LPX64", magic 0x%08x, pattern %#x\n", le64_to_cpu(lmm->lmm_object_id), le32_to_cpu(lmm->lmm_magic), le32_to_cpu(lmm->lmm_pattern)); @@ -476,23 +476,22 @@ static int __lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, struct pool_desc *pool; pool = lov_find_pool(lov, lumv3.lmm_pool_name); - if (pool == NULL) - RETURN(-EINVAL); - - if (lumv3.lmm_stripe_offset != - (typeof(lumv3.lmm_stripe_offset))(-1)) { - rc = lov_check_index_in_pool(lumv3.lmm_stripe_offset, - pool); - if (rc < 0) { - lov_pool_putref(pool); - RETURN(-EINVAL); + if (pool != NULL) { + if (lumv3.lmm_stripe_offset != + (typeof(lumv3.lmm_stripe_offset))(-1)) { + rc = lov_check_index_in_pool( + lumv3.lmm_stripe_offset, pool); + if (rc < 0) { + lov_pool_putref(pool); + RETURN(-EINVAL); + } } - } - if (stripe_count > pool_tgt_count(pool)) - stripe_count = pool_tgt_count(pool); + if (stripe_count > pool_tgt_count(pool)) + stripe_count = pool_tgt_count(pool); - lov_pool_putref(pool); + lov_pool_putref(pool); + } } if ((__u64)lumv1->lmm_stripe_size * stripe_count > ~0UL) { diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index b4b15ed..8f51dc5 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6291,6 +6291,8 @@ test_200h() { done wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL" ""\ || error "Pool $FSNAME.$POOL cannot be drained" + # striping on an empty pool should fall back to "pool of everything" + $SETSTRIPE -p $POOL ${POOL_FILE}/$tfile || error "failed to create file with empty pool" } run_test 200h "Remove all targets from a pool ==========================" -- 1.8.3.1