mdt_thread_info.mti_attr is used to initialize object attr in create,
currently it's copied to object.oo_attr directly, but some fields
in mti_attr may contain bogus data because it's not cleared in each
use, though la_valid is correctly set, but la_flags is used without
checking la_valid in __mdd_permission_internal().
Another minor fix in osd_create(): set size/nlink to zero since they
are set in valid.
Test-Parameters: testlist=sanity env=ONLY=300,ONLY_REPEAT=100
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I64816b66a0b3c7aa50e62680d5251141697a8e0f
Reviewed-on: https://review.whamcloud.com/40062
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Olaf Faaland-LLNL <faaland1@llnl.gov>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
/*
* Nobody gets write access to an immutable file.
*/
- if (mask & MAY_WRITE && la->la_flags & LUSTRE_IMMUTABLE_FL)
+ if ((mask & MAY_WRITE) && (la->la_valid & LA_FLAGS) &&
+ (la->la_flags & LUSTRE_IMMUTABLE_FL))
RETURN(-EACCES);
LASSERT(la != NULL);
/* we may fix some attributes, better do not change the source */
obj->oo_attr = *attr;
+ obj->oo_attr.la_size = 0;
+ obj->oo_attr.la_nlink = 0;
obj->oo_attr.la_valid |= LA_SIZE | LA_NLINK | LA_TYPE;
#ifdef ZFS_PROJINHERIT