diff options
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r-- | fs/ceph/file.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 988d4f302e48..1b81d6c31878 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -213,22 +213,15 @@ out: | |||
213 | * may_open() fails, the struct *file gets cleaned up (i.e. | 213 | * may_open() fails, the struct *file gets cleaned up (i.e. |
214 | * ceph_release gets called). So fear not! | 214 | * ceph_release gets called). So fear not! |
215 | */ | 215 | */ |
216 | /* | 216 | int ceph_lookup_open(struct inode *dir, struct dentry *dentry, |
217 | * flags | 217 | struct file *file, unsigned flags, umode_t mode, |
218 | * path_lookup_open -> LOOKUP_OPEN | 218 | int *opened) |
219 | * path_lookup_create -> LOOKUP_OPEN|LOOKUP_CREATE | ||
220 | */ | ||
221 | struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry, | ||
222 | struct nameidata *nd, int mode, | ||
223 | int locked_dir) | ||
224 | { | 219 | { |
225 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); | 220 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); |
226 | struct ceph_mds_client *mdsc = fsc->mdsc; | 221 | struct ceph_mds_client *mdsc = fsc->mdsc; |
227 | struct file *file; | ||
228 | struct ceph_mds_request *req; | 222 | struct ceph_mds_request *req; |
229 | struct dentry *ret; | 223 | struct dentry *ret; |
230 | int err; | 224 | int err; |
231 | int flags = nd->intent.open.flags; | ||
232 | 225 | ||
233 | dout("ceph_lookup_open dentry %p '%.*s' flags %d mode 0%o\n", | 226 | dout("ceph_lookup_open dentry %p '%.*s' flags %d mode 0%o\n", |
234 | dentry, dentry->d_name.len, dentry->d_name.name, flags, mode); | 227 | dentry, dentry->d_name.len, dentry->d_name.name, flags, mode); |
@@ -236,7 +229,7 @@ struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry, | |||
236 | /* do the open */ | 229 | /* do the open */ |
237 | req = prepare_open_request(dir->i_sb, flags, mode); | 230 | req = prepare_open_request(dir->i_sb, flags, mode); |
238 | if (IS_ERR(req)) | 231 | if (IS_ERR(req)) |
239 | return ERR_CAST(req); | 232 | return PTR_ERR(req); |
240 | req->r_dentry = dget(dentry); | 233 | req->r_dentry = dget(dentry); |
241 | req->r_num_caps = 2; | 234 | req->r_num_caps = 2; |
242 | if (flags & O_CREAT) { | 235 | if (flags & O_CREAT) { |
@@ -254,14 +247,17 @@ struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry, | |||
254 | err = ceph_handle_notrace_create(dir, dentry); | 247 | err = ceph_handle_notrace_create(dir, dentry); |
255 | if (err) | 248 | if (err) |
256 | goto out; | 249 | goto out; |
257 | file = lookup_instantiate_filp(nd, req->r_dentry, ceph_open); | 250 | err = finish_open(file, req->r_dentry, ceph_open, opened); |
258 | if (IS_ERR(file)) | ||
259 | err = PTR_ERR(file); | ||
260 | out: | 251 | out: |
261 | ret = ceph_finish_lookup(req, dentry, err); | 252 | ret = ceph_finish_lookup(req, dentry, err); |
262 | ceph_mdsc_put_request(req); | 253 | ceph_mdsc_put_request(req); |
263 | dout("ceph_lookup_open result=%p\n", ret); | 254 | dout("ceph_lookup_open result=%p\n", ret); |
264 | return ret; | 255 | |
256 | if (IS_ERR(ret)) | ||
257 | return PTR_ERR(ret); | ||
258 | |||
259 | dput(ret); | ||
260 | return err; | ||
265 | } | 261 | } |
266 | 262 | ||
267 | int ceph_release(struct inode *inode, struct file *file) | 263 | int ceph_release(struct inode *inode, struct file *file) |