@@ -5220,7 +5220,8 @@ int ll_getattr(const struct path *path, struct kstat *stat,
false);
}
-int cl_falloc(struct inode *inode, int mode, loff_t offset, loff_t len)
+int cl_falloc(struct file *file, struct inode *inode, int mode, loff_t offset,
+ loff_t len)
{
struct lu_env *env;
struct cl_io *io;
@@ -5234,6 +5235,8 @@ int cl_falloc(struct inode *inode, int mode, loff_t offset, loff_t len)
io = vvp_env_thread_io(env);
io->ci_obj = ll_i2info(inode)->lli_clob;
+ ll_io_set_mirror(io, file);
+
io->ci_verify_layout = 1;
io->u.ci_setattr.sa_parent_fid = lu_object_fid(&io->ci_obj->co_lu);
io->u.ci_setattr.sa_falloc_mode = mode;
@@ -5272,7 +5275,7 @@ int cl_falloc(struct inode *inode, int mode, loff_t offset, loff_t len)
long ll_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
{
- struct inode *inode = filp->f_path.dentry->d_inode;
+ struct inode *inode = file_inode(filp);
int rc;
if (offset < 0 || len <= 0)
@@ -5298,7 +5301,7 @@ long ll_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FALLOCATE, 1);
- rc = cl_falloc(inode, mode, offset, len);
+ rc = cl_falloc(filp, inode, mode, offset, len);
/*
* ENOTSUPP (524) is an NFSv3 specific error code erroneously
* used by Lustre in several places. Retuning it here would
@@ -322,7 +322,8 @@ static int lov_io_mirror_init(struct lov_io *lio, struct lov_object *obj,
CDEBUG(D_LAYOUT, "designated I/O mirror state: %d\n",
lov_flr_state(obj));
- if ((cl_io_is_trunc(io) || io->ci_type == CIT_WRITE) &&
+ if ((cl_io_is_trunc(io) || io->ci_type == CIT_WRITE ||
+ cl_io_is_fallocate(io)) &&
(io->ci_layout_version != obj->lo_lsm->lsm_layout_gen)) {
/* For resync I/O, the ci_layout_version was the layout
* version when resync starts. If it doesn't match the