All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH 1/2] ocfs2: dlmfs: not clear USER_LOCK_ATTACHED when destroy lock
@ 2022-05-10 23:22 Junxiao Bi via Ocfs2-devel
  2022-05-10 23:22 ` [Ocfs2-devel] [PATCH 2/2] ocfs2: dlmfs: fix error handling of user_dlm_destroy_lock Junxiao Bi via Ocfs2-devel
  2022-05-13  2:05 ` [Ocfs2-devel] [PATCH 1/2] ocfs2: dlmfs: not clear USER_LOCK_ATTACHED when destroy lock Joseph Qi via Ocfs2-devel
  0 siblings, 2 replies; 10+ messages in thread
From: Junxiao Bi via Ocfs2-devel @ 2022-05-10 23:22 UTC (permalink / raw)
  To: ocfs2-devel

The following function is the only place that check USER_LOCK_ATTACHED,
this flag is set when lock request is granted through user_bast() and
only the following function will clear it.

Checking of this flag here is to make sure ocfs2_dlm_unlock is not
issued if this lock is never granted. For example, lock file is created
and then get removed, open file never happens.

Clearing the flag here is not necessary because this is the only function
that checks it, if another flow is executing user_dlm_destroy_lock(), it
will bail out at the beginning because of USER_LOCK_IN_TEARDOWN and never
check USER_LOCK_ATTACHED.
Drop the clear, so we don't need take care it for the following
error handling patch.

int user_dlm_destroy_lock(struct user_lock_res *lockres)
{
    ...

    status = 0;
    if (!(lockres->l_flags & USER_LOCK_ATTACHED)) {
        spin_unlock(&lockres->l_lock);
        goto bail;
    }

    lockres->l_flags &= ~USER_LOCK_ATTACHED;
    lockres->l_flags |= USER_LOCK_BUSY;
    spin_unlock(&lockres->l_lock);

	status = ocfs2_dlm_unlock(conn, &lockres->l_lksb, DLM_LKF_VALBLK);
    if (status) {
        user_log_dlm_error("ocfs2_dlm_unlock", status, lockres);
        goto bail;
    }
	...
}

Cc: <stable@vger.kernel.org>
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
---
 fs/ocfs2/dlmfs/userdlm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ocfs2/dlmfs/userdlm.c b/fs/ocfs2/dlmfs/userdlm.c
index 29f183a15798..af0be612589c 100644
--- a/fs/ocfs2/dlmfs/userdlm.c
+++ b/fs/ocfs2/dlmfs/userdlm.c
@@ -619,7 +619,6 @@ int user_dlm_destroy_lock(struct user_lock_res *lockres)
 		goto bail;
 	}
 
-	lockres->l_flags &= ~USER_LOCK_ATTACHED;
 	lockres->l_flags |= USER_LOCK_BUSY;
 	spin_unlock(&lockres->l_lock);
 
-- 
2.24.3 (Apple Git-128)


_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-18 15:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 23:22 [Ocfs2-devel] [PATCH 1/2] ocfs2: dlmfs: not clear USER_LOCK_ATTACHED when destroy lock Junxiao Bi via Ocfs2-devel
2022-05-10 23:22 ` [Ocfs2-devel] [PATCH 2/2] ocfs2: dlmfs: fix error handling of user_dlm_destroy_lock Junxiao Bi via Ocfs2-devel
2022-05-13  2:05 ` [Ocfs2-devel] [PATCH 1/2] ocfs2: dlmfs: not clear USER_LOCK_ATTACHED when destroy lock Joseph Qi via Ocfs2-devel
2022-05-13 16:27   ` Junxiao Bi via Ocfs2-devel
2022-05-15 14:57     ` Joseph Qi via Ocfs2-devel
2022-05-16 16:30       ` Junxiao Bi via Ocfs2-devel
2022-05-17  1:58         ` Joseph Qi via Ocfs2-devel
2022-05-17 16:12           ` Junxiao Bi via Ocfs2-devel
2022-05-18  1:54             ` Joseph Qi via Ocfs2-devel
2022-05-18 15:54               ` Junxiao Bi via Ocfs2-devel

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.