Migration to DoM layout from OST-striped file can skip
data sync beyond DoM component if it is not initialized.
Patch forces data copy prior layout merge, so new layout
is initialized and contains needed data
Tests 272e/272f in sanity.sh were modified to migrate data
for both MDT and OST parts
Fixes:
44a721b8c1 ("LU-11421 dom: manual OST-to-DOM migration via mirroring")
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I206358e762780ab7cfaa7587888174a31bc7b196
Reviewed-on: https://review.whamcloud.com/45549
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
mkdir -p $DIR/$tdir
$LFS setstripe -c 2 $dom
mkdir -p $DIR/$tdir
$LFS setstripe -c 2 $dom
- dd if=/dev/urandom of=$dom bs=512K count=1 oflag=direct ||
+ dd if=/dev/urandom of=$dom bs=2M count=1 oflag=direct ||
error "failed to write data into $dom"
local old_md5=$(md5sum $dom)
error "failed to write data into $dom"
local old_md5=$(md5sum $dom)
$LFS mirror extend -N -E 1M -L mdt -E eof -c2 $dom ||
error "failed mirroring to the DOM layout"
$LFS mirror extend -N -E 1M -L mdt -E eof -c2 $dom ||
error "failed mirroring to the DOM layout"
$LFS mirror split --mirror-id 1 -d $dom ||
error "failed mirror split"
$LFS mirror split --mirror-id 1 -d $dom ||
error "failed mirror split"
- [ $($LFS getstripe -L $dom) != 'mdt' ] ||
- error "MDT stripe was not removed"
+ [[ $($LFS getstripe -L --component-start=0 $dom) == 'mdt' ]] ||
+ error "MDT stripe wasn't set"
local new_md5=$(md5sum $dom)
[ "$old_md5" == "$new_md5" ] ||
error "$old_md5 != $new_md5"
local new_md5=$(md5sum $dom)
[ "$old_md5" == "$new_md5" ] ||
error "$old_md5 != $new_md5"
mkdir -p $DIR/$tdir
$LFS setstripe -c 2 $dom
mkdir -p $DIR/$tdir
$LFS setstripe -c 2 $dom
- dd if=/dev/urandom of=$dom bs=512K count=1 oflag=direct ||
+ dd if=/dev/urandom of=$dom bs=2M count=1 oflag=direct ||
error "failed to write data into $dom"
local old_md5=$(md5sum $dom)
error "failed to write data into $dom"
local old_md5=$(md5sum $dom)
$LFS migrate -E 1M -L mdt -E eof -c2 -v $dom ||
error "failed migrating to the DOM file"
$LFS migrate -E 1M -L mdt -E eof -c2 -v $dom ||
error "failed migrating to the DOM file"
+ [[ $($LFS getstripe -L --component-start=0 $dom) == 'mdt' ]] ||
+ error "MDT stripe wasn't set"
+
+ cancel_lru_locks
local new_md5=$(md5sum $dom)
[ "$old_md5" != "$new_md5" ] &&
error "$old_md5 != $new_md5"
local new_md5=$(md5sum $dom)
[ "$old_md5" != "$new_md5" ] &&
error "$old_md5 != $new_md5"
static int lfs_pcc(int argc, char **argv);
static int lfs_pcc_list_commands(int argc, char **argv);
static int lfs_migrate_to_dom(int fd, int fdv, char *name,
static int lfs_pcc(int argc, char **argv);
static int lfs_pcc_list_commands(int argc, char **argv);
static int lfs_migrate_to_dom(int fd, int fdv, char *name,
- __u64 migration_flags,
- struct llapi_stripe_param *param,
- struct llapi_layout *layout);
+ __u64 migration_flags);
struct pool_to_id_cbdata {
const char *pool;
struct pool_to_id_cbdata {
const char *pool;
* if new layout used bigger DOM size, then mirroring is used
*/
if (dom_new > dom_cur) {
* if new layout used bigger DOM size, then mirroring is used
*/
if (dom_new > dom_cur) {
- rc = lfs_migrate_to_dom(fd, fdv, name, migration_flags, param,
- layout);
+ rc = lfs_migrate_to_dom(fd, fdv, name, migration_flags);
if (rc)
error_loc = "cannot migrate to DOM layout";
goto out_closed;
if (rc)
error_loc = "cannot migrate to DOM layout";
goto out_closed;
llapi_layout_comp_flags_set(m_layout, flags);
rc = migrate_open_files(name,
LLAPI_MIGRATION_NONDIRECT | LLAPI_MIGRATION_MIRROR,
llapi_layout_comp_flags_set(m_layout, flags);
rc = migrate_open_files(name,
LLAPI_MIGRATION_NONDIRECT | LLAPI_MIGRATION_MIRROR,
__u16 *mirror_ids, int ids_nr);
static int lfs_migrate_to_dom(int fd, int fdv, char *name,
__u16 *mirror_ids, int ids_nr);
static int lfs_migrate_to_dom(int fd, int fdv, char *name,
- __u64 migration_flags,
- struct llapi_stripe_param *param,
- struct llapi_layout *layout)
{
struct ll_ioc_lease *data = NULL;
int rc;
{
struct ll_ioc_lease *data = NULL;
int rc;
+ rc = migrate_nonblock(fd, fdv);
+ if (rc < 0)
+ goto out_release;
+
/* Atomically put lease, merge layouts, resync and close. */
/* Atomically put lease, merge layouts, resync and close. */
- data = calloc(1, offsetof(typeof(*data), lil_ids[1024]));
+ data = calloc(1, offsetof(typeof(*data), lil_ids[1]));
if (!data) {
error_loc = "memory allocation";
if (!data) {
error_loc = "memory allocation";
}
data->lil_mode = LL_LEASE_UNLCK;
data->lil_flags = LL_LEASE_LAYOUT_MERGE;
}
data->lil_mode = LL_LEASE_UNLCK;
data->lil_flags = LL_LEASE_LAYOUT_MERGE;
error_loc = "cannot delete old layout";
goto out;
error_loc = "cannot delete old layout";
goto out;
+out_release:
+ llapi_lease_release(fd);
out_close:
close(fd);
close(fdv);
out_close:
close(fd);
close(fdv);