@@ -509,6 +509,7 @@ extern char obd_jobid_var[];
#define OBD_FAIL_LFSCK_NO_DOUBLESCAN 0x160c
#define OBD_FAIL_LFSCK_INVALID_PFID 0x1619
#define OBD_FAIL_LFSCK_BAD_NAME_HASH 0x1628
+#define OBD_FAIL_LFSCK_NO_ENCFLAG 0x1632
/* UPDATE */
#define OBD_FAIL_UPDATE_OBJ_NET 0x1700
@@ -5338,6 +5338,11 @@ int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask,
stat->attributes_mask |= STATX_ATTR_ENCRYPTED;
#endif
stat->attributes |= ll_inode_to_ext_flags(inode->i_flags);
+ /* if Lustre specific LUSTRE_ENCRYPT_FL flag is set, also set
+ * ext4 equivalent to please statx
+ */
+ if (stat->attributes & LUSTRE_ENCRYPT_FL)
+ stat->attributes |= STATX_ATTR_ENCRYPTED;
stat->result_mask &= request_mask;
ll_stats_ops_tally(sbi, LPROC_LL_GETATTR,
@@ -2873,6 +2873,11 @@ int ll_iocontrol(struct inode *inode, struct file *file,
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
flags = body->mbo_flags;
+ /* if Lustre specific LUSTRE_ENCRYPT_FL flag is set, also set
+ * ext4 equivalent to please lsattr and other e2fsprogs tools
+ */
+ if (flags & LUSTRE_ENCRYPT_FL)
+ flags |= STATX_ATTR_ENCRYPTED;
ptlrpc_req_finished(req);
@@ -1792,6 +1792,16 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
else /* short i/o */
ioobj_max_brw_set(ioobj, 0);
+ if (inode && IS_ENCRYPTED(inode) &&
+ fscrypt_has_encryption_key(inode) &&
+ !OBD_FAIL_CHECK(OBD_FAIL_LFSCK_NO_ENCFLAG)) {
+ if ((body->oa.o_valid & OBD_MD_FLFLAGS) == 0) {
+ body->oa.o_valid |= OBD_MD_FLFLAGS;
+ body->oa.o_flags = 0;
+ }
+ body->oa.o_flags |= LUSTRE_ENCRYPT_FL;
+ }
+
if (short_io_size != 0) {
if ((body->oa.o_valid & OBD_MD_FLFLAGS) == 0) {
body->oa.o_valid |= OBD_MD_FLFLAGS;