Whamcloud - gitweb
b=18452
authorkalpak <kalpak>
Wed, 11 Feb 2009 18:52:26 +0000 (18:52 +0000)
committerkalpak <kalpak>
Wed, 11 Feb 2009 18:52:26 +0000 (18:52 +0000)
i=nathan
i=pravin

allow getstripe to work for .lustre dir
llapi_traverse should not open .lustre dir

lustre/include/lustre/lustre_user.h
lustre/mdd/mdd_device.c
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_object.c
lustre/utils/liblustreapi.c

index da7ed9b..b9bbdf0 100644 (file)
@@ -365,4 +365,6 @@ struct if_quotactl {
 # define offsetof(typ,memb)     ((unsigned long)((char *)&(((typ *)0)->memb)))
 #endif
 
+#define mdd_dot_lustre_name ".lustre"
+
 #endif /* _LUSTRE_USER_H */
index 07924a0..8236e3d 100644 (file)
@@ -69,7 +69,6 @@ static struct lu_device_type mdd_device_type;
 
 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)
@@ -351,13 +350,16 @@ static int dot_lustre_xattr_get(const struct lu_env *env,
         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,
@@ -366,11 +368,25 @@ 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
 };
 
index 0d66a68..6785411 100644 (file)
@@ -371,6 +371,8 @@ struct mdd_object *mdd_object_find(const struct lu_env *env,
                                    const struct lu_fid *f);
 int mdd_get_default_md(struct mdd_object *mdd_obj, struct lov_mds_md *lmm,
                        int *size);
+int mdd_readpage(const struct lu_env *env, struct md_object *obj,
+                 const struct lu_rdpg *rdpg);
 
 /* mdd_quota.c*/
 #ifdef HAVE_QUOTA_SUPPORT
index 9846cb4..a2ce991 100644 (file)
@@ -2157,8 +2157,8 @@ static int __mdd_readpage(const struct lu_env *env, struct mdd_object *obj,
         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;
index e0d8e1d..9ef5f2c 100644 (file)
@@ -1161,6 +1161,10 @@ static int llapi_semantic_traverse(char *path, int size, DIR *parent,
                 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,