<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi all,<br>
      <br>
      On 10/19/2016 01:19 PM, Eric Ren wrote:
    </div>
    <blockquote
      cite="mid:1476854382-28101-3-git-send-email-zren@suse.com"
      type="cite">
      <pre wrap="">diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index bed1fcb..7e3544e 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -283,16 +283,24 @@ int ocfs2_set_acl(handle_t *handle,
 int ocfs2_iop_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 {
         struct buffer_head *bh = NULL;
+        struct ocfs2_holder *oh;
+        struct ocfs2_lock_res *lockres = &amp;OCFS2_I(inode)-&gt;ip_inode_lockres;
         int status = 0;
 
-        status = ocfs2_inode_lock(inode, &amp;bh, 1);
-        if (status &lt; 0) {
-                if (status != -ENOENT)
-                        mlog_errno(status);
-                return status;
+        oh = ocfs2_is_locked_by_me(lockres);
+        if (!oh) {
+                status = ocfs2_inode_lock(inode, &amp;bh, 1);
+                if (status &lt; 0) {
+                        if (status != -ENOENT)
+                                mlog_errno(status);
+                        return status;
+                }
         }</pre>
    </blockquote>
    This is wrong. We also depend ocfs2_inode_lock() pass out "bh" for
    later use.<br>
    <br>
    So, we may need another function something like ocfs2_inode_getbh():<br>
         if (!oh)<br>
            ocfs2_inode_lock();<br>
       else <br>
           ocfs2_inode_getbh();<br>
    <br>
    Eric<br>
    <blockquote
      cite="mid:1476854382-28101-3-git-send-email-zren@suse.com"
      type="cite">
      <pre wrap="">
+
         status = ocfs2_set_acl(NULL, inode, bh, type, acl, NULL, NULL);
-        ocfs2_inode_unlock(inode, 1);
+
+        if (!oh)
+                ocfs2_inode_unlock(inode, 1);
         brelse(bh);
         return status;
 }
@@ -302,21 +310,28 @@ struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
         struct ocfs2_super *osb;
         struct buffer_head *di_bh = NULL;
         struct posix_acl *acl;
+        struct ocfs2_holder *oh;
+        struct ocfs2_lock_res *lockres = &amp;OCFS2_I(inode)-&gt;ip_inode_lockres;
         int ret;
 
         osb = OCFS2_SB(inode-&gt;i_sb);
         if (!(osb-&gt;s_mount_opt &amp; OCFS2_MOUNT_POSIX_ACL))
                 return NULL;
-        ret = ocfs2_inode_lock(inode, &amp;di_bh, 0);
-        if (ret &lt; 0) {
-                if (ret != -ENOENT)
-                        mlog_errno(ret);
-                return ERR_PTR(ret);
+
+        oh = ocfs2_is_locked_by_me(lockres);
+        if (!oh) {
+                ret = ocfs2_inode_lock(inode, &amp;di_bh, 0);
+                if (ret &lt; 0) {
+                        if (ret != -ENOENT)
+                                mlog_errno(ret);
+                        return ERR_PTR(ret);
+                }
         }
 
         acl = ocfs2_get_acl_nolock(inode, type, di_bh);
 
-        ocfs2_inode_unlock(inode, 0);
+        if (!oh)
+                ocfs2_inode_unlock(inode, 0);
         brelse(di_bh);
         return acl;
 }
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>