Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-3467 mdt: call MDT handlers via unified request handler
[fs/lustre-release.git]
/
lustre
/
mdd
/
mdd_object.c
diff --git
a/lustre/mdd/mdd_object.c
b/lustre/mdd/mdd_object.c
index
824c92f
..
12a8166
100644
(file)
--- a/
lustre/mdd/mdd_object.c
+++ b/
lustre/mdd/mdd_object.c
@@
-102,6
+102,7
@@
struct mdd_thread_info *mdd_env_info(const struct lu_env *env)
{
struct mdd_thread_info *info;
+ lu_env_refill((struct lu_env *)env);
info = lu_context_key_get(&env->le_ctx, &mdd_thread_key);
LASSERT(info != NULL);
return info;
@@
-173,7
+174,6
@@
static int mdd_object_init(const struct lu_env *env, struct lu_object *o,
mdd_obj->mod_cltime = 0;
under = &d->mdd_child->dd_lu_dev;
below = under->ld_ops->ldo_object_alloc(env, o->lo_header, under);
- mdd_pdlock_init(mdd_obj);
if (IS_ERR(below))
RETURN(PTR_ERR(below));
@@
-829,6
+829,13
@@
static int mdd_declare_attr_set(const struct lu_env *env,
return rc;
}
+static inline bool permission_is_reduced(const struct lu_attr *old,
+ const struct lu_attr *new)
+{
+ return ((new->la_mode & old->la_mode) & S_IRWXUGO) !=
+ (old->la_mode & S_IRWXUGO);
+}
+
/* set attr and LOV EA at once, return updated attr */
int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
const struct md_attr *ma)
@@
-838,6
+845,7
@@
int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
struct thandle *handle;
struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
const struct lu_attr *la = &ma->ma_attr;
+ bool sync_perm = false;
int rc;
ENTRY;
@@
-867,9
+875,38
@@
int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
if (rc)
GOTO(stop, rc);
- /* permission changes may require sync operation */
- if (ma->ma_attr.la_valid & (LA_MODE|LA_UID|LA_GID))
- handle->th_sync |= !!mdd->mdd_sync_permission;
+ /*
+ * LU-3671
+ *
+ * permission changes may require sync operation, to mitigate
+ * performance impact, only do this for dir and when permission is
+ * reduced.
+ *
+ * For regular files, version is updated with permission change
+ * (see VBR), async permission won't cause any issue, while missing
+ * permission change on directory may affect accessibility of other
+ * objects.
+ */
+ if (S_ISDIR(mdd_object_type(mdd_obj))) {
+ if (la->la_valid & (LA_UID | LA_GID)) {
+ sync_perm = true;
+ } else if (la->la_valid & LA_MODE &&
+ la->la_mode & (S_ISUID | S_ISGID | S_ISVTX)) {
+ sync_perm = true;
+ } else if (la->la_valid & LA_MODE) {
+ struct lu_attr *tmp_la = &mdd_env_info(env)->mti_la;
+
+ rc = mdd_la_get(env, mdd_obj, tmp_la, BYPASS_CAPA);
+ if (rc)
+ GOTO(stop, rc);
+
+ if (permission_is_reduced(tmp_la, la))
+ sync_perm = true;
+ }
+ }
+
+ if (sync_perm)
+ handle->th_sync |= !!mdd->mdd_sync_permission;
if (la->la_valid & (LA_MTIME | LA_CTIME))
CDEBUG(D_INODE, "setting mtime "LPU64", ctime "LPU64"\n",
@@
-1045,10
+1082,6
@@
static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
if (rc)
GOTO(stop, rc);
- /* security-replated changes may require sync */
- if (!strcmp(name, XATTR_NAME_ACL_ACCESS))
- handle->th_sync |= !!mdd->mdd_sync_permission;
-
mdd_write_lock(env, mdd_obj, MOR_TGT_CHILD);
if (strncmp(XATTR_NAME_HSM, name, sizeof(XATTR_NAME_HSM) - 1) == 0) {
@@
-1357,7
+1390,6
@@
static int mdd_swap_layouts(const struct lu_env *env, struct md_object *obj1,
fst_fl = LU_XATTR_CREATE;
}
- LASSERT(snd_buf->lb_buf != NULL);
snd_lmm = snd_buf->lb_buf;
snd_gen = le16_to_cpu(snd_lmm->lmm_layout_gen);