#define DEBUG_SUBSYSTEM S_LLITE
#include <linux/module.h>
+#include <linux/random.h>
#include <linux/statfs.h>
#include <linux/time.h>
#include <linux/types.h>
+#include <libcfs/linux/linux-uuid.h>
#include <linux/version.h>
#include <linux/mm.h>
#include <linux/user_namespace.h>
unsigned long pages;
unsigned long lru_page_max;
struct sysinfo si;
- class_uuid_t uuid;
int i;
ENTRY;
sbi->ll_ra_info.ra_max_pages = sbi->ll_ra_info.ra_max_pages_per_file;
sbi->ll_ra_info.ra_max_read_ahead_whole_pages = -1;
- ll_generate_random_uuid(uuid);
- class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
- CDEBUG(D_CONFIG, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid);
-
sbi->ll_flags |= LL_SBI_VERBOSE;
#ifdef ENABLE_CHECKSUM
sbi->ll_flags |= LL_SBI_CHECKSUM;
OBD_CONNECT_GRANT_PARAM |
OBD_CONNECT_SHORTIO | OBD_CONNECT_FLAGS2;
- data->ocd_connect_flags2 = OBD_CONNECT2_FLR |
- OBD_CONNECT2_LOCK_CONVERT |
- OBD_CONNECT2_DIR_MIGRATE |
+ data->ocd_connect_flags2 = OBD_CONNECT2_DIR_MIGRATE |
OBD_CONNECT2_SUM_STATFS |
+ OBD_CONNECT2_FLR |
+ OBD_CONNECT2_LOCK_CONVERT |
OBD_CONNECT2_ARCHIVE_ID_ARRAY |
OBD_CONNECT2_LSOM;
char name[MAX_STRING_SIZE];
int md_len = 0;
int dt_len = 0;
+ uuid_t uuid;
char *ptr;
int len;
int err;
if (err)
GOTO(out_free_cfg, err);
- err = super_setup_bdi_name(sb, "lustre-%016lx", cfg_instance);
- if (err)
- GOTO(out_free_cfg, err);
-
#ifndef HAVE_DCACHE_LOCK
/* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */
sb->s_d_op = &ll_d_ops;
#endif
+ /* UUID handling */
+ generate_random_uuid(uuid.b);
+ snprintf(sbi->ll_sb_uuid.uuid, UUID_SIZE, "%pU", uuid.b);
+
+ CDEBUG(D_CONFIG, "llite sb uuid: %s\n", sbi->ll_sb_uuid.uuid);
+
/* Get fsname */
len = strlen(profilenm);
ptr = strrchr(profilenm, '-');
sbi->ll_fsname[len] = '\0';
/* Mount info */
- snprintf(name, MAX_STRING_SIZE, "%.*s-%016lx", len,
+ snprintf(name, sizeof(name), "%.*s-%016lx", len,
profilenm, cfg_instance);
+ err = super_setup_bdi_name(sb, "%s", name);
+ if (err)
+ GOTO(out_free_cfg, err);
+
/* Call ll_debugfs_register_super() before lustre_process_log()
* so that "llite.*.*" params can be processed correctly.
*/
/*
* if dir layout mismatch, check whether version is increased, which
* means layout is changed, this happens in dir migration and lfsck.
+ *
+ * foreign LMV should not change.
*/
- if (lli->lli_lsm_md && !lsm_md_eq(lli->lli_lsm_md, lsm)) {
+ if (lli->lli_lsm_md &&
+ lli->lli_lsm_md->lsm_md_magic != LMV_MAGIC_FOREIGN &&
+ !lsm_md_eq(lli->lli_lsm_md, lsm)) {
if (lsm->lsm_md_layout_version <=
lli->lli_lsm_md->lsm_md_layout_version) {
CERROR("%s: "DFID" dir layout mismatch:\n",
if (!lli->lli_lsm_md) {
struct cl_attr *attr;
+ if (lsm->lsm_md_magic == LMV_MAGIC_FOREIGN) {
+ /* set md->lmv to NULL, so the following free lustre_md
+ * will not free this lsm */
+ md->lmv = NULL;
+ lli->lli_lsm_md = lsm;
+ up_write(&lli->lli_lsm_sem);
+ RETURN(0);
+ }
+
rc = ll_init_lsm_md(inode, md);
up_write(&lli->lli_lsm_sem);
if (rc != 0)
rc = md_get_lustre_md(sbi->ll_md_exp, req, sbi->ll_dt_exp,
sbi->ll_md_exp, &md);
if (rc != 0)
- GOTO(cleanup, rc);
+ GOTO(out, rc);
if (*inode) {
rc = ll_update_inode(*inode, &md);
GOTO(out, rc = 0);
out:
+ /* cleanup will be done if necessary */
md_free_lustre_md(sbi->ll_md_exp, &md);
-cleanup:
if (rc != 0 && it != NULL && it->it_op & IT_OPEN)
ll_open_cleanup(sb != NULL ? sb : (*inode)->i_sb, req);