Prevent concurrent setstripe and chown() operations on a file by
acquiring mot_lov_mutex in mdt_attr_set(). This is needed to maintain
consistency between the ownership of files and their sub-objects and
to ensure that attribute changes on sub-objects are properly declared.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I75fe3476a284dccde5312a5c3f79b3698610ef25
Reviewed-on: http://review.whamcloud.com/6070
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
GOTO(out_unlock, rc);
}
+ /* Ensure constant striping during chown(). See LU-2789. */
+ if (ma->ma_attr.la_valid & (LA_UID|LA_GID))
+ mutex_lock(&mo->mot_lov_mutex);
+
/* all attrs are packed into mti_attr in unpack_setattr */
rc = mo_attr_set(info->mti_env, mdt_object_child(mo), ma);
+
+ if (ma->ma_attr.la_valid & (LA_UID|LA_GID))
+ mutex_unlock(&mo->mot_lov_mutex);
+
if (rc != 0)
GOTO(out_unlock, rc);