diff options
author | Martin Brandenburg <martin@omnibond.com> | 2016-01-30 13:46:54 -0500 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2016-02-04 14:12:37 -0500 |
commit | 933287da750edefbf0f449750fd67b4fc6c10013 (patch) | |
tree | bff11480a25729ac8adaeb25b1eb267a200b8679 | |
parent | fe88adc3661ff9eb2a9777277f9c3abf5909449f (diff) |
orangefs: Implement inode_operations->permission().
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>
-rw-r--r-- | fs/orangefs/dcache.c | 3 | ||||
-rw-r--r-- | fs/orangefs/inode.c | 19 | ||||
-rw-r--r-- | fs/orangefs/namei.c | 1 | ||||
-rw-r--r-- | fs/orangefs/orangefs-kernel.h | 2 | ||||
-rw-r--r-- | fs/orangefs/protocol.h | 9 | ||||
-rw-r--r-- | fs/orangefs/symlink.c | 1 |
6 files changed, 34 insertions, 1 deletions
diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c index e8fb79de37c6..a6911dbbf3e5 100644 --- a/fs/orangefs/dcache.c +++ b/fs/orangefs/dcache.c | |||
@@ -119,8 +119,9 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
119 | goto out; | 119 | goto out; |
120 | 120 | ||
121 | /* Now we must perform a getattr to validate the inode contents. */ | 121 | /* Now we must perform a getattr to validate the inode contents. */ |
122 | |||
122 | ret = orangefs_inode_getattr(dentry->d_inode, | 123 | ret = orangefs_inode_getattr(dentry->d_inode, |
123 | ORANGEFS_ATTR_SYS_ALL_NOHINT, 1); | 124 | ORANGEFS_ATTR_SYS_TYPE|ORANGEFS_ATTR_SYS_LNK_TARGET, 1); |
124 | if (ret < 0) { | 125 | if (ret < 0) { |
125 | gossip_debug(GOSSIP_DCACHE_DEBUG, "%s:%s:%d getattr failure.\n", | 126 | gossip_debug(GOSSIP_DCACHE_DEBUG, "%s:%s:%d getattr failure.\n", |
126 | __FILE__, __func__, __LINE__); | 127 | __FILE__, __func__, __LINE__); |
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 040cd95b51c2..e9688f0b99d7 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c | |||
@@ -291,6 +291,24 @@ int orangefs_getattr(struct vfsmount *mnt, | |||
291 | return ret; | 291 | return ret; |
292 | } | 292 | } |
293 | 293 | ||
294 | int orangefs_permission(struct inode *inode, int mask) | ||
295 | { | ||
296 | int ret; | ||
297 | |||
298 | if (mask & MAY_NOT_BLOCK) | ||
299 | return -ECHILD; | ||
300 | |||
301 | gossip_debug(GOSSIP_INODE_DEBUG, "%s: refreshing\n", __func__); | ||
302 | |||
303 | /* Make sure the permission (and other common attrs) are up to date. */ | ||
304 | ret = orangefs_inode_getattr(inode, | ||
305 | ORANGEFS_ATTR_SYS_ALL_NOHINT_NOSIZE, 0); | ||
306 | if (ret < 0) | ||
307 | return ret; | ||
308 | |||
309 | return generic_permission(inode, mask); | ||
310 | } | ||
311 | |||
294 | /* ORANGEDS2 implementation of VFS inode operations for files */ | 312 | /* ORANGEDS2 implementation of VFS inode operations for files */ |
295 | struct inode_operations orangefs_file_inode_operations = { | 313 | struct inode_operations orangefs_file_inode_operations = { |
296 | .get_acl = orangefs_get_acl, | 314 | .get_acl = orangefs_get_acl, |
@@ -301,6 +319,7 @@ struct inode_operations orangefs_file_inode_operations = { | |||
301 | .getxattr = generic_getxattr, | 319 | .getxattr = generic_getxattr, |
302 | .listxattr = orangefs_listxattr, | 320 | .listxattr = orangefs_listxattr, |
303 | .removexattr = generic_removexattr, | 321 | .removexattr = generic_removexattr, |
322 | .permission = orangefs_permission, | ||
304 | }; | 323 | }; |
305 | 324 | ||
306 | static int orangefs_init_iops(struct inode *inode) | 325 | static int orangefs_init_iops(struct inode *inode) |
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 50bc45d02009..8fc55c6f58db 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c | |||
@@ -443,4 +443,5 @@ struct inode_operations orangefs_dir_inode_operations = { | |||
443 | .getxattr = generic_getxattr, | 443 | .getxattr = generic_getxattr, |
444 | .removexattr = generic_removexattr, | 444 | .removexattr = generic_removexattr, |
445 | .listxattr = orangefs_listxattr, | 445 | .listxattr = orangefs_listxattr, |
446 | .permission = orangefs_permission, | ||
446 | }; | 447 | }; |
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index d4db96223dac..a8cde9019efe 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h | |||
@@ -493,6 +493,8 @@ int orangefs_getattr(struct vfsmount *mnt, | |||
493 | struct dentry *dentry, | 493 | struct dentry *dentry, |
494 | struct kstat *kstat); | 494 | struct kstat *kstat); |
495 | 495 | ||
496 | int orangefs_permission(struct inode *inode, int mask); | ||
497 | |||
496 | /* | 498 | /* |
497 | * defined in xattr.c | 499 | * defined in xattr.c |
498 | */ | 500 | */ |
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h index 56dd65abb908..6ac0c60c9f5e 100644 --- a/fs/orangefs/protocol.h +++ b/fs/orangefs/protocol.h | |||
@@ -205,6 +205,15 @@ typedef __s64 ORANGEFS_offset; | |||
205 | ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \ | 205 | ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \ |
206 | ORANGEFS_ATTR_SYS_DIRENT_COUNT | \ | 206 | ORANGEFS_ATTR_SYS_DIRENT_COUNT | \ |
207 | ORANGEFS_ATTR_SYS_BLKSIZE) | 207 | ORANGEFS_ATTR_SYS_BLKSIZE) |
208 | |||
209 | #define ORANGEFS_ATTR_SYS_ALL_NOHINT_NOSIZE \ | ||
210 | (ORANGEFS_ATTR_SYS_COMMON_ALL | \ | ||
211 | ORANGEFS_ATTR_SYS_LNK_TARGET | \ | ||
212 | ORANGEFS_ATTR_SYS_DFILE_COUNT | \ | ||
213 | ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \ | ||
214 | ORANGEFS_ATTR_SYS_DIRENT_COUNT | \ | ||
215 | ORANGEFS_ATTR_SYS_BLKSIZE) | ||
216 | |||
208 | #define ORANGEFS_XATTR_REPLACE 0x2 | 217 | #define ORANGEFS_XATTR_REPLACE 0x2 |
209 | #define ORANGEFS_XATTR_CREATE 0x1 | 218 | #define ORANGEFS_XATTR_CREATE 0x1 |
210 | #define ORANGEFS_MAX_SERVER_ADDR_LEN 256 | 219 | #define ORANGEFS_MAX_SERVER_ADDR_LEN 256 |
diff --git a/fs/orangefs/symlink.c b/fs/orangefs/symlink.c index 1b3ae63463dc..2b8541a7fc43 100644 --- a/fs/orangefs/symlink.c +++ b/fs/orangefs/symlink.c | |||
@@ -28,4 +28,5 @@ struct inode_operations orangefs_symlink_inode_operations = { | |||
28 | .getattr = orangefs_getattr, | 28 | .getattr = orangefs_getattr, |
29 | .listxattr = orangefs_listxattr, | 29 | .listxattr = orangefs_listxattr, |
30 | .setxattr = generic_setxattr, | 30 | .setxattr = generic_setxattr, |
31 | .permission = orangefs_permission, | ||
31 | }; | 32 | }; |