Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 553ed75d authored by Niu Yawei's avatar Niu Yawei Committed by Greg Kroah-Hartman
Browse files

staging: lustre: clio: sync write should update mtime



Sync write should update m/ctime promptly, otherwise, stale m/ctime
could be updated on the OST object by the sync write RPC.

Signed-off-by: default avatarNiu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7310
Reviewed-on: http://review.whamcloud.com/21063


Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarBobi Jam <bobijam@hotmail.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c843ce20
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -210,6 +210,18 @@ static int osc_io_submit(const struct lu_env *env,
	if (queued > 0)
	if (queued > 0)
		result = osc_queue_sync_pages(env, osc, &list, cmd, brw_flags);
		result = osc_queue_sync_pages(env, osc, &list, cmd, brw_flags);


	/* Update c/mtime for sync write. LU-7310 */
	if (qout->pl_nr > 0 && !result) {
		struct cl_attr *attr = &osc_env_info(env)->oti_attr;
		struct cl_object *obj = ios->cis_obj;

		cl_object_attr_lock(obj);
		attr->cat_mtime = LTIME_S(CURRENT_TIME);
		attr->cat_ctime = attr->cat_mtime;
		cl_object_attr_update(env, obj, attr, CAT_MTIME | CAT_CTIME);
		cl_object_attr_unlock(obj);
	}

	CDEBUG(D_INFO, "%d/%d %d\n", qin->pl_nr, qout->pl_nr, result);
	CDEBUG(D_INFO, "%d/%d %d\n", qin->pl_nr, qout->pl_nr, result);
	return qout->pl_nr > 0 ? 0 : result;
	return qout->pl_nr > 0 ? 0 : result;
}
}