if (copy_from_user(gfout, arg, sizeof(*gfout)))
GOTO(gf_free, rc = -EFAULT);
+ /* append root FID after gfout to let MDT know the root FID so that it
+ * can lookup the correct path, this is mainly for fileset.
+ * old server without fileset mount support will ignore this. */
+ *gfout->gf_u.gf_root_fid = *ll_inode2fid(inode);
/* Call mdc_iocontrol */
rc = obd_iocontrol(OBD_IOC_FID2PATH, exp, outsize, gfout, NULL);
if (child_inode == NULL)
GOTO(out_free, rc = -EINVAL);
+ /*
+ * lfs migrate command needs to be blocked on the client
+ * by checking the migrate FID against the FID of the
+ * filesystem root.
+ */
+ if (child_inode == parent->i_sb->s_root->d_inode)
+ GOTO(out_iput, rc = -EINVAL);
+
mutex_lock(&child_inode->i_mutex);
op_data->op_fid3 = *ll_inode2fid(child_inode);
if (!fid_is_sane(&op_data->op_fid3)) {
clear_nlink(child_inode);
out_unlock:
mutex_unlock(&child_inode->i_mutex);
+out_iput:
iput(child_inode);
out_free:
ll_finish_md_op_data(op_data);