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],
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)
/* 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);