Tiny patch for cached ACLs support
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Any comments and testing are appreciated.
Thanks,
-Jeff
--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)
fs/ocfs2/acl.c +11 -1
@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);
@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;
@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }
fs/ocfs2/inode.c +4 -0
@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h>
@@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; } +if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);
Signature · 1 line
1.5.4.3
Hi Jeff,
Quoted 4 lines · jeff.liu
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Your codes seem to not handle the case of cross node update? See node A updates ACL, node B should abandon the old one.
Regards,
Tao
Quoted 74 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +4
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; } +if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);
Hi Tao,
Quoted 8 lines · Tao Ma
Hi Jeff,
Quoted 4 lines · jeff.liu
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Your codes seem to not handle the case of cross node update? See node A updates ACL, node B should abandon the old one.
IMHO, cached ACLs are stored at VFS for each node instead of being synchronized among multiple nodes, hence it doesn't need to take care of that.
Thanks,
-Jeff
Quoted 77 lines
Regards,
TaoQuoted 73 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +4
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; } +if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);
Quoted 5 lines · jeff.liu
Hi Tao,
Quoted 2 lines · Tao Ma
Hi Jeff,
On 03/31/2011 04:28 PM, jeff.liu wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Your codes seem to not handle the case of cross node update? See node A updates ACL, node B should abandon the old one.
IMHO, cached ACLs are stored at VFS for each node instead of being synchronized among multiple nodes, hence it doesn't need to take care of that.
yes, it is stored in VFS, so we have to synchronize it like i_size and other inode stuff and that's why the user need a cluster file system.;) cached ACLs is used to speed up acl read, but not to have different acls from different nodes.
Regards,
Tao
Quoted 81 lines
Thanks,
-JeffQuoted 77 lines
Regards,
TaoQuoted 73 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +4
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; } +if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);
Quoted 10 lines · Tao Ma
Quoted 9 lines · jeff.liu
Hi Tao,
Quoted 6 lines · Tao Ma
Hi Jeff,
Quoted 4 lines · jeff.liu
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Your codes seem to not handle the case of cross node update? See node A updates ACL, node B should abandon the old one.
IMHO, cached ACLs are stored at VFS for each node instead of being synchronized among multiple nodes, hence it doesn't need to take care of that.
yes, it is stored in VFS, so we have to synchronize it like
i_sizeand other inode stuff and that's why the user need a cluster file system.;) cached ACLs is used to speed up acl read, but not to have different acls from different nodes.
You are right, I'll figure out a way for the synchronization.
Thanks,
-Jeff
Quoted 81 lines
Regards,
TaoQuoted 77 lines
Thanks,
-JeffQuoted 75 lines
Regards,
TaoQuoted 73 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +4
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; } +if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);
Quoted 13 lines · jeff.liu
Quoted 12 lines · Tao Ma
Quoted 11 lines · jeff.liu
Hi Tao,
Quoted 8 lines · Tao Ma
Hi Jeff,
Quoted 4 lines · jeff.liu
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Your codes seem to not handle the case of cross node update? See node A updates ACL, node B should abandon the old one.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
IMHO, cached ACLs are stored at VFS for each node instead of being synchronized among multiple nodes, hence it doesn't need to take care of that.
yes, it is stored in VFS, so we have to synchronize it like
i_sizeand other inode stuff and that's why the user need a cluster file system.;) cached ACLs is used to speed up acl read, but not to have different acls from different nodes.You are right, I'll figure out a way for the synchronization.
Hi Jeff,
Maybe we can do this in downconverting thread like other caches(dentry,
file-data etc), take the 'ocfs2_refcount_convert_worker' as a reference.
Tristan
Quoted 88 lines
Thanks,
-JeffQuoted 73 lines
Regards,
TaoQuoted 71 lines
Thanks,
-JeffQuoted 69 lines
Regards,
TaoQuoted 67 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +1
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; }Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
fs/ocfs2/inode.c static int ocfs2_wipe_inode(struct inode *inode, · line 792
Quoted 6 lines
fs/ocfs2/inode.c +3
-0+if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel
Quoted 20 lines · Tristan Ye
Quoted 19 lines · jeff.liu
Quoted 18 lines · Tao Ma
Quoted 5 lines · jeff.liu
Hi Tao,
Quoted 2 lines · Tao Ma
Hi Jeff,
On 03/31/2011 04:28 PM, jeff.liu wrote:Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Your codes seem to not handle the case of cross node update? See node A updates ACL, node B should abandon the old one.
IMHO, cached ACLs are stored at VFS for each node instead of being synchronized among multiple nodes, hence it doesn't need to take care of that.
yes, it is stored in VFS, so we have to synchronize it like
i_sizeand other inode stuff and that's why the user need a cluster file system.;) cached ACLs is used to speed up acl read, but not to have different acls from different nodes.
Quoted 6 lines
Quoted 1 line
You are right, I'll figure out a way for the synchronization.
Hi Jeff,
Maybe we can do this in downconverting thread like other caches(dentry,
file-data etc), take the 'ocfs2_refcount_convert_worker' as a reference.
Yes, I have spoke to Tao about that, downcoverting thread is a good candidate to call forget_cached_acl().
Thanks,
-Jeff
Quoted 91 lines
Tristan
Quoted 86 lines
Thanks,
-JeffQuoted 73 lines
Regards,
TaoQuoted 71 lines
Thanks,
-JeffQuoted 69 lines
Regards,
TaoQuoted 67 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +1
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; }Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
fs/ocfs2/inode.c static int ocfs2_wipe_inode(struct inode *inode, · line 792
Quoted 6 lines
fs/ocfs2/inode.c +3
-0+if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel
Quoted 4 lines · jeff.liu
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Hi Jeff,
Take a look at http://oss.oracle.com/git/ocfs2-test.git/programs/acl_tests,
there is a somewhat comprehensive testing script in existence for posix_acl, maybe it can be a bit overkilling for your patch, but please just take it as a double-checker if you wish;-)
Quoted 74 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +4
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; } +if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);
Hi Tristan,
Thanks for you info, I'll definitely try it tonight.
Regards,
-Jeff
Quoted 88 lines · Tristan Ye
Quoted 4 lines · jeff.liu
Hello,
Below is a tiny patch for adding cached ACLs support to OCFS2, I have run a few simple tests like getacl/setacl/chacl on my single node OCFS2, it works for me.
Hi Jeff,
Take a look at http://oss.oracle.com/git/ocfs2-test.git/programs/acl_tests,
there is a somewhat comprehensive testing script in existence forposix_acl, maybe it can be a bit overkilling for your patch, but please just take it as a double-checker if you wish;-)Quoted 73 lines
Any comments and testing are appreciated.
Thanks,
-JeffSigned-off-by Jeff Liu <[email protected]>--- fs/ocfs2/acl.c | 12 +++++++++++- fs/ocfs2/inode.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +11
-1@@ -152,6 +152,10 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return NULL ; + acl =get_cached_acl (inode, type); +if (acl !=ACL_NOT_CACHED ) +return acl; + ret =ocfs2_inode_lock (inode, &di_bh,0 );if (ret <0 ) {mlog_errno (ret);@@ -286,6 +290,9 @@ static int ocfs2_set_acl(handle_t *handle,else ret =ocfs2_xattr_set (inode, name_index,"" , value, size,0 ); +if (!ret) +set_cached_acl (inode, type, acl); +kfree (value);return ret;@@ -348,9 +355,12 @@ int ocfs2_acl_chmod(struct inode *inode)if (!clone)return -ENOMEM ; ret =posix_acl_chmod_masq (clone, inode->i_mode); -if (!ret) +if (!ret) { ret =ocfs2_set_acl (NULL , inode,NULL ,ACL_TYPE_ACCESS , clone,NULL ,NULL ); +set_cached_acl (inode,ACL_TYPE_ACCESS , clone); + } +posix_acl_release (clone);return ret; }fs/ocfs2/inode.c +4
-0@@ -28,6 +28,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/quotaops.h> +#include <linux/posix_acl.h> #include <asm/byteorder.h> @@ -783,6 +784,9 @@ static int ocfs2_wipe_inode(struct inode *inode, goto bail_unlock_dir; } +if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) +forget_all_cached_acls (inode); + status =ocfs2_remove_refcount_tree (inode, di_bh);if (status <0 ) {mlog_errno (status);