]> err.no Git - linux-2.6/commitdiff
ocfs2: implement i_op->permission
authorTiger Yang <tiger.yang@oracle.com>
Mon, 27 Nov 2006 01:59:21 +0000 (09:59 +0800)
committerMark Fasheh <mark.fasheh@oracle.com>
Sat, 2 Dec 2006 02:29:14 +0000 (18:29 -0800)
Implement .permission() in ocfs2_file_iops, ocfs2_special_file_iops and
ocfs2_dir_iops.

This helps us avoid some multi-node races with mode change and vfs
operations.

Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/file.c
fs/ocfs2/file.h
fs/ocfs2/namei.c

index b64ef7c6e2d26253b3809ec060a58043c4afb62f..8786b3c490aa5ff32da1277196204173c1ca1440 100644 (file)
@@ -945,6 +945,28 @@ bail:
        return err;
 }
 
+int ocfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
+{
+       int ret;
+
+       mlog_entry_void();
+
+       ret = ocfs2_meta_lock(inode, NULL, 0);
+       if (ret) {
+               mlog_errno(ret);
+               goto out;
+       }
+
+       ret = generic_permission(inode, mask, NULL);
+       if (ret)
+               mlog_errno(ret);
+
+       ocfs2_meta_unlock(inode, 0);
+out:
+       mlog_exit(ret);
+       return ret;
+}
+
 static int ocfs2_write_remove_suid(struct inode *inode)
 {
        int ret;
@@ -1329,11 +1351,13 @@ bail:
 struct inode_operations ocfs2_file_iops = {
        .setattr        = ocfs2_setattr,
        .getattr        = ocfs2_getattr,
+       .permission     = ocfs2_permission,
 };
 
 struct inode_operations ocfs2_special_file_iops = {
        .setattr        = ocfs2_setattr,
        .getattr        = ocfs2_getattr,
+       .permission     = ocfs2_permission,
 };
 
 const struct file_operations ocfs2_fops = {
index 475ed8aee8b5b4b50a9a8ac9e94aae1807fae587..601a453f18a85d3e4ba0bb7d1d9848c0f7f9f3fa 100644 (file)
@@ -48,6 +48,8 @@ int ocfs2_do_extend_allocation(struct ocfs2_super *osb,
 int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
 int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
                  struct kstat *stat);
+int ocfs2_permission(struct inode *inode, int mask,
+                    struct nameidata *nd);
 
 int ocfs2_set_inode_size(handle_t *handle,
                         struct inode *inode,
index 583bffe98091a79f37ebdc9aecd9e43c6e543768..21db45ddf144c2ebbfb96237b6d1c9a8970776ae 100644 (file)
@@ -2311,4 +2311,5 @@ struct inode_operations ocfs2_dir_iops = {
        .rename         = ocfs2_rename,
        .setattr        = ocfs2_setattr,
        .getattr        = ocfs2_getattr,
+       .permission     = ocfs2_permission,
 };