- err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr, &request);
- if (err)
- CERROR("mdc_setattr fails (%d)\n", err);
-
- ptlrpc_req_finished(request);
+ /* Don't send size changes to MDS to avoid "fast EA" problems, and
+ * also avoid a pointless RPC (we get file size from OST anyways).
+ */
+ attr->ia_valid &= ~ATTR_SIZE;
+ if (attr->ia_valid) {
+ err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr, NULL, 0,
+ &request);
+ if (err)
+ CERROR("mdc_setattr fails: err = %d\n", err);
+
+ ptlrpc_req_finished(request);
+ if (S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_MTIME_SET) {
+ struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
+ struct obdo oa;
+ int err2;
+
+ CDEBUG(D_ERROR, "setting mtime on OST\n");
+ oa.o_id = lsm->lsm_object_id;
+ oa.o_mode = S_IFREG;
+ oa.o_valid = OBD_MD_FLID |OBD_MD_FLTYPE |OBD_MD_FLMTIME;
+ oa.o_mtime = attr->ia_mtime.tv_sec;
+ err2 = obd_setattr(&sbi->ll_osc_conn, &oa, lsm, NULL);
+ if (err2) {
+ CERROR("obd_setattr fails: rc=%d\n", err);
+ if (!err)
+ err = err2;
+ }
+ }
+ }