Fix the nested PR lock calling issue
PATCH v2 1/1 Fix the nested PR lock calling issue
Hi,
This is an improved patch for the bug
https://bugzilla.novell.com/show_bug.cgi?id=614332
(also http://oss.oracle.com/bugzilla/show_bug.cgi?id=1278)
It is a nested PR lock calling issue, the referenced stack trace is as:
smbd D ffff8800013d0600 0 9522 5608 0x00000000
ffff88002ca7fb18 0000000000000282 ffff88002f964500 ffff88002ca7fa98 ffff8800013d0600 ffff88002ca7fae0 ffff88002f964340 ffff88002f964340 ffff88002ca7ffd8 ffff88002ca7ffd8 ffff88002f964340 ffff88002f964340
Call Trace: [<ffffffff80350425>] schedule_timeout+0x175/0x210 [<ffffffff8034f580>] wait_for_common+0xf0/0x210 [<ffffffffa03e12b9>] __ocfs2_cluster_lock+0x3b9/0xa90 [ocfs2] [<ffffffffa03e7665>] ocfs2_inode_lock_full_nested+0x255/0xdb0 [ocfs2] [<ffffffffa0446019>] ocfs2_get_acl+0x69/0x120 [ocfs2] [<ffffffffa0446368>] ocfs2_check_acl+0x28/0x80 [ocfs2] [<ffffffff800e3507>] acl_permission_check+0x57/0xb0 [<ffffffff800e357d>] generic_permission+0x1d/0xc0 [<ffffffffa03eecea>] ocfs2_permission+0x10a/0x1d0 [ocfs2] [<ffffffff800e3f65>] inode_permission+0x45/0x100 [<ffffffff800d86b3>] sys_chdir+0x53/0x90 [<ffffffff80007458>] system_call_fastpath+0x16/0x1b
[<00007f34a4ef6927>] 0x7f34a4ef6927
Many thanks for your review and comments;)
Thanks,
Jiaju
---
fs/ocfs2/acl.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)
fs/ocfs2/acl.c +17 -4
@@ -290,17 +290,30 @@ 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 ocfs2_super *osb =OCFS2_SB (inode->i_sb); +struct posix_acl *acl; +struct buffer_head *di_bh =NULL ; +int ret = -EAGAIN ; + +if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL )) +return ret; + + ret =ocfs2_read_inode_block (inode, &di_bh); +if (ret <0 ) { +mlog_errno (ret); +return ret; + } + + acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , di_bh);if (IS_ERR (acl))return PTR_ERR (acl);if (acl) { -int ret =posix_acl_permission (inode, acl, mask); + ret =posix_acl_permission (inode, acl, mask);posix_acl_release (acl); -return ret; } -return -EAGAIN ; +return ret; }int ocfs2_acl_chmod (struct inode *inode)
PATCH v2 1/1 Fix the nested PR lock calling issue
Quoted 57 lines · Jiaju Zhang
Hi,
This is an improved patch for the bug
https://bugzilla.novell.com/show_bug.cgi?id=614332
(also http://oss.oracle.com/bugzilla/show_bug.cgi?id=1278)It is a nested PR lock calling issue, the referenced stack trace is as:
smbd Dffff8800013d06000 9522 56080x00000000
ffff88002ca7fb180000000000000282ffff88002f964500ffff88002ca7fa98ffff8800013d0600ffff88002ca7fae0ffff88002f964340ffff88002f964340ffff88002ca7ffd8ffff88002ca7ffd8ffff88002f964340ffff88002f964340Call Trace: [<ffffffff80350425>] schedule_timeout+0x175/0x210 [<ffffffff8034f580>] wait_for_common+0xf0/0x210 [<ffffffffa03e12b9>] __ocfs2_cluster_lock+0x3b9/0xa90 [ocfs2] [<ffffffffa03e7665>] ocfs2_inode_lock_full_nested+0x255/0xdb0 [ocfs2] [<ffffffffa0446019>] ocfs2_get_acl+0x69/0x120 [ocfs2] [<ffffffffa0446368>] ocfs2_check_acl+0x28/0x80 [ocfs2] [<ffffffff800e3507>] acl_permission_check+0x57/0xb0 [<ffffffff800e357d>] generic_permission+0x1d/0xc0 [<ffffffffa03eecea>] ocfs2_permission+0x10a/0x1d0 [ocfs2] [<ffffffff800e3f65>] inode_permission+0x45/0x100 [<ffffffff800d86b3>] sys_chdir+0x53/0x90 [<ffffffff80007458>] system_call_fastpath+0x16/0x1b[<
00007f34a4ef6927>]0x7f34a4ef6927Many thanks for your review and comments;)
Thanks,
JiajuSigned-off-by <[email protected]>Cc Joel Becker <[email protected]>Cc Mark Fasheh <[email protected]>Cc Sunil Mushran <[email protected]>Cc Tao Ma <[email protected]>Cc Tiger Yang <[email protected]>Cc Wengang Wang <[email protected]>---
fs/ocfs2/acl.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)fs/ocfs2/acl.c +5
-1@@ -290,17 +290,30 @@ 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 ocfs2_super *osb =OCFS2_SB (inode->i_sb); +struct posix_acl *acl; +struct buffer_head *di_bh =NULL ; +int ret = -EAGAIN ; +
fs/ocfs2/acl.c static int ocfs2_set_acl(handle_t *handle, · line 307
Quoted 10 lines
fs/ocfs2/acl.c +10
-0+if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL )) +return ret; + + ret =ocfs2_read_inode_block (inode, &di_bh); +if (ret <0 ) { +mlog_errno (ret); +return ret; + } + + acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , di_bh);
From here on, you need to release di_bh.
regards,
wengang.
Quoted 15 lines
fs/ocfs2/acl.c +2
-3if (IS_ERR (acl))return PTR_ERR (acl);if (acl) { -int ret =posix_acl_permission (inode, acl, mask); + ret =posix_acl_permission (inode, acl, mask);posix_acl_release (acl); -return ret; } -return -EAGAIN ; +return ret; }int ocfs2_acl_chmod (struct inode *inode)
PATCH v2 1/1 Fix the nested PR lock calling issue
Quoted 69 lines · Wengang Wang
Quoted 67 lines · Jiaju Zhang
Hi,
This is an improved patch for the bug
https://bugzilla.novell.com/show_bug.cgi?id=614332
(also http://oss.oracle.com/bugzilla/show_bug.cgi?id=1278)It is a nested PR lock calling issue, the referenced stack trace is as:
smbd Dffff8800013d06000 9522 56080x00000000
ffff88002ca7fb180000000000000282ffff88002f964500ffff88002ca7fa98ffff8800013d0600ffff88002ca7fae0ffff88002f964340ffff88002f964340ffff88002ca7ffd8ffff88002ca7ffd8ffff88002f964340ffff88002f964340Call Trace: [<ffffffff80350425>] schedule_timeout+0x175/0x210 [<ffffffff8034f580>] wait_for_common+0xf0/0x210 [<ffffffffa03e12b9>] __ocfs2_cluster_lock+0x3b9/0xa90 [ocfs2] [<ffffffffa03e7665>] ocfs2_inode_lock_full_nested+0x255/0xdb0 [ocfs2] [<ffffffffa0446019>] ocfs2_get_acl+0x69/0x120 [ocfs2] [<ffffffffa0446368>] ocfs2_check_acl+0x28/0x80 [ocfs2] [<ffffffff800e3507>] acl_permission_check+0x57/0xb0 [<ffffffff800e357d>] generic_permission+0x1d/0xc0 [<ffffffffa03eecea>] ocfs2_permission+0x10a/0x1d0 [ocfs2] [<ffffffff800e3f65>] inode_permission+0x45/0x100 [<ffffffff800d86b3>] sys_chdir+0x53/0x90 [<ffffffff80007458>] system_call_fastpath+0x16/0x1b[<
00007f34a4ef6927>]0x7f34a4ef6927Many thanks for your review and comments;)
Thanks,
JiajuSigned-off-by <[email protected]>Cc Joel Becker <[email protected]>Cc Mark Fasheh <[email protected]>Cc Sunil Mushran <[email protected]>Cc Tao Ma <[email protected]>Cc Tiger Yang <[email protected]>Cc Wengang Wang <[email protected]>---
fs/ocfs2/acl.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)fs/ocfs2/acl.c +15
-1@@ -290,17 +290,30 @@ 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 ocfs2_super *osb =OCFS2_SB (inode->i_sb); +struct posix_acl *acl; +struct buffer_head *di_bh =NULL ; +int ret = -EAGAIN ; + +if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL )) +return ret; + + ret =ocfs2_read_inode_block (inode, &di_bh); +if (ret <0 ) { +mlog_errno (ret); +return ret; + } + + acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , di_bh);
Quoted 1 line
Quoted 1 line
From here on, you need to release
di_bh.
Oh yes, sorry, I should check the code more closely before sending it out;)
Here is the new patch:
--- fs/ocfs2/acl.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-)
fs/ocfs2/acl.c +19 -4
@@ -290,17 +290,32 @@ 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 ocfs2_super *osb =OCFS2_SB (inode->i_sb); +struct posix_acl *acl; +struct buffer_head *di_bh =NULL ; +int ret = -EAGAIN ; + +if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL )) +return ret; + + ret =ocfs2_read_inode_block (inode, &di_bh); +if (ret <0 ) { +mlog_errno (ret); +return ret; + } + + acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , di_bh); + +brelse (di_bh);if (IS_ERR (acl))return PTR_ERR (acl);if (acl) { -int ret =posix_acl_permission (inode, acl, mask); + ret =posix_acl_permission (inode, acl, mask);posix_acl_release (acl); -return ret; } -return -EAGAIN ; +return ret; }int ocfs2_acl_chmod (struct inode *inode)
PATCH v2 1/1 Fix the nested PR lock calling issue
Why not add _ocfs2_get_acl() that does the same without taking the cluster locks?
Quoted 131 lines · Jiaju Zhang
Quoted 70 lines · Wengang Wang
Quoted 68 lines · Jiaju Zhang
Hi,
This is an improved patch for the bug
https://bugzilla.novell.com/show_bug.cgi?id=614332
(also http://oss.oracle.com/bugzilla/show_bug.cgi?id=1278)It is a nested PR lock calling issue, the referenced stack trace is as:
smbd Dffff8800013d06000 9522 56080x00000000
ffff88002ca7fb180000000000000282ffff88002f964500ffff88002ca7fa98ffff8800013d0600ffff88002ca7fae0ffff88002f964340ffff88002f964340ffff88002ca7ffd8ffff88002ca7ffd8ffff88002f964340ffff88002f964340Call Trace: [<ffffffff80350425>] schedule_timeout+0x175/0x210 [<ffffffff8034f580>] wait_for_common+0xf0/0x210 [<ffffffffa03e12b9>] __ocfs2_cluster_lock+0x3b9/0xa90 [ocfs2] [<ffffffffa03e7665>] ocfs2_inode_lock_full_nested+0x255/0xdb0 [ocfs2] [<ffffffffa0446019>] ocfs2_get_acl+0x69/0x120 [ocfs2] [<ffffffffa0446368>] ocfs2_check_acl+0x28/0x80 [ocfs2] [<ffffffff800e3507>] acl_permission_check+0x57/0xb0 [<ffffffff800e357d>] generic_permission+0x1d/0xc0 [<ffffffffa03eecea>] ocfs2_permission+0x10a/0x1d0 [ocfs2] [<ffffffff800e3f65>] inode_permission+0x45/0x100 [<ffffffff800d86b3>] sys_chdir+0x53/0x90 [<ffffffff80007458>] system_call_fastpath+0x16/0x1b[<
00007f34a4ef6927>]0x7f34a4ef6927Many thanks for your review and comments;)
Thanks,
JiajuSigned-off-by <[email protected]>Cc Joel Becker<[email protected]>Cc Mark Fasheh<[email protected]>Cc Sunil Mushran<[email protected]>Cc Tao Ma<[email protected]>Cc Tiger Yang<[email protected]>Cc Wengang Wang<[email protected]>--- fs/ocfs2/acl.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)fs/ocfs2/acl.c +15
-1@@ -290,17 +290,30 @@ 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 ocfs2_super *osb =OCFS2_SB (inode->i_sb); +struct posix_acl *acl; +struct buffer_head *di_bh =NULL ; +int ret = -EAGAIN ; + +if (!(osb->s_mount_opt&OCFS2_MOUNT_POSIX_ACL )) +return ret; + + ret =ocfs2_read_inode_block (inode,&di_bh); +if (ret<0 ) { +mlog_errno (ret); +return ret; + } + + acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , di_bh);Quoted 2 lines
Quoted 1 line
From here on, you need to release
di_bh.Oh yes, sorry, I should check the code more closely before sending it out;)
Here is the new patch:
Signed-off-by Jiaju Zhang<[email protected]>--- fs/ocfs2/acl.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-)fs/ocfs2/acl.c +19
-4@@ -290,17 +290,32 @@ 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 ocfs2_super *osb =OCFS2_SB (inode->i_sb); +struct posix_acl *acl; +struct buffer_head *di_bh =NULL ; +int ret = -EAGAIN ; + +if (!(osb->s_mount_opt&OCFS2_MOUNT_POSIX_ACL )) +return ret; + + ret =ocfs2_read_inode_block (inode,&di_bh); +if (ret<0 ) { +mlog_errno (ret); +return ret; + } + + acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , di_bh); + +brelse (di_bh);if (IS_ERR (acl))return PTR_ERR (acl);if (acl) { -int ret =posix_acl_permission (inode, acl, mask); + ret =posix_acl_permission (inode, acl, mask);posix_acl_release (acl); -return ret; } -return -EAGAIN ; +return ret; }int ocfs2_acl_chmod (struct inode *inode)_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel
PATCH v2 1/1 Fix the nested PR lock calling issue
Quoted 2 lines · Sunil Mushran
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
--- fs/ocfs2/acl.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)
fs/ocfs2/acl.c +24 -1
@@ -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);
PATCH v2 1/1 Fix the nested PR lock calling issue
ocfs2_get_acl_nolock() has the same functionality just with different arguments. And we can't replace it with the new _ocfs2_get_acl() for the call in ocfs2_init_acl().
So I am wondering if we really need the new _ocfs2_get_acl().
regards,
wengang.
Quoted 68 lines · Jiaju Zhang
Quoted 2 lines · Sunil Mushran
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,
JiajuSigned-off-by Jiaju Zhang <[email protected]>--- fs/ocfs2/acl.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)fs/ocfs2/acl.c +24
-1@@ -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);_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel
PATCH v2 1/1 Fix the nested PR lock calling issue
Quoted 3 lines · Wengang Wang
ocfs2_get_acl_nolock()has the same functionality just with different arguments. And we can't replace it with the new_ocfs2_get_acl()for the call inocfs2_init_acl().
I don't mean replace ocfs2_get_acl_nolock() with _ocfs2_get_acl(). What I'm just thinking is if we have the necessity of rename current ocfs2_get_acl_nolock() with _ocfs2_get_acl(), and also rename current _ocfs2_get_acl() in my patch with ocfs2_get_acl_nolock(). Anyway, it is just a very minor change, I'm not sure if we should do it or not.
Quoted 1 line
So I am wondering if we really need the new
_ocfs2_get_acl().
IMO, we may need _ocfs2_get_acl(). It will make the code looks clearer;)
Thanks,
Jiaju
PATCH v2 1/1 Fix the nested PR lock calling issue
My reply is mainly to Sunil. Sorry for the confusing! Your patch is good if we need the _ocfs2_get_acl and don't touch ocfs2_get_acl_nolock :)
regards,
wengang.
Quoted 17 lines · Jiaju Zhang
Quoted 3 lines · Wengang Wang
ocfs2_get_acl_nolock()has the same functionality just with different arguments. And we can't replace it with the new_ocfs2_get_acl()for the call inocfs2_init_acl().I don't mean replace
ocfs2_get_acl_nolock()with_ocfs2_get_acl(). What I'm just thinking is if we have the necessity of rename currentocfs2_get_acl_nolock()with_ocfs2_get_acl(), and also rename current_ocfs2_get_acl()in my patch withocfs2_get_acl_nolock(). Anyway, it is just a very minor change, I'm not sure if we should do it or not.Quoted 1 line
So I am wondering if we really need the new
_ocfs2_get_acl().IMO, we may need
_ocfs2_get_acl(). It will make the code looks clearer;)Thanks,
Jiaju
PATCH v2 1/1 Fix the nested PR lock calling issue
In reply to Sunil MushranHi, Sunil,
I think put them in ocfs2_check_acl() is better.
First, check mount option in ocfs2_check_acl() is more clear than in _ocfs2_get_acl().
Second, we already have ocfs2_get_acl and ocfs2_get_acl_nolock, so it seems _ocfs2_get_acl is redundant and could cause confusing for reading the code.
Regards,
tiger
Quoted 3 lines · Sunil Mushran
Why not add
_ocfs2_get_acl()that does the same without taking the cluster locks?
PATCH v2 1/1 Fix the nested PR lock calling issue
ok. Then review Jiaju's earlier patch.
Quoted 16 lines · Tiger Yang
Hi, Sunil,
I think put them in
ocfs2_check_acl()is better.
First, check mount option inocfs2_check_acl()is more clear than in_ocfs2_get_acl().
Second, we already haveocfs2_get_aclandocfs2_get_acl_nolock, so it seems_ocfs2_get_aclis redundant and could cause confusing for reading the code.Regards,
tigerQuoted 2 lines · Sunil Mushran
Why not add
_ocfs2_get_acl()that does the same without taking the cluster locks?
PATCH v2 1/1 Fix the nested PR lock calling issue
Quoted 1 line · Sunil Mushran
ok. Then review Jiaju's earlier patch.
Thanks a lot for all the review and comments. I'll start a new drop of that patch for easily reviewing:-)
Thanks,
Jiaju