diff options
-rw-r--r-- | tests/bugs/bug-1112111.t | 31 | ||||
-rw-r--r-- | xlators/features/index/src/index.c | 5 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/bugs/bug-1112111.t b/tests/bugs/bug-1112111.t new file mode 100644 index 00000000000..7ccb4403ea9 --- /dev/null +++ b/tests/bugs/bug-1112111.t @@ -0,0 +1,31 @@ +#!/bin/bash +#Test case: Check the creation of indices/xattrop dir as soon as brick comes up. + +. $(dirname $0)/../include.rc + +cleanup; + +#Create a volume +TEST glusterd; +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}-{0,1}; +EXPECT 'Created' volinfo_field $V0 'Status'; + +TEST mkdir -p $B0/${V0}-0/.glusterfs/indices/ +TEST touch $B0/${V0}-0/.glusterfs/indices/xattrop + +#Volume start should not work when xattrop dir not created +TEST ! $CLI volume start $V0; + +TEST rm $B0/${V0}-0/.glusterfs/indices/xattrop + +#Volume start should work now +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +#Check for the existence of indices/xattrop dir +TEST [ -d $B0/${V0}-0/.glusterfs/indices/xattrop/ ]; + +cleanup; diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index 7f3c085da7a..8acddf088f3 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -1392,6 +1392,11 @@ init (xlator_t *this) INIT_LIST_HEAD (&priv->callstubs); this->private = priv; + + ret = index_dir_create (this, XATTROP_SUBDIR); + if (ret < 0) + goto out; + ret = gf_thread_create (&thread, &w_attr, index_worker, this); if (ret) { gf_log (this->name, GF_LOG_WARNING, "Failed to create " |