Changes to llapi_stripe_param_verify() and related llapi file
creation functions to verify that the given pool name is valid
introduced a bug that disallowed the 'ignore' pool name, which
is used to create files without any pool name.
Allow the reserved pool names from lov_pool_is_reserved() to be
used even (especially!) if the named pool does not exist.
Revert the changes to ost-pools.sh::test_32() that created the
'ignore_pool' pool, and go back to checking that 'ignore' will
create a file that does not use any pool.
Change the pool name validation to only do fsname lookup if the
pool name is actually specified, instead of looking up fsname
but not actually using it for anything.
Fixes:
ee7dfc5ad1 ("LU-17025 llapi: Verify stripe pool name")
Signed-off-by: Rajeev Mishra <rajeevm@hpe.com>
Change-Id: I9368f28a41fd9af6b6f0e9468df0e7dfd728db1c
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54355
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
( $LFS getstripe -p $DIR/$tdir | grep -q $pool ) ||
error "fail to set pool on $DIR/$tdir"
( $LFS getstripe -p $DIR/$tdir | grep -q $pool ) ||
error "fail to set pool on $DIR/$tdir"
- local ig_pool="ignore_pool"
-
- pool_add $ig_pool || error "add $ig_pool failed"
-
- $LFS setstripe -p $ig_pool $DIR/$tdir/$tfile ||
+ $LFS setstripe -p ignore $DIR/$tdir/$tfile ||
error "setstripe fail on $DIR/$tdir/$tfile"
error "setstripe fail on $DIR/$tdir/$tfile"
- ( $LFS getstripe -p $DIR/$tdir/$tfile | grep -q $ig_pool ) ||
+ ! ( $LFS getstripe -p $DIR/$tdir/$tfile | egrep -q "[^ ]+" ) ||
error "fail to create $DIR/$tdir/$tfile without pool"
# Test with start index
local got idx
for ((idx = 0; idx < OSTCOUNT; idx++)); do
error "fail to create $DIR/$tdir/$tfile without pool"
# Test with start index
local got idx
for ((idx = 0; idx < OSTCOUNT; idx++)); do
- $LFS setstripe -p $ig_pool -i $idx $DIR/$tdir/$tfile.$idx ||
+ $LFS setstripe -p ignore -i $idx $DIR/$tdir/$tfile.$idx ||
error "setstripe -i fail on $DIR/$tdir/$tfile.$idx"
got=$($LFS getstripe -i $DIR/$tdir/$tfile.$idx)
error "setstripe -i fail on $DIR/$tdir/$tfile.$idx"
got=$($LFS getstripe -i $DIR/$tdir/$tfile.$idx)
done
# Test with ost list
done
# Test with ost list
- $LFS setstripe -p $ig_pool -o 1,0 $DIR/$tdir/$tfile.1_0 ||
+ $LFS setstripe -p ignore -o 1,0 $DIR/$tdir/$tfile.1_0 ||
error "setstripe --ost fail on $DIR/$tdir/$tfile.1_0"
got=$($LFS getstripe -i $DIR/$tdir/$tfile.1_0)
error "setstripe --ost fail on $DIR/$tdir/$tfile.1_0"
got=$($LFS getstripe -i $DIR/$tdir/$tfile.1_0)
- /* Make sure the pool exists */
- rc = llapi_search_ost(fsname, *pool_name, NULL);
- if (rc < 0) {
- llapi_error(LLAPI_MSG_ERROR, rc,
- "pool '%s fsname %s' does not exist",
- *pool_name, fsname);
- rc = -EINVAL;
- goto out;
+ if (!lov_pool_is_ignored((const char *) *pool_name)) {
+ /* Make sure the pool exists */
+ rc = llapi_search_ost(fsname, *pool_name, NULL);
+ if (rc < 0) {
+ llapi_error(LLAPI_MSG_ERROR, rc,
+ "pool '%s fsname %s' does not exist",
+ *pool_name, fsname);
+ rc = -EINVAL;
+ goto out;
+ }
struct lov_user_md *lum = NULL;
const char *pool_name = param->lsp_pool;
size_t lum_size;
struct lov_user_md *lum = NULL;
const char *pool_name = param->lsp_pool;
size_t lum_size;
/* Make sure we are on a Lustre file system */
/* Make sure we are on a Lustre file system */
- rc = llapi_search_fsname(name, fsname);
- if (rc) {
- llapi_error(LLAPI_MSG_ERROR, rc,
- "'%s' is not on a Lustre filesystem", name);
- return rc;
+ if (pool_name && !lov_pool_is_ignored(pool_name)) {
+ rc = llapi_search_fsname(name, fsname);
+ if (rc) {
+ llapi_error(LLAPI_MSG_ERROR, rc,
+ "'%s' is not on a Lustre filesystem", name);
+ return rc;
+ }
}
/* Check if the stripe pattern is sane. */
}
/* Check if the stripe pattern is sane. */
struct lov_user_md *lum;
size_t lum_size;
char fsname[MAX_OBD_NAME + 1] = { 0 };
struct lov_user_md *lum;
size_t lum_size;
char fsname[MAX_OBD_NAME + 1] = { 0 };
+ struct llapi_layout_comp *comp;
+
+ comp = __llapi_layout_cur_comp(layout);
if (path == NULL ||
(layout != NULL && layout->llot_magic != LLAPI_LAYOUT_MAGIC)) {
if (path == NULL ||
(layout != NULL && layout->llot_magic != LLAPI_LAYOUT_MAGIC)) {
if (layout) {
/* Make sure we are on a Lustre file system */
if (layout) {
/* Make sure we are on a Lustre file system */
- rc = llapi_search_fsname(path, fsname);
- if (rc) {
- errno = ENOTTY;
- return -1;
+ if (comp->llc_pool_name[0] != '\0' &&
+ !lov_pool_is_ignored(comp->llc_pool_name)) {
+ rc = llapi_search_fsname(path, fsname);
+ if (rc) {
+ errno = ENOTTY;
+ return -1;
+ }
}
rc = llapi_layout_v2_sanity((struct llapi_layout *)layout,
false,
}
rc = llapi_layout_v2_sanity((struct llapi_layout *)layout,
false,
struct llapi_layout *existing_layout = NULL;
struct lov_user_md *lum = NULL;
char fsname[MAX_OBD_NAME + 1] = { 0 };
struct llapi_layout *existing_layout = NULL;
struct lov_user_md *lum = NULL;
char fsname[MAX_OBD_NAME + 1] = { 0 };
+ struct llapi_layout_comp *comp;
if (path == NULL || layout == NULL ||
layout->llot_magic != LLAPI_LAYOUT_MAGIC) {
if (path == NULL || layout == NULL ||
layout->llot_magic != LLAPI_LAYOUT_MAGIC) {
- rc = llapi_search_fsname(path, fsname);
- if (rc) {
- tmp_errno = -rc;
- rc = -1;
- goto out;
+ comp = __llapi_layout_cur_comp(layout);
+
+ if (comp->llc_pool_name[0] != '\0' &&
+ !lov_pool_is_ignored(comp->llc_pool_name)) {
+ rc = llapi_search_fsname(path, fsname);
+ if (rc) {
+ tmp_errno = -rc;
+ rc = -1;
+ goto out;
+ }
}
rc = llapi_layout_v2_sanity(existing_layout, false, false, fsname);
}
rc = llapi_layout_v2_sanity(existing_layout, false, false, fsname);
- rc = llapi_search_fsname(path, fsname);
- if (rc) {
- tmp_errno = -rc;
- rc = -1;
- goto out;
+ comp = __llapi_layout_cur_comp(layout);
+
+ if (comp && comp->llc_pool_name[0] != '\0' &&
+ !lov_pool_is_ignored(comp->llc_pool_name)) {
+ rc = llapi_search_fsname(path, fsname);
+ if (rc) {
+ tmp_errno = -rc;
+ rc = -1;
+ goto out;
+ }
}
rc = llapi_layout_v2_sanity(existing_layout, false, false, fsname);
}
rc = llapi_layout_v2_sanity(existing_layout, false, false, fsname);
comp = __llapi_layout_cur_comp(layout);
if (!comp)
return 0;
comp = __llapi_layout_cur_comp(layout);
if (!comp)
return 0;
- if (comp->llc_pool_name[0] == '\0')
+ if (comp->llc_pool_name[0] == '\0' ||
+ lov_pool_is_ignored(comp->llc_pool_name))
return 0;
/* check if the pool name exist */
if (llapi_search_ost(fsname, comp->llc_pool_name, NULL) < 0)
return 0;
/* check if the pool name exist */
if (llapi_search_ost(fsname, comp->llc_pool_name, NULL) < 0)