]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: avoid using d_add when shouldn't. Fixes lock on d_lookup bug.
authorYehuda Sadeh-Weinraub <yehuda@yehuda.infit.com>
Tue, 18 Mar 2008 11:55:07 +0000 (13:55 +0200)
committerYehuda Sadeh-Weinraub <yehuda@yehuda.infit.com>
Tue, 18 Mar 2008 11:55:07 +0000 (13:55 +0200)
src/kernel/dir.c
src/kernel/inode.c

index 86c45b8a49bdff094702a68afb31cda875fca249..2f78f1789461e05fdece3cd035af522e28fa38ad 100644 (file)
@@ -139,7 +139,9 @@ static int prepopulate_dir(struct dentry *parent,
                                d_delete(dn);
                                return -1;
                        }
-                       d_add(dn, in);
+                       d_instantiate(dn, in);
+                       if (d_unhashed(dn))
+                               d_rehash(dn);
                        dout(10, "dir_readdir added dentry %p ino %llx %d/%d\n",
                             dn, ceph_ino(in), i, rinfo->dir_nr);
                } else {
index 7e2765424eda47b06cb4c2aa058b15295578e5ef..c6526a0616a3f41627fdc16211e3c3b4b9d3b38d 100644 (file)
@@ -226,7 +226,9 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
                if (!ininfo) {
                        dout(10, "fill_trace has dentry but no inode\n");
                        err = -ENOENT;
-                       d_add(dn, NULL);
+                       d_instantiate(dn, NULL);
+                       if (d_unhashed(dn))
+                               d_rehash(dn);
                        ceph_touch_dentry(dn);
                        break;
                }
@@ -250,8 +252,10 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
                                break;
                        }
                        ceph_touch_dentry(dn);
-                       dout(10, "fill_trace d_add\n");
-                       d_add(dn, in);
+                       dout(10, "fill_trace d_instantiate\n");
+                       d_instantiate(dn, in);
+                       if (d_unhashed(dn))
+                               d_rehash(dn);
                        dout(10, "ceph_fill_trace added dentry %p"
                             " inode %llx %d/%d\n",
                             dn, ceph_ino(in), i, rinfo->trace_nr);