mmap write and punch/fallocate do not stale other mirrors and makes
FLR file contains different content in different mirrors.
Lustre-change: https://review.whamcloud.com/43470/
Lustre-commit:
03511484c668355c77e54e4b01600183236d8673
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I93a3eb5ba898e3bf0ce108718506b742ed485da5
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44258
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Li Xi <lixi@ddn.com>
return io->ci_type == CIT_FAULT && io->u.ci_fault.ft_mkwrite;
}
+static inline int cl_io_is_fault_writable(const struct cl_io *io)
+{
+ return io->ci_type == CIT_FAULT && io->u.ci_fault.ft_writable;
+}
+
/**
* True, iff \a io is a truncate(2).
*/
else if (vma->vm_flags & VM_RAND_READ)
io->ci_rand_read = 1;
+ if (vma->vm_flags & VM_WRITE)
+ fio->ft_writable = 1;
+
rc = cl_io_init(env, io, CIT_FAULT, io->ci_obj);
if (rc == 0) {
struct vvp_io *vio = vvp_env_io(env);
io->ci_need_write_intent = 0;
LASSERT(io->ci_type == CIT_WRITE || cl_io_is_fallocate(io) ||
- cl_io_is_trunc(io) || cl_io_is_mkwrite(io));
+ cl_io_is_trunc(io) || cl_io_is_mkwrite(io) ||
+ cl_io_is_fault_writable(io));
CDEBUG(D_VFSTRACE, DFID" write layout, type %u "DEXT"\n",
PFID(lu_object_fid(&obj->co_lu)), io->ci_type,
*ext = (typeof(*ext)) { lio->lis_pos, lio->lis_endpos };
io->ci_need_write_intent = 0;
- if (!(io->ci_type == CIT_WRITE || cl_io_is_trunc(io) ||
- cl_io_is_mkwrite(io)))
+ if (!(io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io) ||
+ cl_io_is_fallocate(io) || cl_io_is_trunc(io) ||
+ cl_io_is_fault_writable(io)))
RETURN(0);
/*
/* check if it needs to instantiate layout */
if (!(io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io) ||
cl_io_is_fallocate(io) ||
- (cl_io_is_trunc(io) && io->u.ci_setattr.sa_attr.lvb_size > 0)))
+ (cl_io_is_trunc(io) && io->u.ci_setattr.sa_attr.lvb_size > 0)) ||
+ cl_io_is_fault_writable(io))
GOTO(out, result = 0);
/*
mkdir -p $DIR/$tdir || error "create directroy failed"
dd if=/dev/zero of=$tf bs=1M count=10 || error "dd write $tfile failed"
- sync
+ sync $tf
+ sleep 1
block1=$(( $(stat -c "%b*%B" $tf) ))
echo " ** before mirror ops, file blocks=$((block1/1024)) KiB"
}
run_test 50b "mirror rsync handles sparseness"
+test_50c() {
+ local tf=$DIR/$tdir/$tfile
+
+ test_mkdir $DIR/$tdir
+
+ $LFS setstripe -N2 -c-1 $tf || error "create FLR $tf failed"
+ verify_flr_state $tf "ro"
+
+ # fallocate add punch mode in v2_14_51-78 (cb037f305c)
+ if [ "$FSTYPE" == "ldiskfs" ] &&
+ [ $OST1_VERSION -ge $(version_code 2.14.51) ]; then
+ # ZFS does not support fallocate for now
+ fallocate -p -o 1MiB -l 1MiB $tf ||
+ error "punch hole in $tf failed"
+ verify_flr_state $tf "wp"
+ fi
+
+ dd if=/dev/zero of=$tf bs=4096 count=4 || error "write $tf failed"
+ $LFS mirror resync $tf || error "mirror resync $tf failed"
+ verify_flr_state $tf "ro"
+
+ $MULTIOP $tf OSMWUc || error "$MULTIOP $tf failed"
+ verify_flr_state $tf "wp"
+}
+run_test 50c "punch_hole/mmap_write stale other mirrors"
+
test_60a() {
$LCTL get_param osc.*.import | grep -q 'connect_flags:.*seek' ||
skip "OST does not support SEEK_HOLE"