]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: implement permission iop
authorSage Weil <sage@newdream.net>
Mon, 6 Apr 2009 03:30:21 +0000 (20:30 -0700)
committerSage Weil <sage@newdream.net>
Mon, 6 Apr 2009 03:30:21 +0000 (20:30 -0700)
The permission iop verfies we have a valid uid/gid/mode by checking for
the AUTH cap.  Then calls the generic helper.

This is 100% consistent because we don't carry a cap ref over the
permission checkout.  OTOH, if we don't hold the cap and the mds doesn't
actually issue it, we never will anyway.  Maybe fix this eventually.

src/kernel/dir.c
src/kernel/inode.c
src/kernel/super.h

index d93a6f07c8686d0234583a17ecd402d042e79316..6d098405b894ae9eafabc28c37361a581efbaa8b 100644 (file)
@@ -958,6 +958,7 @@ const struct file_operations ceph_dir_fops = {
 
 const struct inode_operations ceph_dir_iops = {
        .lookup = ceph_lookup,
+       .permission = ceph_permission,
        .getattr = ceph_getattr,
        .setattr = ceph_setattr,
        .setxattr = ceph_setxattr,
index c488206c7b4cee9e7fae32ec6bbbf156f0f15a2f..703f4aff46f4809a6ee676ebb9cbc0a27d717b3d 100644 (file)
@@ -66,6 +66,7 @@ struct inode *ceph_get_snapdir(struct inode *parent)
 
 
 const struct inode_operations ceph_file_iops = {
+       .permission = ceph_permission,
        .setattr = ceph_setattr,
        .getattr = ceph_getattr,
        .setxattr = ceph_setxattr,
@@ -1483,6 +1484,20 @@ int ceph_do_getattr(struct inode *inode, int mask)
        return err;
 }
 
+
+/*
+ * Check inode permissions.  We verify we have a valid value for
+ * the AUTH cap, then call the generic handler.
+ */
+int ceph_permission(struct inode *inode, int mask)
+{
+       int err = ceph_do_getattr(inode, CEPH_CAP_AUTH_RDCACHE);
+
+       if (!err)
+               err = generic_permission(inode, mask, NULL);
+       return err;
+}
+
 /*
  * Get all attributes.  Hopefully somedata we'll have a statlite()
  * and can limit the fields we require to be accurate.
index d81d5150d7b6a5f23a47849db134379932130774..f2345927428ea28eaedb8c4e37140547f13cca8c 100644 (file)
@@ -743,6 +743,7 @@ extern void ceph_vmtruncate_work(struct work_struct *work);
 extern void __ceph_do_pending_vmtruncate(struct inode *inode);
 
 extern int ceph_do_getattr(struct inode *inode, int mask);
+extern int ceph_permission(struct inode *inode, int mask);
 extern int ceph_setattr(struct dentry *dentry, struct iattr *attr);
 extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry,
                        struct kstat *stat);