};
static int osd_mkdir(struct osd_thread_info *info, struct osd_object *obj,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *th)
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof,
+ struct thandle *th)
{
- int result;
- struct osd_thandle *oth;
- __u32 mode = (attr->la_mode & (S_IFMT | S_IRWXUGO | S_ISVTX));
+ int result;
+ struct osd_thandle *oth;
+ __u32 mode = (attr->la_mode & (S_IFMT | S_IRWXUGO | S_ISVTX | S_ISGID));
- LASSERT(S_ISDIR(attr->la_mode));
+ LASSERT(S_ISDIR(attr->la_mode));
- oth = container_of(th, struct osd_thandle, ot_super);
- LASSERT(oth->ot_handle->h_transaction != NULL);
- result = osd_mkfile(info, obj, mode, hint, th);
+ oth = container_of(th, struct osd_thandle, ot_super);
+ LASSERT(oth->ot_handle->h_transaction != NULL);
+ result = osd_mkfile(info, obj, mode, hint, th);
- return result;
+ return result;
}
static int osd_mk_index(struct osd_thread_info *info, struct osd_object *obj,
RETURN(local);
}
+ /* restore i_gid in case S_ISGID is set, we will inherit S_ISGID and set
+ * correct gid on remote file, not agent here */
+ local->i_gid = current_fsgid();
ldiskfs_set_inode_state(local, LDISKFS_STATE_LUSTRE_NOSCRUB);
unlock_new_inode(local);
test_mkdir $DIR/$tdir/d/subdir || error "mkdir $tdir/d/subdir failed"
$CHECKSTAT -g \#$RUNAS_GID $DIR/$tdir/d/subdir ||
error "$tdir/d/subdir should be GID $RUNAS_GID"
+ if [[ $MDSCOUNT -gt 1 ]]; then
+ # check remote dir sgid inherite
+ $LFS mkdir -i 0 $DIR/$tdir.local ||
+ error "mkdir $tdir.local failed"
+ chmod g+s $DIR/$tdir.local ||
+ error "chmod $tdir.local failed"
+ chgrp $RUNAS_GID $DIR/$tdir.local ||
+ error "chgrp $tdir.local failed"
+ $LFS mkdir -i 1 $DIR/$tdir.local/$tdir.remote ||
+ error "mkdir $tdir.remote failed"
+ $CHECKSTAT -g \#$RUNAS_GID $DIR/$tdir.local/$tdir.remote ||
+ error "$tdir.remote should be owned by $UID.$RUNAS_ID"
+ $CHECKSTAT -p 02755 $DIR/$tdir.local/$tdir.remote ||
+ error "$tdir.remote should be mode 02755"
+ fi
}
run_test 6g "Is new dir in sgid dir inheriting group?"