u64 valid;
int size, err, checksum;
bool api32;
+ void *encctx;
+ int encctxlen;
ENTRY;
sbi->ll_md_obd = class_name2obd(md);
sb->s_maxbytes = MAX_LFS_FILESIZE;
sbi->ll_namelen = osfs->os_namelen;
sbi->ll_mnt.mnt = current->fs->root.mnt;
+ sbi->ll_mnt_ns = current->nsproxy->mnt_ns;
if (test_bit(LL_SBI_USER_XATTR, sbi->ll_flags) &&
!(data->ocd_connect_flags & OBD_CONNECT_XATTR)) {
/* make root inode
* XXX: move this to after cbd setup? */
- valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMODEASIZE;
+ valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMODEASIZE |
+ OBD_MD_ENCCTX;
if (test_bit(LL_SBI_ACL, sbi->ll_flags))
valid |= OBD_MD_FLACL;
err = md_getattr(sbi->ll_md_exp, op_data, &request);
+ /* We need enc ctx info, so reset it in op_data to
+ * prevent it from being freed.
+ */
+ encctx = op_data->op_file_encctx;
+ encctxlen = op_data->op_file_encctx_size;
+ op_data->op_file_encctx = NULL;
+ op_data->op_file_encctx_size = 0;
OBD_FREE_PTR(op_data);
if (err) {
CERROR("%s: md_getattr failed for root: rc = %d\n",
api32 = test_bit(LL_SBI_32BIT_API, sbi->ll_flags);
root = ll_iget(sb, cl_fid_build_ino(&sbi->ll_root_fid, api32), &lmd);
md_free_lustre_md(sbi->ll_md_exp, &lmd);
- ptlrpc_req_finished(request);
if (IS_ERR(root)) {
lmd_clear_acl(&lmd);
root = NULL;
CERROR("%s: bad ll_iget() for root: rc = %d\n",
sbi->ll_fsname, err);
+ ptlrpc_req_finished(request);
GOTO(out_root, err);
}
+ if (encctxlen) {
+ CDEBUG(D_SEC,
+ "server returned encryption ctx for root inode "DFID"\n",
+ PFID(&sbi->ll_root_fid));
+ err = ll_set_encflags(root, encctx, encctxlen, true);
+ if (err)
+ CWARN("%s: cannot set enc ctx for "DFID": rc = %d\n",
+ sbi->ll_fsname,
+ PFID(&sbi->ll_root_fid), err);
+ }
+ ptlrpc_req_finished(request);
+
checksum = test_bit(LL_SBI_CHECKSUM, sbi->ll_flags);
if (sbi->ll_checksum_set) {
err = obd_set_info_async(NULL, sbi->ll_dt_exp,
if (err)
GOTO(out_free_cfg, err);
+ /* disable kernel readahead */
+ sb->s_bdi->ra_pages = 0;
+
/* Call ll_debugfs_register_super() before lustre_process_log()
* so that "llite.*.*" params can be processed correctly.
*/
!S_ISDIR(inode->i_mode)) {
ia_valid = op_data->op_attr.ia_valid;
op_data->op_attr.ia_valid &= ~TIMES_SET_FLAGS;
- rc = simple_setattr(dentry, &op_data->op_attr);
+ rc = simple_setattr(&init_user_ns, dentry,
+ &op_data->op_attr);
op_data->op_attr.ia_valid = ia_valid;
}
} else if (rc != -EPERM && rc != -EACCES && rc != -ETXTBSY) {
op_data->op_attr.ia_valid &= ~(TIMES_SET_FLAGS | ATTR_SIZE);
if (S_ISREG(inode->i_mode))
inode_lock(inode);
- rc = simple_setattr(dentry, &op_data->op_attr);
+ rc = simple_setattr(&init_user_ns, dentry, &op_data->op_attr);
if (S_ISREG(inode->i_mode))
inode_unlock(inode);
op_data->op_attr.ia_valid = ia_valid;
RETURN(rc);
}
-int ll_setattr(struct dentry *de, struct iattr *attr)
+int ll_setattr(struct user_namespace *mnt_userns, struct dentry *de,
+ struct iattr *attr)
{
int mode = de->d_inode->i_mode;
enum op_xvalid xvalid = 0;
return;
lli = ll_i2info(inode);
- lli->lli_depth = ll_i2info(dir)->lli_depth + 1;
- CDEBUG(D_INODE, DFID" depth %hu\n", PFID(&lli->lli_fid), lli->lli_depth);
+ lli->lli_dir_depth = ll_i2info(dir)->lli_dir_depth + 1;
+ CDEBUG(D_INODE, DFID" depth %hu\n",
+ PFID(&lli->lli_fid), lli->lli_dir_depth);
}
void ll_truncate_inode_pages_final(struct inode *inode)
if (namelen != 0)
return ERR_PTR(-EINVAL);
} else {
- if (namelen > ll_i2sbi(i1)->ll_namelen)
+ if ((!IS_ENCRYPTED(i1) ||
+ (opc != LUSTRE_OPC_LOOKUP && opc != LUSTRE_OPC_CREATE)) &&
+ namelen > ll_i2sbi(i1)->ll_namelen)
return ERR_PTR(-ENAMETOOLONG);
/* "/" is not valid name, but it's allowed */
if (ll_need_32bit_api(ll_i2sbi(i1)))
op_data->op_cli_flags |= CLI_API32;
- if (opc == LUSTRE_OPC_LOOKUP || opc == LUSTRE_OPC_CREATE) {
+ if ((i2 && is_root_inode(i2)) ||
+ opc == LUSTRE_OPC_LOOKUP || opc == LUSTRE_OPC_CREATE) {
/* In case of lookup, ll_setup_filename() has already been
* called in ll_lookup_it(), so just take provided name.
+ * Also take provided name if we are dealing with root inode.
*/
fname.disk_name.name = (unsigned char *)name;
fname.disk_name.len = namelen;