* (Un)packing of OST/MDS requests
*
*/
-
+#ifndef EXPORT_SYMTAB
+# define EXPORT_SYMTAB
+#endif
#define DEBUG_SUBSYSTEM S_LOV
#ifndef __KERNEL__
#include <liblustre.h>
if (lsm) {
if (lsm->lsm_magic != LOV_MAGIC) {
- CERROR("bad mem LOV MAGIC: 0x%08X != 0x%08X\n",
+ CWARN("bad LOV MAGIC: 0x%08X != 0x%08X\n",
lsm->lsm_magic, LOV_MAGIC);
RETURN(-EINVAL);
}
if (lmm_bytes < lov_mds_md_v0_size(*stripe_count)) {
CERROR("LOV EA too small: %d, need %d\n",
- lmm_bytes, lov_mds_md_size(*stripe_count));
+ lmm_bytes, lov_mds_md_v0_size(*stripe_count));
lov_dump_lmm_v0(D_WARNING, lmm);
return -EINVAL;
}
return -EINVAL;
}
- if (lmm_bytes < lov_mds_md_size(*stripe_count)) {
+ if (lmm_bytes < lov_mds_md_v1_size(*stripe_count)) {
CERROR("LOV EA too small: %d, need %d\n",
- lmm_bytes, lov_mds_md_size(*stripe_count));
+ lmm_bytes, lov_mds_md_v1_size(*stripe_count));
lov_dump_lmm_v1(D_WARNING, lmm);
return -EINVAL;
}
return lsm_size;
}
+EXPORT_SYMBOL(lov_alloc_memmd);
void lov_free_memmd(struct lov_stripe_md **lsmp)
{
OBD_FREE(*lsmp, lov_stripe_md_size((*lsmp)->lsm_stripe_count));
*lsmp = NULL;
}
+EXPORT_SYMBOL(lov_free_memmd);
int lov_unpackmd_v0(struct lov_obd *lov, struct lov_stripe_md *lsm,
struct lov_mds_md_v0 *lmm)
loi->loi_gr = le64_to_cpu(lmm->lmm_objects[i].l_object_gr);
loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx);
loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen);
- if (loi->loi_ost_idx > lov->desc.ld_tgt_count) {
+ if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) {
CERROR("OST index %d more than OST count %d\n",
loi->loi_ost_idx, lov->desc.ld_tgt_count);
lov_dump_lmm_v1(D_WARNING, lmm);
}
int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
- struct lov_user_md *lump)
+ struct lov_user_md *lump)
{
int i;
int rc;
/* User wasn't expecting this many OST entries */
if (lum.lmm_stripe_count == 0) {
- if (copy_to_user(lump, lmmk, sizeof(lum)))
+ rc = copy_to_user(lump, lmmk, sizeof(lum));
+ if (rc)
rc = -EFAULT;
} else if (lum.lmm_stripe_count < lmmk->lmm_stripe_count) {
rc = -EOVERFLOW;