diff options
author | Sage Weil <sage@newdream.net> | 2010-03-30 16:54:41 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-03-30 16:55:22 -0400 |
commit | 9358c6d4c0264b1572554c49c4b92673ea9a5c72 (patch) | |
tree | 3d11a5021487dccf61b8d53c66c32df6b84223eb /fs/ceph/dir.c | |
parent | 2eaa9cfdf33b8d7fb7aff27792192e0019ae8fc6 (diff) |
ceph: fix dentry rehashing on virtual .snap dir
If a lookup fails on the magic .snap directory, we bind it to a magic
snap directory inode in ceph_lookup_finish(). That code assumes the dentry
is unhashed, but a recent server-side change started returning NULL leases
on lookup failure, causing the .snap dentry to be hashed and NULL by
ceph_fill_trace().
This causes dentry hash chain corruption, or a dies when d_rehash()
includes
BUG_ON(!d_unhashed(entry));
So, avoid processing the NULL dentry lease if it the dentry matches the
snapdir name in ceph_fill_trace(). That allows the lookup completion to
properly bind it to the snapdir inode. BUG there if dentry is hashed to
be sure.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r-- | fs/ceph/dir.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 8a9116e15b70..aed8fda33024 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -488,6 +488,7 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, | |||
488 | struct inode *inode = ceph_get_snapdir(parent); | 488 | struct inode *inode = ceph_get_snapdir(parent); |
489 | dout("ENOENT on snapdir %p '%.*s', linking to snapdir %p\n", | 489 | dout("ENOENT on snapdir %p '%.*s', linking to snapdir %p\n", |
490 | dentry, dentry->d_name.len, dentry->d_name.name, inode); | 490 | dentry, dentry->d_name.len, dentry->d_name.name, inode); |
491 | BUG_ON(!d_unhashed(dentry)); | ||
491 | d_add(dentry, inode); | 492 | d_add(dentry, inode); |
492 | err = 0; | 493 | err = 0; |
493 | } | 494 | } |