From: John L. Hammond Date: Tue, 16 Apr 2013 22:00:34 +0000 (-0500) Subject: LU-2789 mdt: ensure constant striping during chown() X-Git-Tag: 2.5.53~18 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F6070%2F2;p=fs%2Flustre-release.git LU-2789 mdt: ensure constant striping during chown() 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 Change-Id: I75fe3476a284dccde5312a5c3f79b3698610ef25 Reviewed-on: http://review.whamcloud.com/6070 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Nunez Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 7e89ad6..50f3efa 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -434,8 +434,16 @@ int mdt_attr_set(struct mdt_thread_info *info, struct mdt_object *mo, 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);