diff options
author | Sage Weil <sage@newdream.net> | 2009-12-02 14:54:25 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-12-03 17:59:48 -0500 |
commit | 1d1de9160e0d8aff0d67a21137b62e63ffd6f184 (patch) | |
tree | 45482bacc25511428b150424f0bdb934b6d9bf73 | |
parent | 50b885b96c903e420a1eac54dd27626244704a06 (diff) |
ceph: hide /.ceph from readdir results
We need to skip /.ceph in (cached) readdir results, and exclude "/.ceph"
from the cached ENOENT lookup check.
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r-- | fs/ceph/ceph_fs.h | 1 | ||||
-rw-r--r-- | fs/ceph/dir.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/fs/ceph/ceph_fs.h b/fs/ceph/ceph_fs.h index 4e5f49c738d8..699196a10c66 100644 --- a/fs/ceph/ceph_fs.h +++ b/fs/ceph/ceph_fs.h | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | 45 | ||
46 | #define CEPH_INO_ROOT 1 | 46 | #define CEPH_INO_ROOT 1 |
47 | #define CEPH_INO_CEPH 2 /* hidden .ceph dir */ | ||
47 | 48 | ||
48 | /* arbitrary limit on max # of monitors (cluster of 3 is typical) */ | 49 | /* arbitrary limit on max # of monitors (cluster of 3 is typical) */ |
49 | #define CEPH_MAX_MON 31 | 50 | #define CEPH_MAX_MON 31 |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 32ef54367224..89ce3ba4a614 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -132,6 +132,7 @@ more: | |||
132 | } | 132 | } |
133 | if (!d_unhashed(dentry) && dentry->d_inode && | 133 | if (!d_unhashed(dentry) && dentry->d_inode && |
134 | ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && | 134 | ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && |
135 | ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && | ||
135 | filp->f_pos <= di->offset) | 136 | filp->f_pos <= di->offset) |
136 | break; | 137 | break; |
137 | dout(" skipping %p %.*s at %llu (%llu)%s%s\n", dentry, | 138 | dout(" skipping %p %.*s at %llu (%llu)%s%s\n", dentry, |
@@ -512,6 +513,12 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, | |||
512 | return dentry; | 513 | return dentry; |
513 | } | 514 | } |
514 | 515 | ||
516 | static int is_root_ceph_dentry(struct inode *inode, struct dentry *dentry) | ||
517 | { | ||
518 | return ceph_ino(inode) == CEPH_INO_ROOT && | ||
519 | strncmp(dentry->d_name.name, ".ceph", 5) == 0; | ||
520 | } | ||
521 | |||
515 | /* | 522 | /* |
516 | * Look up a single dir entry. If there is a lookup intent, inform | 523 | * Look up a single dir entry. If there is a lookup intent, inform |
517 | * the MDS so that it gets our 'caps wanted' value in a single op. | 524 | * the MDS so that it gets our 'caps wanted' value in a single op. |
@@ -554,6 +561,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
554 | if (strncmp(dentry->d_name.name, | 561 | if (strncmp(dentry->d_name.name, |
555 | client->mount_args->snapdir_name, | 562 | client->mount_args->snapdir_name, |
556 | dentry->d_name.len) && | 563 | dentry->d_name.len) && |
564 | !is_root_ceph_dentry(dir, dentry) && | ||
557 | (ci->i_ceph_flags & CEPH_I_COMPLETE) && | 565 | (ci->i_ceph_flags & CEPH_I_COMPLETE) && |
558 | (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { | 566 | (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { |
559 | di->offset = ci->i_max_offset++; | 567 | di->offset = ci->i_max_offset++; |