]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: brehash more aggressively in fill_trace, and be more cautious with USE_CAP_M...
authorSage Weil <sage@newdream.net>
Tue, 13 May 2008 23:33:41 +0000 (16:33 -0700)
committerSage Weil <sage@newdream.net>
Tue, 13 May 2008 23:33:41 +0000 (16:33 -0700)
src/kernel/inode.c
src/kernel/mds_client.c

index 4987913af586aac881cf87c5fcc7f1714c792095..3af04ce4e04bb11272651d61970143c039bd58db 100644 (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)
index 77055bb4aa1b9bca5a7bb26c72b453071919fcbd..a448f0fe80400e733b8593acc28638683373bb1d 100644 (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);