@@ -423,6 +423,7 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
},
};
bool encrypt = false;
+ int hash_flags;
int err;
if (unlikely(!lmv_user_magic_supported(lump->lum_magic)))
@@ -463,6 +464,10 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
LMV_HASH_TYPE_FNV_1A_64;
}
+ hash_flags = lump->lum_hash_type & ~LMV_HASH_TYPE_MASK;
+ if (hash_flags & ~LMV_HASH_FLAG_KNOWN)
+ return -EINVAL;
+
if (unlikely(!lmv_user_magic_supported(cpu_to_le32(lump->lum_magic))))
lustre_swab_lmv_user_md(lump);
@@ -3973,6 +3973,7 @@ static int ll_heat_set(struct inode *inode, enum lu_heat_flag flags)
case LL_IOC_HSM_ACTION: {
struct md_op_data *op_data;
struct hsm_current_action *hca;
+ const char *action;
int rc;
hca = kzalloc(sizeof(*hca), GFP_KERNEL);
@@ -3988,10 +3989,26 @@ static int ll_heat_set(struct inode *inode, enum lu_heat_flag flags)
rc = obd_iocontrol(cmd, ll_i2mdexp(inode), sizeof(*op_data),
op_data, NULL);
+ if (rc < 0)
+ goto skip_copy;
+
+ /* The hsm_current_action retreived from the server could
+ * contain corrupt information. If it is incorrect data collect
+ * debug information. We still send the data even if incorrect
+ * to user land to handle.
+ */
+ action = hsm_user_action2name(hca->hca_action);
+ if (strcmp(action, "UNKNOWN") == 0 ||
+ hca->hca_state > HPS_DONE) {
+ CDEBUG(D_HSM,
+ "HSM current state %s action %s, offset = %llu, length %llu\n",
+ hsm_progress_state2name(hca->hca_state), action,
+ hca->hca_location.offset, hca->hca_location.length);
+ }
if (copy_to_user((char __user *)arg, hca, sizeof(*hca)))
rc = -EFAULT;
-
+skip_copy:
ll_finish_md_op_data(op_data);
kfree(hca);
return rc;
@@ -1908,6 +1908,11 @@ void lustre_assert_wire_constants(void)
LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
(long long)(int)sizeof(union lquota_id));
+ LASSERTF(QIF_DQBLKSIZE_BITS == 10, "found %lld\n",
+ (long long)QIF_DQBLKSIZE_BITS);
+ LASSERTF(QIF_DQBLKSIZE == 1024, "found %lld\n",
+ (long long)QIF_DQBLKSIZE);
+
/* Checks for struct obd_quotactl */
LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
(long long)(int)sizeof(struct obd_quotactl));
@@ -1877,6 +1877,26 @@ enum hsm_states {
*/
#define HSM_FLAGS_MASK (HSM_USER_MASK | HSM_STATUS_MASK)
+/**
+ * HSM request progress state
+ */
+enum hsm_progress_states {
+ HPS_NONE = 0,
+ HPS_WAITING = 1,
+ HPS_RUNNING = 2,
+ HPS_DONE = 3,
+};
+
+static inline const char *hsm_progress_state2name(enum hsm_progress_states s)
+{
+ switch (s) {
+ case HPS_WAITING: return "waiting";
+ case HPS_RUNNING: return "running";
+ case HPS_DONE: return "done";
+ default: return "unknown";
+ }
+}
+
struct hsm_extent {
__u64 offset;
__u64 length;