[LU-5976] Remove quota compatibility with Lustre 1.8 Created: 03/Dec/14  Updated: 11/Aug/15  Resolved: 11/Aug/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.8.0
Fix Version/s: Lustre 2.8.0

Type: Bug Priority: Minor
Reporter: James Nunez (Inactive) Assignee: Niu Yawei (Inactive)
Resolution: Duplicate Votes: 0
Labels: quota

Issue Links:
Related
is related to LU-6617 Remove quota migration code Resolved
is related to LU-540 fix interop issues with lustre_user.h Resolved
Severity: 3
Rank (Obsolete): 16689

 Description   

In Lustre 2.8, tag 2.7.53 and above, we drop compatibility with the old quota struct used in Lustre 1.8. If it is not desirable to drop quota compatibility with Lustre 1.8, the following code and structures should be modified, else the code can be removed.

In file lustre/llite/dir.c, ll_dir_ioctl():

#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0)
        case LL_IOC_QUOTACTL_18: {
                /* copy the old 1.x quota struct for internal use, then copy
                 * back into old format struct.  For 1.8 compatibility. */
               struct if_quotactl_18 *qctl_18;
                struct if_quotactl *qctl_20;

                OBD_ALLOC_PTR(qctl_18);
                if (!qctl_18)
                        RETURN(-ENOMEM);

                OBD_ALLOC_PTR(qctl_20);
                if (!qctl_20)
                        GOTO(out_quotactl_18, rc = -ENOMEM);

		if (copy_from_user(qctl_18, (void *)arg, sizeof(*qctl_18)))
                        GOTO(out_quotactl_20, rc = -ENOMEM);

                QCTL_COPY(qctl_20, qctl_18);
                qctl_20->qc_idx = 0;

                /* XXX: dqb_valid was borrowed as a flag to mark that
                 *      only mds quota is wanted */
                if (qctl_18->qc_cmd == Q_GETQUOTA &&
                    qctl_18->qc_dqblk.dqb_valid) {
                        qctl_20->qc_valid = QC_MDTIDX;
                        qctl_20->qc_dqblk.dqb_valid = 0;
                } else if (qctl_18->obd_uuid.uuid[0] != '\0') {
                        qctl_20->qc_valid = QC_UUID;
                        qctl_20->obd_uuid = qctl_18->obd_uuid;
                } else {
                        qctl_20->qc_valid = QC_GENERAL;
                }

                rc = quotactl_ioctl(sbi, qctl_20);

                if (rc == 0) {
                        QCTL_COPY(qctl_18, qctl_20);
                        qctl_18->obd_uuid = qctl_20->obd_uuid;

			if (copy_to_user((void *)arg, qctl_18,
                                             sizeof(*qctl_18)))
                                rc = -EFAULT;
                }

        out_quotactl_20:
                OBD_FREE_PTR(qctl_20);
        out_quotactl_18:
                OBD_FREE_PTR(qctl_18);
                RETURN(rc);
        }
#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0) */

In file lustre/llite/llite_internal.h, in the definition of struct if_quotacl_18:

#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0)
/* Compatibility for old (1.8) compiled userspace quota code */
struct if_quotactl_18 {
	__u32			qc_cmd;
	__u32			qc_type;
	__u32			qc_id;
	__u32			qc_stat;
	struct obd_dqinfo	qc_dqinfo;
	struct obd_dqblk	qc_dqblk;
	char			obd_type[16];
	struct obd_uuid		obd_uuid;
};
#define LL_IOC_QUOTACTL_18              _IOWR('f', 162, struct if_quotactl_18 *)
/* End compatibility for old (1.8) compiled userspace quota code */
#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0) */


 Comments   
Comment by Peter Jones [ 10/Aug/15 ]

Niu

Did you already handle this under LU-6617?

Peter

Comment by Niu Yawei (Inactive) [ 11/Aug/15 ]

Yes, it was fixed in LU-6617.

Generated at Sat Feb 10 01:56:08 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.