Whamcloud - gitweb
LU-15910 llite: use max default EA size to get default LMV
[fs/lustre-release.git] / lustre / llite / dir.c
index f6e4779..1892c65 100644 (file)
@@ -469,9 +469,10 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
 
        if (lump->lum_magic != LMV_MAGIC_FOREIGN) {
                CDEBUG(D_VFSTRACE,
-                      "VFS Op:inode="DFID"(%p) name %s stripe_offset %d, stripe_count: %u\n",
+                      "VFS Op:inode="DFID"(%p) name=%s stripe_offset=%d stripe_count=%u, hash_type=%x\n",
                       PFID(ll_inode2fid(parent)), parent, dirname,
-                      (int)lump->lum_stripe_offset, lump->lum_stripe_count);
+                      (int)lump->lum_stripe_offset, lump->lum_stripe_count,
+                      lump->lum_hash_type);
        } else {
                struct lmv_foreign_md *lfm = (struct lmv_foreign_md *)lump;
 
@@ -492,7 +493,9 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
        /* MDS < 2.14 doesn't support 'crush' hash type, and cannot handle
         * unknown hash if client doesn't set a valid one. switch to fnv_1a_64.
         */
-       if (!(exp_connect_flags2(sbi->ll_md_exp) & OBD_CONNECT2_CRUSH)) {
+       if (CFS_FAIL_CHECK(OBD_FAIL_LMV_UNKNOWN_STRIPE)) {
+               lump->lum_hash_type = cfs_fail_val;
+       } else if (!(exp_connect_flags2(sbi->ll_md_exp) & OBD_CONNECT2_CRUSH)) {
                enum lmv_hash_type type = lump->lum_hash_type &
                                          LMV_HASH_TYPE_MASK;
 
@@ -695,18 +698,15 @@ int ll_dir_get_default_layout(struct inode *inode, void **plmm, int *plmm_size,
        struct mdt_body   *body;
        struct lov_mds_md *lmm = NULL;
        struct ptlrpc_request *req = NULL;
-       int rc, lmm_size;
+       int lmm_size = OBD_MAX_DEFAULT_EA_SIZE;
        struct md_op_data *op_data;
        struct lu_fid fid;
-       ENTRY;
+       int rc;
 
-       rc = ll_get_default_mdsize(sbi, &lmm_size);
-       if (rc)
-               RETURN(rc);
+       ENTRY;
 
-       op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL,
-                                    0, lmm_size, LUSTRE_OPC_ANY,
-                                    NULL);
+       op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, lmm_size,
+                                    LUSTRE_OPC_ANY, NULL);
        if (IS_ERR(op_data))
                RETURN(PTR_ERR(op_data));
 
@@ -1236,34 +1236,33 @@ int quotactl_ioctl(struct super_block *sb, struct if_quotactl *qctl)
                else
                        RETURN(-EINVAL);
 
-                switch (valid) {
-                case QC_MDTIDX:
-                        rc = obd_iocontrol(OBD_IOC_QUOTACTL, sbi->ll_md_exp,
-                                           sizeof(*qctl), qctl, NULL);
-                        break;
-                case QC_OSTIDX:
-                        rc = obd_iocontrol(OBD_IOC_QUOTACTL, sbi->ll_dt_exp,
-                                           sizeof(*qctl), qctl, NULL);
-                        break;
-                case QC_UUID:
-                        rc = obd_iocontrol(OBD_IOC_QUOTACTL, sbi->ll_md_exp,
-                                           sizeof(*qctl), qctl, NULL);
-                        if (rc == -EAGAIN)
-                                rc = obd_iocontrol(OBD_IOC_QUOTACTL,
-                                                   sbi->ll_dt_exp,
-                                                   sizeof(*qctl), qctl, NULL);
-                        break;
-                default:
-                        rc = -EINVAL;
-                        break;
-                }
-
-                if (rc)
-                        RETURN(rc);
+               switch (valid) {
+               case QC_MDTIDX:
+                       rc = obd_iocontrol(OBD_IOC_QUOTACTL, sbi->ll_md_exp,
+                                          sizeof(*qctl), qctl, NULL);
+                       break;
+               case QC_OSTIDX:
+                       rc = obd_iocontrol(OBD_IOC_QUOTACTL, sbi->ll_dt_exp,
+                                          sizeof(*qctl), qctl, NULL);
+                       break;
+               case QC_UUID:
+                       rc = obd_iocontrol(OBD_IOC_QUOTACTL, sbi->ll_md_exp,
+                                          sizeof(*qctl), qctl, NULL);
+                       if (rc == -EAGAIN)
+                               rc = obd_iocontrol(OBD_IOC_QUOTACTL,
+                                                  sbi->ll_dt_exp,
+                                                  sizeof(*qctl), qctl, NULL);
+                       break;
+               default:
+                       rc = -EINVAL;
+                       break;
+               }
 
-                qctl->qc_cmd = cmd;
-        } else {
-                struct obd_quotactl *oqctl;
+               qctl->qc_cmd = cmd;
+               if (rc)
+                       RETURN(rc);
+       } else {
+               struct obd_quotactl *oqctl;
                int oqctl_len = sizeof(*oqctl);
 
                if (LUSTRE_Q_CMD_IS_POOL(cmd))
@@ -2030,7 +2029,7 @@ out_req:
                }
 
                rc = quotactl_ioctl(inode->i_sb, qctl);
-               if (rc == 0 &&
+               if ((rc == 0 || rc == -ENODATA) &&
                    copy_to_user((void __user *)arg, qctl, sizeof(*qctl)))
                         rc = -EFAULT;