spin_unlock(&ceph_client_spinlock);
}
-static struct dentry *open_root_dentry(struct ceph_client *client, struct ceph_mount_args *args)
+static struct dentry *open_root_dentry(struct ceph_client *client,
+ struct ceph_mount_args *args)
{
struct ceph_mds_client *mdsc = &client->mdsc;
struct ceph_mds_request *req = 0;
/* open dir */
dout(30, "open_root_inode opening '%s'\n", args->path);
- req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_OPEN, 1, args->path, 0, 0);
+ req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_OPEN,
+ 1, args->path, 0, 0);
if (IS_ERR(req))
return ERR_PTR(PTR_ERR(req));
req->r_expects_cap = 1;
/*
* mount: join the ceph cluster.
*/
-int ceph_mount(struct ceph_client *client, struct ceph_mount_args *args, struct vfsmount *mnt)
+int ceph_mount(struct ceph_client *client, struct ceph_mount_args *args,
+ struct vfsmount *mnt)
{
struct ceph_msg *mount_msg;
struct dentry *root;
}
-static int ceph_init_file(struct inode *inode, struct file *file,
- int flags)
+static int ceph_init_file(struct inode *inode, struct file *file, int flags)
{
struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_file_info *cf;
- int mode = ceph_file_mode(flags);
+ int fmode = ceph_file_mode(flags);
cf = kzalloc(sizeof(*cf), GFP_KERNEL);
if (cf == NULL)
return -ENOMEM;
file->private_data = cf;
- cf->mode = mode;
- ceph_get_mode(ci, mode);
+ cf->mode = fmode;
+ ceph_get_mode(ci, fmode);
return 0;
}
struct ceph_mds_request *req;
struct ceph_file_info *cf = file->private_data;
int err;
+ int fmode, wantcaps;
/* filter out O_CREAT|O_EXCL; vfs did that already. yuck. */
int flags = file->f_flags & ~(O_CREAT|O_EXCL);
- int mode = ceph_file_mode(flags);
+ if (S_ISDIR(inode->i_mode))
+ flags = O_DIRECTORY;
+
+ fmode = ceph_file_mode(flags);
+ wantcaps = ceph_caps_for_mode(fmode);
dout(5, "open inode %p ino %llx file %p\n", inode,
ceph_ino(inode), file);
/* can we re-use existing caps? */
spin_lock(&inode->i_lock);
- if ((__ceph_caps_issued(ci) & mode) == mode) {
- dout(10, "open mode %d using existing caps on %p\n",
- mode, inode);
+ if ((__ceph_caps_issued(ci) & wantcaps) == wantcaps) {
+ dout(10, "open fmode %d caps %d using existing on %p\n",
+ fmode, wantcaps, inode);
spin_unlock(&inode->i_lock);
err = ceph_init_file(inode, file, flags);
BUG_ON(err); /* fixme */
return 0;
}
spin_unlock(&inode->i_lock);
- dout(10, "open mode %d, don't have caps\n", mode);
+ dout(10, "open mode %d, don't have caps %d\n", fmode, wantcaps);
req = prepare_open_request(inode->i_sb, dentry, flags, 0);
if (IS_ERR(req))
int flags = nd->intent.open.flags;
dout(5, "ceph_lookup_open dentry %p '%.*s' flags %d mode 0%o\n",
dentry, dentry->d_name.len, dentry->d_name.name, flags, mode);
-
+
/* do the open */
req = prepare_open_request(dir->i_sb, dentry, flags, mode);
if (IS_ERR(req))
static void ceph_destroy_inode(struct inode *inode)
{
struct ceph_inode_info *ci = ceph_inode(inode);
-
- dout(30, "destroy_inode %p ino %lu=%llx\n", inode,
- inode->i_ino, ceph_ino(inode));
-
+ dout(30, "destroy_inode %p ino %llx\n", inode, ceph_ino(inode));
+ cancel_delayed_work_sync(&ci->i_cap_dwork);
kfree(ci->i_symlink);
-
kmem_cache_free(ceph_inode_cachep, ci);
}