orangefs: Implement inode_operations->permission().
authorMartin Brandenburg <martin@omnibond.com>
Sat, 30 Jan 2016 18:46:54 +0000 (13:46 -0500)
committerMike Marshall <hubcap@omnibond.com>
Thu, 4 Feb 2016 19:12:37 +0000 (14:12 -0500)
Thus d_revalidate is not obliged to check on as much, which will
eventually lead the way to hammering the filesystem servers much less.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/dcache.c
fs/orangefs/inode.c
fs/orangefs/namei.c
fs/orangefs/orangefs-kernel.h
fs/orangefs/protocol.h
fs/orangefs/symlink.c

index e8fb79de37c6790c00bf19dfe6f0565f12c157cb..a6911dbbf3e527fc9eed965a8a907ba7bc55f944 100644 (file)
@@ -119,8 +119,9 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
                goto out;
 
        /* Now we must perform a getattr to validate the inode contents. */
+
        ret = orangefs_inode_getattr(dentry->d_inode,
-           ORANGEFS_ATTR_SYS_ALL_NOHINT, 1);
+           ORANGEFS_ATTR_SYS_TYPE|ORANGEFS_ATTR_SYS_LNK_TARGET, 1);
        if (ret < 0) {
                gossip_debug(GOSSIP_DCACHE_DEBUG, "%s:%s:%d getattr failure.\n",
                    __FILE__, __func__, __LINE__);
index 040cd95b51c2c6e08897c318b0fe13cd86fdd3e5..e9688f0b99d765fb4839ce2cbfcbc5b14d191ed7 100644 (file)
@@ -291,6 +291,24 @@ int orangefs_getattr(struct vfsmount *mnt,
        return ret;
 }
 
+int orangefs_permission(struct inode *inode, int mask)
+{
+       int ret;
+
+       if (mask & MAY_NOT_BLOCK)
+               return -ECHILD;
+
+       gossip_debug(GOSSIP_INODE_DEBUG, "%s: refreshing\n", __func__);
+
+       /* Make sure the permission (and other common attrs) are up to date. */
+       ret = orangefs_inode_getattr(inode,
+           ORANGEFS_ATTR_SYS_ALL_NOHINT_NOSIZE, 0);
+       if (ret < 0)
+               return ret;
+
+       return generic_permission(inode, mask);
+}
+
 /* ORANGEDS2 implementation of VFS inode operations for files */
 struct inode_operations orangefs_file_inode_operations = {
        .get_acl = orangefs_get_acl,
@@ -301,6 +319,7 @@ struct inode_operations orangefs_file_inode_operations = {
        .getxattr = generic_getxattr,
        .listxattr = orangefs_listxattr,
        .removexattr = generic_removexattr,
+       .permission = orangefs_permission,
 };
 
 static int orangefs_init_iops(struct inode *inode)
index 50bc45d0200950067508c9881ed2c8c8bae8f76d..8fc55c6f58dbc1d7dd528653d8ff2c2f9009f7fa 100644 (file)
@@ -443,4 +443,5 @@ struct inode_operations orangefs_dir_inode_operations = {
        .getxattr = generic_getxattr,
        .removexattr = generic_removexattr,
        .listxattr = orangefs_listxattr,
+       .permission = orangefs_permission,
 };
index d4db96223dac866c3c35fd2f7d52043c1b49306e..a8cde9019efe33f27e6f40f0ef52aa6471808e9f 100644 (file)
@@ -493,6 +493,8 @@ int orangefs_getattr(struct vfsmount *mnt,
                  struct dentry *dentry,
                  struct kstat *kstat);
 
+int orangefs_permission(struct inode *inode, int mask);
+
 /*
  * defined in xattr.c
  */
index 56dd65abb9080719dd9e58b79c84674b95c73bda..6ac0c60c9f5e220e569e8403997b45872c4ac9bd 100644 (file)
@@ -205,6 +205,15 @@ typedef __s64 ORANGEFS_offset;
         ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT  |       \
         ORANGEFS_ATTR_SYS_DIRENT_COUNT         |       \
         ORANGEFS_ATTR_SYS_BLKSIZE)
+
+#define ORANGEFS_ATTR_SYS_ALL_NOHINT_NOSIZE            \
+       (ORANGEFS_ATTR_SYS_COMMON_ALL           |       \
+        ORANGEFS_ATTR_SYS_LNK_TARGET           |       \
+        ORANGEFS_ATTR_SYS_DFILE_COUNT          |       \
+        ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT  |       \
+        ORANGEFS_ATTR_SYS_DIRENT_COUNT         |       \
+        ORANGEFS_ATTR_SYS_BLKSIZE)
+
 #define ORANGEFS_XATTR_REPLACE 0x2
 #define ORANGEFS_XATTR_CREATE  0x1
 #define ORANGEFS_MAX_SERVER_ADDR_LEN 256
index 1b3ae63463dc5b48b77ddbec0553e8b53f7363a1..2b8541a7fc43d0bfdb9241594422046d699f11fc 100644 (file)
@@ -28,4 +28,5 @@ struct inode_operations orangefs_symlink_inode_operations = {
        .getattr = orangefs_getattr,
        .listxattr = orangefs_listxattr,
        .setxattr = generic_setxattr,
+       .permission = orangefs_permission,
 };
This page took 0.031751 seconds and 5 git commands to generate.