All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiaju Zhang <jjzhang.linux@gmail.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH V2] Fix the nested PR lock calling issue
Date: Thu, 22 Jul 2010 13:26:11 +0800	[thread overview]
Message-ID: <20100722052611.GA13238@linux-jjzhang> (raw)
In-Reply-To: <4C473BE2.8000608@oracle.com>

On Wed, Jul 21, 2010 at 11:26:42AM -0700, Sunil Mushran wrote:
> Why not add _ocfs2_get_acl() that does the same without
> taking the cluster locks?

Good suggestion! It will make the code much clearer. I attached the
improved patch as below. One thing I'm not sure is do we need to
exchange the function name '_ocfs2_get_acl' and 'ocfs2_get_acl_nolock'
as well? I'm not sure which is better, so just add a function
_ocfs2_get_acl() in this patch now.

Many thanks for your review and comments;)

Thanks,
Jiaju

Signed-off-by: Jiaju Zhang <jjzhang@suse.de>
---
 fs/ocfs2/acl.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index da70229..b85e092 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -138,6 +138,29 @@ static struct posix_acl *ocfs2_get_acl_nolock(struct inode *inode,
 	return acl;
 }
 
+static struct posix_acl *_ocfs2_get_acl(struct inode *inode, int type)
+{
+	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	struct buffer_head *di_bh = NULL;
+	struct posix_acl *acl;
+	int ret;
+
+	if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
+		return NULL;
+
+	ret = ocfs2_read_inode_block(inode, &di_bh);
+	if (ret < 0) {
+		mlog_errno(ret);
+		acl = ERR_PTR(ret);
+		return acl;
+	}
+
+	acl = ocfs2_get_acl_nolock(inode, type, di_bh);
+
+	brelse(di_bh);
+
+	return acl;
+}
 
 /*
  * Get posix acl.
@@ -290,7 +313,7 @@ static int ocfs2_set_acl(handle_t *handle,
 
 int ocfs2_check_acl(struct inode *inode, int mask)
 {
-	struct posix_acl *acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
+	struct posix_acl *acl = _ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
 
 	if (IS_ERR(acl))
 		return PTR_ERR(acl);

  reply	other threads:[~2010-07-22  5:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 14:48 [Ocfs2-devel] [PATCH V2] Fix the nested PR lock calling issue Jiaju Zhang
2010-07-21 15:17 ` Wengang Wang
2010-07-21 16:05   ` Jiaju Zhang
2010-07-21 18:26     ` Sunil Mushran
2010-07-22  5:26       ` Jiaju Zhang [this message]
2010-07-22 10:11         ` Wengang Wang
2010-07-22 13:16           ` Jiaju Zhang
2010-07-22 13:27             ` Wengang Wang
2010-07-23 22:42       ` Tiger Yang
2010-07-23 23:08         ` Sunil Mushran
2010-07-26  3:26           ` Jiaju Zhang

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=20100722052611.GA13238@linux-jjzhang \
    --to=jjzhang.linux@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.