diff options
author | Tiger Yang <tiger.yang@oracle.com> | 2006-11-26 20:59:21 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-12-01 21:29:14 -0500 |
commit | d38eb8db6aa359c060dfb72a29cf8d94a96657d8 (patch) | |
tree | 3d27b15ae8fc1718030147a2ed08812c902a7b2e /fs/ocfs2 | |
parent | 58d206c2fa5cc0b35bf3ca48324d7633aa7d0412 (diff) |
ocfs2: implement i_op->permission
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>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/file.c | 24 | ||||
-rw-r--r-- | fs/ocfs2/file.h | 2 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index b64ef7c6e2d2..8786b3c490aa 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -945,6 +945,28 @@ bail: | |||
945 | return err; | 945 | return err; |
946 | } | 946 | } |
947 | 947 | ||
948 | int ocfs2_permission(struct inode *inode, int mask, struct nameidata *nd) | ||
949 | { | ||
950 | int ret; | ||
951 | |||
952 | mlog_entry_void(); | ||
953 | |||
954 | ret = ocfs2_meta_lock(inode, NULL, 0); | ||
955 | if (ret) { | ||
956 | mlog_errno(ret); | ||
957 | goto out; | ||
958 | } | ||
959 | |||
960 | ret = generic_permission(inode, mask, NULL); | ||
961 | if (ret) | ||
962 | mlog_errno(ret); | ||
963 | |||
964 | ocfs2_meta_unlock(inode, 0); | ||
965 | out: | ||
966 | mlog_exit(ret); | ||
967 | return ret; | ||
968 | } | ||
969 | |||
948 | static int ocfs2_write_remove_suid(struct inode *inode) | 970 | static int ocfs2_write_remove_suid(struct inode *inode) |
949 | { | 971 | { |
950 | int ret; | 972 | int ret; |
@@ -1329,11 +1351,13 @@ bail: | |||
1329 | struct inode_operations ocfs2_file_iops = { | 1351 | struct inode_operations ocfs2_file_iops = { |
1330 | .setattr = ocfs2_setattr, | 1352 | .setattr = ocfs2_setattr, |
1331 | .getattr = ocfs2_getattr, | 1353 | .getattr = ocfs2_getattr, |
1354 | .permission = ocfs2_permission, | ||
1332 | }; | 1355 | }; |
1333 | 1356 | ||
1334 | struct inode_operations ocfs2_special_file_iops = { | 1357 | struct inode_operations ocfs2_special_file_iops = { |
1335 | .setattr = ocfs2_setattr, | 1358 | .setattr = ocfs2_setattr, |
1336 | .getattr = ocfs2_getattr, | 1359 | .getattr = ocfs2_getattr, |
1360 | .permission = ocfs2_permission, | ||
1337 | }; | 1361 | }; |
1338 | 1362 | ||
1339 | const struct file_operations ocfs2_fops = { | 1363 | const struct file_operations ocfs2_fops = { |
diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h index 475ed8aee8b5..601a453f18a8 100644 --- a/fs/ocfs2/file.h +++ b/fs/ocfs2/file.h | |||
@@ -48,6 +48,8 @@ int ocfs2_do_extend_allocation(struct ocfs2_super *osb, | |||
48 | int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); | 48 | int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); |
49 | int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, | 49 | int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, |
50 | struct kstat *stat); | 50 | struct kstat *stat); |
51 | int ocfs2_permission(struct inode *inode, int mask, | ||
52 | struct nameidata *nd); | ||
51 | 53 | ||
52 | int ocfs2_set_inode_size(handle_t *handle, | 54 | int ocfs2_set_inode_size(handle_t *handle, |
53 | struct inode *inode, | 55 | struct inode *inode, |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 583bffe98091..21db45ddf144 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -2311,4 +2311,5 @@ struct inode_operations ocfs2_dir_iops = { | |||
2311 | .rename = ocfs2_rename, | 2311 | .rename = ocfs2_rename, |
2312 | .setattr = ocfs2_setattr, | 2312 | .setattr = ocfs2_setattr, |
2313 | .getattr = ocfs2_getattr, | 2313 | .getattr = ocfs2_getattr, |
2314 | .permission = ocfs2_permission, | ||
2314 | }; | 2315 | }; |