Whamcloud - gitweb
LU-9611 lov: allow lov.*.stripe{size,count}=-1 param 46/27946/5
authorAndreas Dilger <andreas.dilger@intel.com>
Thu, 6 Jul 2017 06:55:08 +0000 (00:55 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 6 Nov 2017 03:42:58 +0000 (03:42 +0000)
Since LU-7344 patch http://review.whamcloud.com/16930 was landed,
lov_stripeoffset_seq_write() and lov_stripecount_seq_write() have
incorrectly checked that lov.*.stripecount and lov.*.stripeoffset
are not negative.  In fact they can both be "-1" to indicate that
the filesystem-wide default value should be used. These parameters
can also be set internally if using "lfs setstripe -c -1 $MOUNT"
or "lfs setstripe -i -1 $MOUNT" to set the system wide default,
generating console errors on the MDS from class_process_proc_param():

    lov.: error writing proc entry 'stripecount': rc = -34
    lov.: error writing proc entry 'stripeoffset': rc = -34

Fix these functions to allow "-1" as a valid value.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I295d2591d535b039634689524a29725e963ebbe5
Reviewed-on: https://review.whamcloud.com/27946
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/lod/lproc_lod.c
lustre/lov/lproc_lov.c
lustre/obdclass/obd_config.c

index 9d76020..b8763df 100644 (file)
@@ -2046,17 +2046,17 @@ struct mdt_rec_reint {
 
 /* lmv structures */
 struct lmv_desc {
-        __u32 ld_tgt_count;                /* how many MDS's */
-        __u32 ld_active_tgt_count;         /* how many active */
-        __u32 ld_default_stripe_count;     /* how many objects are used */
-       __u32 ld_pattern;                  /* default hash pattern */
-        __u64 ld_default_hash_size;
-        __u64 ld_padding_1;                /* also fix lustre_swab_lmv_desc */
-        __u32 ld_padding_2;                /* also fix lustre_swab_lmv_desc */
-        __u32 ld_qos_maxage;               /* in second */
-        __u32 ld_padding_3;                /* also fix lustre_swab_lmv_desc */
-        __u32 ld_padding_4;                /* also fix lustre_swab_lmv_desc */
-        struct obd_uuid ld_uuid;
+       __u32 ld_tgt_count;             /* how many MDS's */
+       __u32 ld_active_tgt_count;      /* how many active */
+       __u32 ld_default_stripe_count;  /* how many objects are used */
+       __u32 ld_pattern;               /* default hash pattern */
+       __u64 ld_default_hash_size;
+       __u64 ld_padding_1;             /* also fix lustre_swab_lmv_desc */
+       __u32 ld_padding_2;             /* also fix lustre_swab_lmv_desc */
+       __u32 ld_qos_maxage;            /* in second */
+       __u32 ld_padding_3;             /* also fix lustre_swab_lmv_desc */
+       __u32 ld_padding_4;             /* also fix lustre_swab_lmv_desc */
+       struct obd_uuid ld_uuid;
 };
 
 /* LMV layout EA, and it will be stored both in master and slave object */
@@ -2227,17 +2227,17 @@ typedef enum {
 
 /* LOV settings descriptor (should only contain static info) */
 struct lov_desc {
-        __u32 ld_tgt_count;                /* how many OBD's */
-        __u32 ld_active_tgt_count;         /* how many active */
-        __u32 ld_default_stripe_count;     /* how many objects are used */
-        __u32 ld_pattern;                  /* default PATTERN_RAID0 */
-        __u64 ld_default_stripe_size;      /* in bytes */
-        __u64 ld_default_stripe_offset;    /* in bytes */
-        __u32 ld_padding_0;                /* unused */
-        __u32 ld_qos_maxage;               /* in second */
-        __u32 ld_padding_1;                /* also fix lustre_swab_lov_desc */
-        __u32 ld_padding_2;                /* also fix lustre_swab_lov_desc */
-        struct obd_uuid ld_uuid;
+       __u32 ld_tgt_count;             /* how many OBD's */
+       __u32 ld_active_tgt_count;      /* how many active */
+       __s32 ld_default_stripe_count;  /* how many objects are used */
+       __u32 ld_pattern;               /* default PATTERN_RAID0 */
+       __u64 ld_default_stripe_size;   /* in bytes */
+       __s64 ld_default_stripe_offset; /* starting OST index */
+       __u32 ld_padding_0;             /* unused */
+       __u32 ld_qos_maxage;            /* in second */
+       __u32 ld_padding_1;             /* also fix lustre_swab_lov_desc */
+       __u32 ld_padding_2;             /* also fix lustre_swab_lov_desc */
+       struct obd_uuid ld_uuid;
 };
 
 #define ld_magic ld_active_tgt_count       /* for swabbing from llogs */
index 8003fb6..ea17bac 100644 (file)
@@ -120,8 +120,7 @@ static int lod_stripeoffset_seq_show(struct seq_file *m, void *v)
 
        LASSERT(dev != NULL);
        lod  = lu2lod_dev(dev->obd_lu_dev);
-       seq_printf(m, "%llu\n",
-                  lod->lod_desc.ld_default_stripe_offset);
+       seq_printf(m, "%lld\n", lod->lod_desc.ld_default_stripe_offset);
        return 0;
 }
 
@@ -151,7 +150,7 @@ lod_stripeoffset_seq_write(struct file *file, const char __user *buffer,
 
        LASSERT(dev != NULL);
        lod  = lu2lod_dev(dev->obd_lu_dev);
-       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
+       rc = lprocfs_str_to_s64(buffer, count, &val);
        if (rc)
                return rc;
        if (val < -1)
index 1a18e40..fb91183 100644 (file)
@@ -82,7 +82,7 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v)
 
        LASSERT(dev != NULL);
        desc = &dev->u.lov.desc;
-       seq_printf(m, "%llu\n", desc->ld_default_stripe_offset);
+       seq_printf(m, "%lld\n", desc->ld_default_stripe_offset);
        return 0;
 }
 
@@ -100,7 +100,7 @@ static ssize_t lov_stripeoffset_seq_write(struct file *file,
        rc = lprocfs_str_to_s64(buffer, count, &val);
        if (rc)
                return rc;
-       if (val < 0)
+       if (val < -1)
                return -ERANGE;
 
        desc->ld_default_stripe_offset = val;
@@ -172,7 +172,7 @@ static ssize_t lov_stripecount_seq_write(struct file *file,
        rc = lprocfs_str_to_s64(buffer, count, &val);
        if (rc)
                return rc;
-       if (val < 0)
+       if (val < -1)
                return -ERANGE;
 
        stripe_count = val;
index 81754de..ea7f631 100644 (file)
@@ -1371,12 +1371,12 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
                        /* rc = -EINVAL;        continue parsing other params */
                        skip++;
                } else if (rc < 0) {
-                       CERROR("%s: error writing proc '%s'='%s': rc = %d\n",
-                              lustre_cfg_string(lcfg, 0), key, sval, rc);
+                       CERROR("%s: error writing parameter '%s': rc = %d\n",
+                              lustre_cfg_string(lcfg, 0), key, rc);
                        rc = 0;
                } else {
-                       CDEBUG(D_CONFIG, "%s: Set parameter '%s'='%s'\n",
-                              lustre_cfg_string(lcfg, 0), key, sval);
+                       CDEBUG(D_CONFIG, "%s: set parameter '%s'\n",
+                              lustre_cfg_string(lcfg, 0), key);
                }
        }