]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: some refcounting fixes
authorSage Weil <sage@newdream.net>
Mon, 11 Aug 2008 22:47:47 +0000 (15:47 -0700)
committerSage Weil <sage@newdream.net>
Mon, 11 Aug 2008 22:47:47 +0000 (15:47 -0700)
src/kernel/dir.c
src/kernel/inode.c

index cb7c88d82c3a1aee447822904d34ea4f851ee262..e49993907dfe84d993b87f3816b14b0ef1ae1ecf 100644 (file)
@@ -277,6 +277,8 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
            strcmp(dentry->d_name.name, client->mount_args.snapdir_name) == 0) {
                struct inode *parent = dentry->d_parent->d_inode;
                struct inode *inode = ceph_get_snapdir(parent);
+               dout(10, "ENOENT on snapdir %p '%.*s', linking to snapdir %p\n",
+                    dentry, dentry->d_name.len, dentry->d_name.name, inode);
                d_add(dentry, inode);
                err = 0;
        }
index 5e5117826f0b86b622f7fbadd0a695f4878ffca8..28bb12bb6cab5d689c4a75f1ca792dced2f54a77 100644 (file)
@@ -919,6 +919,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
 
                if (d == rinfo->trace_numi-rinfo->trace_snapdirpos-1) {
                        struct inode *snapdir = ceph_get_snapdir(dn->d_inode);
+                       dput(dn);
                        dn = d_find_alias(snapdir);
                        iput(snapdir);
                        dout(10, " snapdir dentry is %p\n", dn);
@@ -1013,11 +1014,12 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req)
        struct dentry *dn;
        struct inode *in;
        int i;
+       struct inode *snapdir = 0;
 
        if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) {
-               in = ceph_get_snapdir(parent->d_inode);
-               parent = d_find_alias(in);
-               iput(in);
+               snapdir = ceph_get_snapdir(parent->d_inode);
+               parent = d_find_alias(snapdir);
+               dput(parent);
                dout(10, "readdir_prepopulate %d items under SNAPDIR dn %p\n",
                     rinfo->dir_nr, parent);
        } else {
@@ -1086,6 +1088,8 @@ retry_lookup:
                                   req->r_session, req->r_from_time);
                dput(dn);
        }
+
+       iput(snapdir);
        dout(10, "readdir_prepopulate done\n");
        return 0;
 }
@@ -2129,6 +2133,12 @@ static int do_getattr(struct dentry *dentry, int mask)
        int want_inode = 0;
        struct dentry *ret;
 
+       if (ceph_vino(dentry->d_inode).snap == CEPH_SNAPDIR) {
+               dout(30, "getattr dentry %p inode %p SNAPDIR\n", dentry,
+                    dentry->d_inode);
+               return 0;
+       }
+
        dout(30, "getattr dentry %p inode %p\n", dentry,
             dentry->d_inode);