static const char mdd_root_dir_name[] = "ROOT";
static const char mdd_obf_dir_name[] = "fid";
-static const char mdd_dot_lustre_name[] = ".lustre";
static int mdd_device_init(const struct lu_env *env, struct lu_device *d,
const char *name, struct lu_device *next)
return 0;
}
-/**
- * Direct access to the ".lustre" directory is not allowed.
- */
static int dot_lustre_mdd_open(const struct lu_env *env, struct md_object *obj,
int flags)
{
- return -EPERM;
+ struct mdd_object *mdd_obj = md2mdd_obj(obj);
+
+ mdd_write_lock(env, mdd_obj, MOR_TGT_CHILD);
+ mdd_obj->mod_count++;
+ mdd_write_unlock(env, mdd_obj);
+
+ return 0;
}
static int dot_lustre_path(const struct lu_env *env, struct md_object *obj,
return -ENOSYS;
}
+static int dot_lustre_close(const struct lu_env *env, struct md_object *obj,
+ struct md_attr *ma)
+{
+ struct mdd_object *mdd_obj = md2mdd_obj(obj);
+
+ mdd_write_lock(env, mdd_obj, MOR_TGT_CHILD);
+ mdd_obj->mod_count--;
+ mdd_write_unlock(env, mdd_obj);
+
+ return 0;
+}
+
static struct md_object_operations mdd_dot_lustre_obj_ops = {
.moo_attr_get = dot_lustre_attr_get,
.moo_attr_set = dot_lustre_attr_set,
.moo_xattr_get = dot_lustre_xattr_get,
.moo_open = dot_lustre_mdd_open,
+ .moo_close = dot_lustre_close,
+ .moo_readpage = mdd_readpage,
.moo_path = dot_lustre_path
};
return rc;
}
-static int mdd_readpage(const struct lu_env *env, struct md_object *obj,
- const struct lu_rdpg *rdpg)
+int mdd_readpage(const struct lu_env *env, struct md_object *obj,
+ const struct lu_rdpg *rdpg)
{
struct mdd_object *mdd_obj = md2mdd_obj(obj);
int rc;
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
continue;
+ /* Don't traverse .lustre directory */
+ if (!(strcmp(dent->d_name, mdd_dot_lustre_name)))
+ continue;
+
path[len] = 0;
if ((len + dent->d_reclen + 2) > size) {
llapi_err(LLAPI_MSG_ERROR,