Skip to content

Commit 933287d

Browse files
Martin Brandenburghubcapsc
authored andcommitted
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>
1 parent fe88adc commit 933287d

6 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎fs/orangefs/dcache.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
119119
goto out;
120120

121121
/* Now we must perform a getattr to validate the inode contents. */
122+
122123
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);
124125
if (ret < 0) {
125126
gossip_debug(GOSSIP_DCACHE_DEBUG, "%s:%s:%d getattr failure.\n",
126127
__FILE__, __func__, __LINE__);

‎fs/orangefs/inode.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,24 @@ int orangefs_getattr(struct vfsmount *mnt,
291291
return ret;
292292
}
293293

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+
294312
/* ORANGEDS2 implementation of VFS inode operations for files */
295313
struct inode_operations orangefs_file_inode_operations = {
296314
.get_acl = orangefs_get_acl,
@@ -301,6 +319,7 @@ struct inode_operations orangefs_file_inode_operations = {
301319
.getxattr = generic_getxattr,
302320
.listxattr = orangefs_listxattr,
303321
.removexattr = generic_removexattr,
322+
.permission = orangefs_permission,
304323
};
305324

306325
static int orangefs_init_iops(struct inode *inode)

‎fs/orangefs/namei.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,4 +443,5 @@ struct inode_operations orangefs_dir_inode_operations = {
443443
.getxattr = generic_getxattr,
444444
.removexattr = generic_removexattr,
445445
.listxattr = orangefs_listxattr,
446+
.permission = orangefs_permission,
446447
};

‎fs/orangefs/orangefs-kernel.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ int orangefs_getattr(struct vfsmount *mnt,
493493
struct dentry *dentry,
494494
struct kstat *kstat);
495495

496+
int orangefs_permission(struct inode *inode, int mask);
497+
496498
/*
497499
* defined in xattr.c
498500
*/

‎fs/orangefs/protocol.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ typedef __s64 ORANGEFS_offset;
205205
ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \
206206
ORANGEFS_ATTR_SYS_DIRENT_COUNT | \
207207
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+
208217
#define ORANGEFS_XATTR_REPLACE 0x2
209218
#define ORANGEFS_XATTR_CREATE 0x1
210219
#define ORANGEFS_MAX_SERVER_ADDR_LEN 256

‎fs/orangefs/symlink.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ struct inode_operations orangefs_symlink_inode_operations = {
2828
.getattr = orangefs_getattr,
2929
.listxattr = orangefs_listxattr,
3030
.setxattr = generic_setxattr,
31+
.permission = orangefs_permission,
3132
};

0 commit comments

Comments
 (0)