kclient: brehash more aggressively in fill_trace, and be more cautious with USE_CAP_MDS in getattr

This commit is contained in:
Sage Weil 2008-05-13 16:33:41 -07:00
parent 1b2296e6ab
commit 30059167ee
2 changed files with 17 additions and 8 deletions

View File

@ -705,7 +705,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
else
derr(10, "sloppy tailing dentry %p, not doing lease\n",
dn);
BUG_ON(d_unhashed(dn));
if (d_unhashed(dn))
d_rehash(dn);
err = ceph_fill_inode(in,
&rinfo->trace_in[d+1],
@ -1806,12 +1807,22 @@ int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry,
if (!ceph_inode_lease_valid(dentry->d_inode, mask)) {
/*
* if the dentry is unhashed, stat the ino directly: we
* presumably have an open capability.
* if the dentry is unhashed AND we have a cap, stat
* the ino directly. (if its unhashed and we don't have a
* cap, we may be screwed anyway.)
*/
struct dentry *ret =
ceph_do_lookup(dentry->d_inode->i_sb, dentry, mask,
d_unhashed(dentry));
struct inode *inode = dentry->d_inode;
struct dentry *ret;
int want_inode = 0;
if (d_unhashed(dentry)) {
if (ceph_get_cap_mds(ceph_inode(inode)) >= 0)
want_inode = 1;
else
derr(10, "WARNING: getattr on unhashed cap-less"
" dentry %p %.*s\n", dentry,
dentry->d_name.len, dentry->d_name.name);
}
ret = ceph_do_lookup(inode->i_sb, dentry, mask, want_inode);
if (IS_ERR(ret))
return PTR_ERR(ret);
if (ret)

View File

@ -996,11 +996,9 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op,
/* encode paths */
if (op == CEPH_MDS_OP_FINDINODE) {
derr(10,"p %p\n", p);
ceph_encode_32(&p, ino1);
memcpy(p, path1, ino1 * sizeof(struct ceph_inopath_item));
p += ino1 * sizeof(struct ceph_inopath_item);
derr(10, " p %p end %p len %d\n", p, end, (int)ino1);
} else {
ceph_encode_filepath(&p, end, ino1, path1);
ceph_encode_filepath(&p, end, ino2, path2);