struct ll_sb_info *sbi = ll_i2sbi(inode);
__u64 pos = *ppos;
bool is_api32 = ll_need_32bit_api(sbi);
- bool is_hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
+ bool is_hash64 = test_bit(LL_SBI_64BIT_HASH, sbi->ll_flags);
struct page *page;
bool done = false;
struct llcrypt_str lltr = LLTR_INIT(NULL, 0);
struct inode *inode = file_inode(filp);
struct ll_file_data *lfd = filp->private_data;
struct ll_sb_info *sbi = ll_i2sbi(inode);
- int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
+ bool hash64 = test_bit(LL_SBI_64BIT_HASH, sbi->ll_flags);
int api32 = ll_need_32bit_api(sbi);
struct md_op_data *op_data;
struct lu_fid pfid = { 0 };
if (IS_ERR(op_data))
RETURN(PTR_ERR(op_data));
- op_data->op_dir_depth = ll_i2info(parent)->lli_depth;
+ op_data->op_dir_depth = ll_i2info(parent)->lli_dir_depth;
if (ll_sbi_has_encrypt(sbi) &&
(IS_ENCRYPTED(parent) ||
encrypt = true;
}
- if (sbi->ll_flags & LL_SBI_FILE_SECCTX) {
+ if (test_bit(LL_SBI_FILE_SECCTX, sbi->ll_flags)) {
/* selinux_dentry_init_security() uses dentry->d_parent and name
* to determine the security context for the file. So our fake
* dentry should be real enough for this purpose. */
dentry.d_inode = inode;
- if (sbi->ll_flags & LL_SBI_FILE_SECCTX) {
+ if (test_bit(LL_SBI_FILE_SECCTX, sbi->ll_flags)) {
/* no need to protect selinux_inode_setsecurity() by
* inode_lock. Taking it would lead to a client deadlock
* LU-13617
int ll_rmfid(struct file *file, void __user *arg)
{
const struct fid_array __user *ufa = arg;
+ struct inode *inode = file_inode(file);
struct fid_array *lfa = NULL;
size_t size;
unsigned nr;
ENTRY;
if (!capable(CAP_DAC_READ_SEARCH) &&
- !(ll_i2sbi(file_inode(file))->ll_flags & LL_SBI_USER_FID2PATH))
+ !test_bit(LL_SBI_USER_FID2PATH, ll_i2sbi(inode)->ll_flags))
RETURN(-EPERM);
/* Only need to get the buflen */
if (get_user(nr, &ufa->fa_nr))
__u32 __user *lmmsizep = NULL;
struct lu_fid __user *fidp = NULL;
int lmmsize;
+ bool api32;
if (cmd == IOC_MDC_GETFILEINFO_V1 ||
cmd == IOC_MDC_GETFILEINFO_V2 ||
GOTO(out_req, rc = -EFAULT);
rc = -EOVERFLOW;
}
+ api32 = test_bit(LL_SBI_32BIT_API, sbi->ll_flags);
if (cmd == IOC_MDC_GETFILEINFO_V1 ||
cmd == LL_IOC_MDC_GETINFO_V1) {
st.st_uid = body->mbo_uid;
st.st_gid = body->mbo_gid;
st.st_rdev = body->mbo_rdev;
- st.st_size = body->mbo_size;
+ if (llcrypt_require_key(inode) == -ENOKEY)
+ st.st_size = round_up(st.st_size,
+ LUSTRE_ENCRYPTION_UNIT_SIZE);
+ else
+ st.st_size = body->mbo_size;
st.st_blksize = PAGE_SIZE;
st.st_blocks = body->mbo_blocks;
st.st_atime = body->mbo_atime;
st.st_mtime = body->mbo_mtime;
st.st_ctime = body->mbo_ctime;
st.st_ino = cl_fid_build_ino(&body->mbo_fid1,
- sbi->ll_flags &
- LL_SBI_32BIT_API);
+ api32);
if (copy_to_user(statp, &st, sizeof(st)))
GOTO(out_req, rc = -EFAULT);
stx.stx_gid = body->mbo_gid;
stx.stx_mode = body->mbo_mode;
stx.stx_ino = cl_fid_build_ino(&body->mbo_fid1,
- sbi->ll_flags &
- LL_SBI_32BIT_API);
- stx.stx_size = body->mbo_size;
+ api32);
+ if (llcrypt_require_key(inode) == -ENOKEY)
+ stx.stx_size = round_up(stx.stx_size,
+ LUSTRE_ENCRYPTION_UNIT_SIZE);
+ else
+ stx.stx_size = body->mbo_size;
stx.stx_blocks = body->mbo_blocks;
stx.stx_atime.tv_sec = body->mbo_atime;
stx.stx_ctime.tv_sec = body->mbo_ctime;
int len;
char *filename;
int namelen = 0;
+ __u32 flags;
int rc;
rc = obd_ioctl_getdata(&data, &len, (void __user *)arg);
filename = data->ioc_inlbuf1;
namelen = data->ioc_inllen1;
+ flags = data->ioc_type;
if (namelen < 1 || namelen != strlen(filename) + 1) {
CDEBUG(D_INFO, "IOC_MDC_LOOKUP missing filename\n");
GOTO(migrate_free, rc);
}
- rc = ll_migrate(inode, file, lum, filename);
+ rc = ll_migrate(inode, file, lum, filename, flags);
migrate_free:
OBD_FREE_LARGE(data, len);
((api32 && offset <= LL_DIR_END_OFF_32BIT) ||
(!api32 && offset <= LL_DIR_END_OFF))) {
if (offset != file->f_pos) {
+ bool hash64;
+
+ hash64 = test_bit(LL_SBI_64BIT_HASH, sbi->ll_flags);
if ((api32 && offset == LL_DIR_END_OFF_32BIT) ||
(!api32 && offset == LL_DIR_END_OFF))
fd->lfd_pos = MDS_DIR_END_OFF;
- else if (api32 && sbi->ll_flags & LL_SBI_64BIT_HASH)
+ else if (api32 && hash64)
fd->lfd_pos = offset << 32;
else
fd->lfd_pos = offset;