struct lu_attr *attr, struct thandle *handle,
const struct md_op_spec *spec)
{
- int rc;
- ENTRY;
-
- /*
- * Update attributes for child.
- *
- * FIXME:
- * (1) the valid bits should be converted between Lustre and Linux;
- * (2) maybe, the child attributes should be set in OSD when creation.
- */
+ int rc = 0;
+ ENTRY;
- rc = mdd_attr_set_internal(env, child, attr, handle, 0);
- /* arguments are supposed to stay the same */
if (S_ISDIR(attr->la_mode)) {
/* Add "." and ".." for newly created dir */
mdo_ref_add(env, child, handle);
struct lu_object_header opo_header;
struct dt_object opo_obj;
unsigned int opo_reserved:1,
- opo_new:1,
opo_non_exist:1;
/* read/write lock for md osp object */
RETURN(0);
if (!is_only_remote_trans(th)) {
- if (o->opo_new)
- /* no need in logging for new objects being created */
- RETURN(0);
-
/*
* track all UID/GID changes via llog
*/
if (is_only_remote_trans(th)) {
rc = __osp_attr_set(env, dt, attr, th);
- if (rc == 0 && o->opo_new)
- o->opo_new = 0;
-
RETURN(rc);
}
if (!(attr->la_valid & (LA_UID | LA_GID)))
RETURN(0);
- /* new object, the very first ->attr_set()
- * initializing attributes needs no logging
- * all subsequent one are subject to the
- * logging and synchronization with OST */
- if (o->opo_new) {
- o->opo_new = 0;
- RETURN(0);
- }
-
rc = osp_sync_add(env, o, MDS_SETATTR64_REC, th, attr);
/* XXX: send new uid/gid to OST ASAP? */
}
}
- /* new object, the very first ->attr_set()
- * initializing attributes needs no logging */
- o->opo_new = 1;
-
/* Only need update last_used oid file, seq file will only be update
* during seq rollover */
osp_objid_buf_prep(&osi->osi_lb, &osi->osi_off,
}
run_test 36 "Migrate old admin files into new global indexes"
+# chown/chgrp to the file created with MDS_OPEN_DELAY_CREATE
+# LU-5006
+test_37() {
+ setup_quota_test
+ trap cleanup_quota_test EXIT
+
+ # make sure the system is clean
+ local USED=$(getquota -u $TSTID global curspace)
+ [ $USED -ne 0 ] &&
+ error "Used space ($USED) for user $TSTID isn't 0."
+
+ # create file with MDS_OPEN_DELAY_CREATE flag
+ $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile ||
+ error "Create file failed"
+ # write to file
+ dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=1 conv=notrunc \
+ oflag=sync || error "Write file failed"
+ # chown to the file
+ chown $TSTID $DIR/$tdir/$tfile || error "Chown to file failed"
+
+ # wait for setattr on objects finished..."
+ wait_delete_completed
+
+ USED=$(getquota -u $TSTID global curspace)
+ [ $USED -ne 0 ] || quota_error u $TSTUSR "Used space is 0"
+
+ cleanup_quota_test
+}
+run_test 37 "Quota accounted properly for file created by 'lfs setstripe'"
+
quota_fini()
{
do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"