From: tianzy Date: Tue, 6 Jan 2009 04:23:41 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_140~38 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c159c408293fbebf71a948e630aa9f637f3c8ffe Branch HEAD Additional patch for HEAD b=16542 i=yong.fan --- diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 536273d..4d33e83 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -371,6 +371,13 @@ struct dt_object_operations { struct lustre_capa *old, __u64 opc); int (*do_object_sync)(const struct lu_env *, struct dt_object *); + /** + * Get object info of next level. Currently, only get inode from osd. + * This is only used by quota b=16542 + * precondition: dt_object_exists(dt); + */ + int (*do_data_get)(const struct lu_env *env, struct dt_object *dt, + void **data); }; /** diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index 9dd419c..1823fec 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -754,7 +754,7 @@ static inline int lquota_chkquota(quota_interface_t *interface, struct obd_device *obd, unsigned int uid, unsigned int gid, int count, int *flag, struct obd_trans_info *oti, - int isblk, struct inode *inode, int frags) + int isblk, void *data, int frags) { int rc; ENTRY; @@ -763,7 +763,7 @@ static inline int lquota_chkquota(quota_interface_t *interface, QUOTA_CHECK_OP(interface, acquire); rc = QUOTA_OP(interface, chkquota)(obd, uid, gid, count, flag, QUOTA_OP(interface, acquire), oti, - isblk, inode, frags); + isblk, (struct inode *)data, frags); RETURN(rc); } diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index d3edabc..03a9e86 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -675,13 +675,15 @@ static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj, rc = mdd_la_get(env, mdd_tobj, la_tmp, BYPASS_CAPA); if (!rc) { + void *data = NULL; + mdd_data_get(env, mdd_tobj, &data); quota_opc = FSFILT_OP_LINK; mdd_quota_wrapper(la_tmp, qids); /* get block quota for parent */ lquota_chkquota(mds_quota_interface_ref, obd, qids[USRQUOTA], qids[GRPQUOTA], 1, &rec_pending, NULL, LQUOTA_FLAGS_BLK, - NULL, 0); + data, 1); } } #endif @@ -960,13 +962,15 @@ static int mdd_name_insert(const struct lu_env *env, rc = mdd_la_get(env, mdd_obj, la_tmp, BYPASS_CAPA); if (!rc) { + void *data = NULL; + mdd_data_get(env, mdd_obj, &data); quota_opc = FSFILT_OP_LINK; mdd_quota_wrapper(la_tmp, qids); /* get block quota for parent */ lquota_chkquota(mds_quota_interface_ref, obd, qids[USRQUOTA], qids[GRPQUOTA], 1, &rec_pending, NULL, - LQUOTA_FLAGS_BLK, NULL, 0); + LQUOTA_FLAGS_BLK, data, 1); } } else { uc->mu_cap |= CFS_CAP_SYS_RESOURCE_MASK; @@ -1184,13 +1188,15 @@ static int mdd_rename_tgt(const struct lu_env *env, rc = mdd_la_get(env, mdd_tpobj, la_tmp, BYPASS_CAPA); if (!rc) { + void *data = NULL; + mdd_data_get(env, mdd_tpobj, &data); quota_opc = FSFILT_OP_LINK; mdd_quota_wrapper(la_tmp, qpids); /* get block quota for target parent */ lquota_chkquota(mds_quota_interface_ref, obd, qpids[USRQUOTA], qpids[GRPQUOTA], 1, &rec_pending, NULL, LQUOTA_FLAGS_BLK, - NULL, 0); + data, 1); } } #endif @@ -1985,6 +1991,8 @@ static int mdd_rename(const struct lu_env *env, rc = mdd_la_get(env, mdd_tpobj, la_tmp, BYPASS_CAPA); if (!rc) { + void *data = NULL; + mdd_data_get(env, mdd_tpobj, &data); quota_opc = FSFILT_OP_LINK; mdd_quota_wrapper(la_tmp, qtpids); /* get block quota for target parent */ @@ -1993,7 +2001,7 @@ static int mdd_rename(const struct lu_env *env, qtpids[GRPQUOTA], 1, &rec_pending, NULL, LQUOTA_FLAGS_BLK, - NULL, 0); + data, 1); } } } diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index c5a0e64..c855f80 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -222,6 +222,7 @@ int mdd_get_md(const struct lu_env *env, struct mdd_object *obj, void *md, int *md_size, const char *name); int mdd_get_md_locked(const struct lu_env *env, struct mdd_object *obj, void *md, int *md_size, const char *name); +int mdd_data_get(const struct lu_env *env, struct mdd_object *obj, void **data); int mdd_la_get(const struct lu_env *env, struct mdd_object *obj, struct lu_attr *la, struct lustre_capa *capa); int mdd_attr_set_internal(const struct lu_env *env, @@ -638,6 +639,15 @@ static inline int mdd_permission_internal_locked(const struct lu_env *env, return __mdd_permission_internal(env, obj, la, mask, role); } +static inline int mdo_data_get(const struct lu_env *env, + struct mdd_object *obj, + void **data) +{ + struct dt_object *next = mdd_object_child(obj); + next->do_ops->do_data_get(env, next, data); + return 0; +} + /* mdd inline func for calling osd_dt_object ops */ static inline int mdo_attr_get(const struct lu_env *env, struct mdd_object *obj, struct lu_attr *la, struct lustre_capa *capa) diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 588247d..0cf918a 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -67,6 +67,15 @@ static int mdd_xattr_get(const struct lu_env *env, struct md_object *obj, struct lu_buf *buf, const char *name); +int mdd_data_get(const struct lu_env *env, struct mdd_object *obj, + void **data) +{ + LASSERTF(mdd_object_exists(obj), "FID is "DFID"\n", + PFID(mdd_object_fid(obj))); + mdo_data_get(env, obj, data); + return 0; +} + int mdd_la_get(const struct lu_env *env, struct mdd_object *obj, struct lu_attr *la, struct lustre_capa *capa) { @@ -1248,14 +1257,17 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj, qnids[USRQUOTA], qnids[GRPQUOTA], 1, &inode_pending, NULL, 0, NULL, 0); block_count = (la_tmp->la_blocks + 7) >> 3; - if (block_count) + if (block_count) { + void *data = NULL; + mdd_data_get(env, mdd_obj, &data); /* get block quota for new owner */ lquota_chkquota(mds_quota_interface_ref, obd, qnids[USRQUOTA], qnids[GRPQUOTA], block_count, &block_pending, NULL, LQUOTA_FLAGS_BLK, - NULL, 0); + data, 1); + } } } #endif diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index 44178ee..960b097 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -573,7 +573,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, * decide if it is out of quota or not b=14783 */ lquota_chkquota(filter_quota_interface_ref, obd, oa->o_uid, oa->o_gid, niocount, &rec_pending, oti, - LQUOTA_FLAGS_BLK, inode, obj->ioo_bufcnt); + LQUOTA_FLAGS_BLK, (void *)inode, obj->ioo_bufcnt); iobuf = filter_iobuf_get(&obd->u.filter, oti); if (IS_ERR(iobuf)) diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 9375453..97452a6 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -2079,6 +2079,16 @@ static int osd_object_sync(const struct lu_env *env, struct dt_object *dt) RETURN(rc); } +static int osd_data_get(const struct lu_env *env, struct dt_object *dt, + void **data) +{ + struct osd_object *obj = osd_dt_obj(dt); + ENTRY; + + *data = (void *)obj->oo_inode; + RETURN(0); +} + static const struct dt_object_operations osd_obj_ops = { .do_read_lock = osd_object_read_lock, .do_write_lock = osd_object_write_lock, @@ -2097,6 +2107,7 @@ static const struct dt_object_operations osd_obj_ops = { .do_xattr_list = osd_xattr_list, .do_capa_get = osd_capa_get, .do_object_sync = osd_object_sync, + .do_data_get = osd_data_get, }; /** @@ -2121,6 +2132,7 @@ static const struct dt_object_operations osd_obj_ea_ops = { .do_xattr_list = osd_xattr_list, .do_capa_get = osd_capa_get, .do_object_sync = osd_object_sync, + .do_data_get = osd_data_get, }; /* diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index 5cf9505..f257cd5 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -287,14 +287,17 @@ static int quota_check_common(struct obd_device *obd, unsigned int uid, /* in order to complete this write, we need extra * meta blocks. This function can get it through * data needed to be written b=16542 */ - mb = *pending; - LASSERT(inode && frags > 0); - if (fsfilt_get_mblk(obd, qctxt->lqc_sb, &mb, - inode, frags) < 0) - CDEBUG(D_ERROR, - "can't get extra meta blocks.\n"); - else - *pending += mb; + if (inode) { + mb = *pending; + rc = fsfilt_get_mblk(obd, qctxt->lqc_sb, + &mb, inode,frags); + if (rc) + CDEBUG(D_ERROR, + "can't get extra " + "meta blocks.\n"); + else + *pending += mb; + } lqs->lqs_bwrite_pending += *pending; } else { *pending = count; diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 1410a03..e1cb070 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -18,7 +18,7 @@ export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin ONLY=${ONLY:-"$*"} # enable test_23 after bug 16542 fixed. -ALWAYS_EXCEPT="10 23 $SANITY_QUOTA_EXCEPT" +ALWAYS_EXCEPT="10 $SANITY_QUOTA_EXCEPT" # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! case `uname -r` in