#include <linux/lustre/lustre_ver.h>
#include <libcfs/util/string.h>
-#ifdef HAVE_SELINUX
-#include <selinux/selinux.h>
-#endif
-
#include "mount_utils.h"
#define MAX_HW_SECTORS_KB_PATH "queue/max_hw_sectors_kb"
static bool is_e2fsprogs_feature_supp(const char *feature);
static void disp_old_e2fsprogs_msg(const char *feature, int make_backfs);
-/*
- * Concatenate context of the temporary mount point if selinux is enabled
- */
-#ifdef HAVE_SELINUX
-static void append_context_for_mount(char *mntpt, struct mkfs_opts *mop)
-{
- security_context_t fcontext;
-
- if (getfilecon(mntpt, &fcontext) < 0) {
- /* Continuing with default behaviour */
- fprintf(stderr, "%s: Get file context failed : %s\n",
- progname, strerror(errno));
- return;
- }
-
- if (fcontext != NULL) {
- append_unique(mop->mo_ldd.ldd_mount_opts,
- ",", "context", fcontext,
- sizeof(mop->mo_ldd.ldd_mount_opts));
- freecon(fcontext);
- }
-}
-#endif
-
/* Determine if a device is a block device (as opposed to a file) */
static int is_block(char *devname)
{
return errno;
}
- /*
- * Append file context to mount options if SE Linux is enabled
- */
- #ifdef HAVE_SELINUX
- if (is_selinux_enabled() > 0)
- append_context_for_mount(mntpt, mop);
- #endif
-
dev = mop->mo_device;
if (mop->mo_flags & MO_IS_LOOP)
dev = mop->mo_loopdev;
"to enable this feature.\n");
#endif
if (make_backfs)
- fprintf(stderr, "Feature will not be enabled until %s"
- "is updated and '%s -O %s %%{device}' "
- "is run.\n\n", E2FSPROGS, TUNE2FS, feature);
+ fprintf(stderr,
+ "Feature will not be enabled until %s is updated and '%s -O %s %%{device}' is run.\n\n",
+ E2FSPROGS, TUNE2FS, feature);
}
/* Check whether the file exists in the device */
if (enable_64bit || strstr(mop->mo_mkfsopts, "meta_bg"))
append_unique(anchor, ",", "^resize_inode", NULL, maxbuflen);
+ /* Allow xattrs larger than one block, stored in a separate inode */
+ if (IS_MDT(&mop->mo_ldd) && is_e2fsprogs_feature_supp("-O ea_inode"))
+ append_unique(anchor, ",", "ea_inode", NULL, maxbuflen);
+
+ /* Allow more than 10M directory entries */
+ if (IS_MDT(&mop->mo_ldd) && is_e2fsprogs_feature_supp("-O large_dir"))
+ append_unique(anchor, ",", "large_dir", NULL, maxbuflen);
+
/* Cluster inode/block bitmaps and inode table for more efficient IO.
* Align the flex groups on a 1MB boundary for better performance. */
/* This -O feature needs to go last, since it adds the "-G" option. */
}
while ((d = readdir(slaves_dir)) != NULL) {
- char path[PATH_MAX];
+ char path[PATH_MAX * 2];
int rc2;
if (d->d_type != DT_LNK)
continue;
- snprintf(path, sizeof(path), "%s/%s", slaves_path, d->d_name);
+ snprintf(path, sizeof(path), "/dev/%s", d->d_name);
rc2 = tune_block_dev(path, mop);
if (rc2 != 0)
rc = rc2;
{
struct stat st;
char sys_path[PATH_MAX];
- char partition_path[PATH_MAX];
+ char partition_path[PATH_MAX + sizeof("partition")];
char *real_sys_path = NULL;
int rc;
return ret;
}
-#ifdef HAVE_SELINUX
- /*
- * Append file context to mount options if SE Linux is enabled
- */
- if (is_selinux_enabled() > 0)
- append_context_for_mount(mntpt, mop);
-#endif
-
if (mop->mo_flags & MO_IS_LOOP)
dev = mop->mo_loopdev;
else