#ifdef HAVE_UIDGID_HEADER
# include <linux/uidgid.h>
#endif
+#include <linux/security.h>
#include <lustre_ioctl.h>
#include <lustre_ha.h>
EXIT;
}
+static inline int obd_connect_has_secctx(struct obd_connect_data *data)
+{
+ return data->ocd_connect_flags & OBD_CONNECT_FLAGS2 &&
+ data->ocd_connect_flags2 & OBD_CONNECT2_FILE_SECCTX;
+}
+
static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
struct vfsmount *mnt)
{
if (sbi->ll_flags & LL_SBI_ALWAYS_PING)
data->ocd_connect_flags &= ~OBD_CONNECT_PINGLESS;
+#ifdef HAVE_SECURITY_DENTRY_INIT_SECURITY
+ data->ocd_connect_flags2 |= OBD_CONNECT2_FILE_SECCTX;
+#endif /* HAVE_SECURITY_DENTRY_INIT_SECURITY */
+
data->ocd_brw_size = MD_MAX_BRW_SIZE;
err = obd_connect(NULL, &sbi->ll_md_exp, obd, &sbi->ll_sb_uuid, data, NULL);
if (data->ocd_connect_flags & OBD_CONNECT_LAYOUTLOCK)
sbi->ll_flags |= LL_SBI_LAYOUT_LOCK;
+ if (obd_connect_has_secctx(data))
+ sbi->ll_flags |= LL_SBI_FILE_SECCTX;
+
if (data->ocd_ibits_known & MDS_INODELOCK_XATTR) {
if (!(data->ocd_connect_flags & OBD_CONNECT_MAX_EASIZE)) {
LCONSOLE_INFO("%s: disabling xattr cache due to "
void ll_finish_md_op_data(struct md_op_data *op_data)
{
+ security_release_secctx(op_data->op_file_secctx,
+ op_data->op_file_secctx_size);
OBD_FREE_PTR(op_data);
}