file.c (47237687d73cbeae1dd7a133c3fc3d7239094568) | file.c (d95852777bc8ba6b3ad3397d495c5f9dd8ca8383) |
---|---|
1#include <linux/ceph/ceph_debug.h> 2 3#include <linux/module.h> 4#include <linux/sched.h> 5#include <linux/slab.h> 6#include <linux/file.h> 7#include <linux/namei.h> 8#include <linux/writeback.h> --- 199 unchanged lines hidden (view full) --- 208 209/* 210 * Do a lookup + open with a single request. 211 * 212 * If this succeeds, but some subsequent check in the vfs 213 * may_open() fails, the struct *file gets cleaned up (i.e. 214 * ceph_release gets called). So fear not! 215 */ | 1#include <linux/ceph/ceph_debug.h> 2 3#include <linux/module.h> 4#include <linux/sched.h> 5#include <linux/slab.h> 6#include <linux/file.h> 7#include <linux/namei.h> 8#include <linux/writeback.h> --- 199 unchanged lines hidden (view full) --- 208 209/* 210 * Do a lookup + open with a single request. 211 * 212 * If this succeeds, but some subsequent check in the vfs 213 * may_open() fails, the struct *file gets cleaned up (i.e. 214 * ceph_release gets called). So fear not! 215 */ |
216struct file *ceph_lookup_open(struct inode *dir, struct dentry *dentry, 217 struct opendata *od, unsigned flags, umode_t mode, 218 int *opened) | 216int ceph_lookup_open(struct inode *dir, struct dentry *dentry, 217 struct opendata *od, unsigned flags, umode_t mode, 218 int *opened) |
219{ 220 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); 221 struct ceph_mds_client *mdsc = fsc->mdsc; 222 struct file *file = NULL; 223 struct ceph_mds_request *req; 224 struct dentry *ret; 225 int err; 226 227 dout("ceph_lookup_open dentry %p '%.*s' flags %d mode 0%o\n", 228 dentry, dentry->d_name.len, dentry->d_name.name, flags, mode); 229 230 /* do the open */ 231 req = prepare_open_request(dir->i_sb, flags, mode); 232 if (IS_ERR(req)) | 219{ 220 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); 221 struct ceph_mds_client *mdsc = fsc->mdsc; 222 struct file *file = NULL; 223 struct ceph_mds_request *req; 224 struct dentry *ret; 225 int err; 226 227 dout("ceph_lookup_open dentry %p '%.*s' flags %d mode 0%o\n", 228 dentry, dentry->d_name.len, dentry->d_name.name, flags, mode); 229 230 /* do the open */ 231 req = prepare_open_request(dir->i_sb, flags, mode); 232 if (IS_ERR(req)) |
233 return ERR_CAST(req); | 233 return PTR_ERR(req); |
234 req->r_dentry = dget(dentry); 235 req->r_num_caps = 2; 236 if (flags & O_CREAT) { 237 req->r_dentry_drop = CEPH_CAP_FILE_SHARED; 238 req->r_dentry_unless = CEPH_CAP_FILE_EXCL; 239 } 240 req->r_locked_dir = dir; /* caller holds dir->i_mutex */ 241 err = ceph_mdsc_do_request(mdsc, --- 10 unchanged lines hidden (view full) --- 252 if (IS_ERR(file)) 253 err = PTR_ERR(file); 254out: 255 ret = ceph_finish_lookup(req, dentry, err); 256 ceph_mdsc_put_request(req); 257 dout("ceph_lookup_open result=%p\n", ret); 258 259 if (IS_ERR(ret)) | 234 req->r_dentry = dget(dentry); 235 req->r_num_caps = 2; 236 if (flags & O_CREAT) { 237 req->r_dentry_drop = CEPH_CAP_FILE_SHARED; 238 req->r_dentry_unless = CEPH_CAP_FILE_EXCL; 239 } 240 req->r_locked_dir = dir; /* caller holds dir->i_mutex */ 241 err = ceph_mdsc_do_request(mdsc, --- 10 unchanged lines hidden (view full) --- 252 if (IS_ERR(file)) 253 err = PTR_ERR(file); 254out: 255 ret = ceph_finish_lookup(req, dentry, err); 256 ceph_mdsc_put_request(req); 257 dout("ceph_lookup_open result=%p\n", ret); 258 259 if (IS_ERR(ret)) |
260 return ERR_CAST(ret); | 260 return PTR_ERR(ret); |
261 262 dput(ret); | 261 262 dput(ret); |
263 return err ? ERR_PTR(err) : file; | 263 return err; |
264} 265 266int ceph_release(struct inode *inode, struct file *file) 267{ 268 struct ceph_inode_info *ci = ceph_inode(inode); 269 struct ceph_file_info *cf = file->private_data; 270 271 dout("release inode %p file %p\n", inode, file); --- 601 unchanged lines hidden --- | 264} 265 266int ceph_release(struct inode *inode, struct file *file) 267{ 268 struct ceph_inode_info *ci = ceph_inode(inode); 269 struct ceph_file_info *cf = file->private_data; 270 271 dout("release inode %p file %p\n", inode, file); --- 601 unchanged lines hidden --- |