diff options
-rw-r--r-- | fs/ceph/dir.c | 21 | ||||
-rw-r--r-- | fs/ceph/export.c | 26 | ||||
-rw-r--r-- | fs/ceph/file.c | 4 | ||||
-rw-r--r-- | fs/ceph/inode.c | 13 | ||||
-rw-r--r-- | fs/ceph/super.c | 1 | ||||
-rw-r--r-- | fs/ceph/super.h | 7 |
6 files changed, 5 insertions, 67 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 80f5339d097b..c23eb0e9348c 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -32,33 +32,19 @@ const struct dentry_operations ceph_dentry_ops; | |||
32 | /* | 32 | /* |
33 | * Initialize ceph dentry state. | 33 | * Initialize ceph dentry state. |
34 | */ | 34 | */ |
35 | int ceph_init_dentry(struct dentry *dentry) | 35 | static int ceph_d_init(struct dentry *dentry) |
36 | { | 36 | { |
37 | struct ceph_dentry_info *di; | 37 | struct ceph_dentry_info *di; |
38 | 38 | ||
39 | if (dentry->d_fsdata) | ||
40 | return 0; | ||
41 | |||
42 | di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL); | 39 | di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL); |
43 | if (!di) | 40 | if (!di) |
44 | return -ENOMEM; /* oh well */ | 41 | return -ENOMEM; /* oh well */ |
45 | 42 | ||
46 | spin_lock(&dentry->d_lock); | ||
47 | if (dentry->d_fsdata) { | ||
48 | /* lost a race */ | ||
49 | kmem_cache_free(ceph_dentry_cachep, di); | ||
50 | goto out_unlock; | ||
51 | } | ||
52 | |||
53 | di->dentry = dentry; | 43 | di->dentry = dentry; |
54 | di->lease_session = NULL; | 44 | di->lease_session = NULL; |
55 | di->time = jiffies; | 45 | di->time = jiffies; |
56 | /* avoid reordering d_fsdata setup so that the check above is safe */ | ||
57 | smp_mb(); | ||
58 | dentry->d_fsdata = di; | 46 | dentry->d_fsdata = di; |
59 | ceph_dentry_lru_add(dentry); | 47 | ceph_dentry_lru_add(dentry); |
60 | out_unlock: | ||
61 | spin_unlock(&dentry->d_lock); | ||
62 | return 0; | 48 | return 0; |
63 | } | 49 | } |
64 | 50 | ||
@@ -730,10 +716,6 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
730 | if (dentry->d_name.len > NAME_MAX) | 716 | if (dentry->d_name.len > NAME_MAX) |
731 | return ERR_PTR(-ENAMETOOLONG); | 717 | return ERR_PTR(-ENAMETOOLONG); |
732 | 718 | ||
733 | err = ceph_init_dentry(dentry); | ||
734 | if (err < 0) | ||
735 | return ERR_PTR(err); | ||
736 | |||
737 | /* can we conclude ENOENT locally? */ | 719 | /* can we conclude ENOENT locally? */ |
738 | if (d_really_is_negative(dentry)) { | 720 | if (d_really_is_negative(dentry)) { |
739 | struct ceph_inode_info *ci = ceph_inode(dir); | 721 | struct ceph_inode_info *ci = ceph_inode(dir); |
@@ -1503,4 +1485,5 @@ const struct dentry_operations ceph_dentry_ops = { | |||
1503 | .d_revalidate = ceph_d_revalidate, | 1485 | .d_revalidate = ceph_d_revalidate, |
1504 | .d_release = ceph_d_release, | 1486 | .d_release = ceph_d_release, |
1505 | .d_prune = ceph_d_prune, | 1487 | .d_prune = ceph_d_prune, |
1488 | .d_init = ceph_d_init, | ||
1506 | }; | 1489 | }; |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 1780218a48f0..180bbef760f2 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -62,7 +62,6 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) | |||
62 | { | 62 | { |
63 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; | 63 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; |
64 | struct inode *inode; | 64 | struct inode *inode; |
65 | struct dentry *dentry; | ||
66 | struct ceph_vino vino; | 65 | struct ceph_vino vino; |
67 | int err; | 66 | int err; |
68 | 67 | ||
@@ -94,16 +93,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) | |||
94 | return ERR_PTR(-ESTALE); | 93 | return ERR_PTR(-ESTALE); |
95 | } | 94 | } |
96 | 95 | ||
97 | dentry = d_obtain_alias(inode); | 96 | return d_obtain_alias(inode); |
98 | if (IS_ERR(dentry)) | ||
99 | return dentry; | ||
100 | err = ceph_init_dentry(dentry); | ||
101 | if (err < 0) { | ||
102 | dput(dentry); | ||
103 | return ERR_PTR(err); | ||
104 | } | ||
105 | dout("__fh_to_dentry %llx %p dentry %p\n", ino, inode, dentry); | ||
106 | return dentry; | ||
107 | } | 97 | } |
108 | 98 | ||
109 | /* | 99 | /* |
@@ -131,7 +121,6 @@ static struct dentry *__get_parent(struct super_block *sb, | |||
131 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; | 121 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; |
132 | struct ceph_mds_request *req; | 122 | struct ceph_mds_request *req; |
133 | struct inode *inode; | 123 | struct inode *inode; |
134 | struct dentry *dentry; | ||
135 | int mask; | 124 | int mask; |
136 | int err; | 125 | int err; |
137 | 126 | ||
@@ -164,18 +153,7 @@ static struct dentry *__get_parent(struct super_block *sb, | |||
164 | if (!inode) | 153 | if (!inode) |
165 | return ERR_PTR(-ENOENT); | 154 | return ERR_PTR(-ENOENT); |
166 | 155 | ||
167 | dentry = d_obtain_alias(inode); | 156 | return d_obtain_alias(inode); |
168 | if (IS_ERR(dentry)) | ||
169 | return dentry; | ||
170 | err = ceph_init_dentry(dentry); | ||
171 | if (err < 0) { | ||
172 | dput(dentry); | ||
173 | return ERR_PTR(err); | ||
174 | } | ||
175 | dout("__get_parent ino %llx parent %p ino %llx.%llx\n", | ||
176 | child ? ceph_ino(d_inode(child)) : ino, | ||
177 | dentry, ceph_vinop(inode)); | ||
178 | return dentry; | ||
179 | } | 157 | } |
180 | 158 | ||
181 | static struct dentry *ceph_get_parent(struct dentry *child) | 159 | static struct dentry *ceph_get_parent(struct dentry *child) |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 7bf08825cc11..9d1554c7d036 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -351,10 +351,6 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, | |||
351 | if (dentry->d_name.len > NAME_MAX) | 351 | if (dentry->d_name.len > NAME_MAX) |
352 | return -ENAMETOOLONG; | 352 | return -ENAMETOOLONG; |
353 | 353 | ||
354 | err = ceph_init_dentry(dentry); | ||
355 | if (err < 0) | ||
356 | return err; | ||
357 | |||
358 | if (flags & O_CREAT) { | 354 | if (flags & O_CREAT) { |
359 | err = ceph_pre_init_acls(dir, &mode, &acls); | 355 | err = ceph_pre_init_acls(dir, &mode, &acls); |
360 | if (err < 0) | 356 | if (err < 0) |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 29fcbee2d416..9d0522ba069c 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -1203,12 +1203,7 @@ retry_lookup: | |||
1203 | err = -ENOMEM; | 1203 | err = -ENOMEM; |
1204 | goto done; | 1204 | goto done; |
1205 | } | 1205 | } |
1206 | err = ceph_init_dentry(dn); | 1206 | err = 0; |
1207 | if (err < 0) { | ||
1208 | dput(dn); | ||
1209 | dput(parent); | ||
1210 | goto done; | ||
1211 | } | ||
1212 | } else if (d_really_is_positive(dn) && | 1207 | } else if (d_really_is_positive(dn) && |
1213 | (ceph_ino(d_inode(dn)) != vino.ino || | 1208 | (ceph_ino(d_inode(dn)) != vino.ino || |
1214 | ceph_snap(d_inode(dn)) != vino.snap)) { | 1209 | ceph_snap(d_inode(dn)) != vino.snap)) { |
@@ -1561,12 +1556,6 @@ retry_lookup: | |||
1561 | err = -ENOMEM; | 1556 | err = -ENOMEM; |
1562 | goto out; | 1557 | goto out; |
1563 | } | 1558 | } |
1564 | ret = ceph_init_dentry(dn); | ||
1565 | if (ret < 0) { | ||
1566 | dput(dn); | ||
1567 | err = ret; | ||
1568 | goto out; | ||
1569 | } | ||
1570 | } else if (d_really_is_positive(dn) && | 1559 | } else if (d_really_is_positive(dn) && |
1571 | (ceph_ino(d_inode(dn)) != vino.ino || | 1560 | (ceph_ino(d_inode(dn)) != vino.ino || |
1572 | ceph_snap(d_inode(dn)) != vino.snap)) { | 1561 | ceph_snap(d_inode(dn)) != vino.snap)) { |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 0617580b2508..fd2ea18a0ca3 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -795,7 +795,6 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc, | |||
795 | root = ERR_PTR(-ENOMEM); | 795 | root = ERR_PTR(-ENOMEM); |
796 | goto out; | 796 | goto out; |
797 | } | 797 | } |
798 | ceph_init_dentry(root); | ||
799 | dout("open_root_inode success, root dentry is %p\n", root); | 798 | dout("open_root_inode success, root dentry is %p\n", root); |
800 | } else { | 799 | } else { |
801 | root = ERR_PTR(err); | 800 | root = ERR_PTR(err); |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 26a5a5d6bf36..931687f71a7c 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -950,13 +950,6 @@ extern void ceph_invalidate_dentry_lease(struct dentry *dentry); | |||
950 | extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn); | 950 | extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn); |
951 | extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); | 951 | extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); |
952 | 952 | ||
953 | /* | ||
954 | * our d_ops vary depending on whether the inode is live, | ||
955 | * snapshotted (read-only), or a virtual ".snap" directory. | ||
956 | */ | ||
957 | int ceph_init_dentry(struct dentry *dentry); | ||
958 | |||
959 | |||
960 | /* ioctl.c */ | 953 | /* ioctl.c */ |
961 | extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 954 | extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
962 | 955 | ||