ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: jeff.liu <jeff.liu@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] Tiny patch for cached ACLs support
Date: Thu, 31 Mar 2011 16:51:35 +0800	[thread overview]
Message-ID: <4D944097.1050903@oracle.com> (raw)
In-Reply-To: <4D943CF1.6040207@tao.ma>

Hi Tao,

Tao Ma wrote:
> Hi Jeff,
> On 03/31/2011 04:28 PM, jeff.liu wrote:
>> 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
> 
> Regards,
> Tao
>> Any comments and testing are appreciated.
>>
>> Thanks,
>> -Jeff
>>
>>
>> Signed-off-by: Jeff Liu <jeff.liu@oracle.com>
>> ---
>>  fs/ocfs2/acl.c   |   12 +++++++++++-
>>  fs/ocfs2/inode.c |    4 ++++
>>  2 files changed, 15 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
>> index 704f6b1..13c58b0 100644
>> --- a/fs/ocfs2/acl.c
>> +++ b/fs/ocfs2/acl.c
>> @@ -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;
>>  }
>> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
>> index 4068c6c..80deac8 100644
>> --- a/fs/ocfs2/inode.c
>> +++ b/fs/ocfs2/inode.c
>> @@ -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);
> 

  reply	other threads:[~2011-03-31  8:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31  8:28 [Ocfs2-devel] Tiny patch for cached ACLs support jeff.liu
2011-03-31  8:36 ` Tao Ma
2011-03-31  8:51   ` jeff.liu [this message]
2011-03-31  8:55     ` Tao Ma
2011-03-31  9:16       ` jeff.liu
2011-03-31  9:31         ` Tristan Ye
2011-03-31 11:31           ` jeff.liu
2011-03-31  8:40 ` Tristan Ye
2011-03-31  8:54   ` jeff.liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D944097.1050903@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).