Whamcloud - gitweb
LU-9679 general: add missing spaces to folded strings.
[fs/lustre-release.git] / lustre / utils / libmount_utils_ldiskfs.c
index 15f79bf..1ee3612 100644 (file)
 #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"
@@ -98,30 +94,6 @@ static void append_unique(char *buf, char *prefix, char *key, char *val,
 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)
 {
@@ -204,14 +176,6 @@ int ldiskfs_write_ldd(struct mkfs_opts *mop)
                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;
@@ -392,9 +356,9 @@ static void disp_old_e2fsprogs_msg(const char *feature, int make_backfs)
                "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 */
@@ -607,6 +571,14 @@ static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor,
        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. */
@@ -1253,13 +1225,13 @@ static int tune_block_dev_slaves(const char *sys_path, struct mount_opts *mop)
        }
 
        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;
@@ -1277,7 +1249,7 @@ static int tune_block_dev(const char *src, struct mount_opts *mop)
 {
        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;
 
@@ -1408,14 +1380,6 @@ int ldiskfs_rename_fsname(struct mkfs_opts *mop, const char *oldname)
                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