All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: kill EBUSY from dlmfs_evict_inode
@ 2022-06-03 22:31 Junxiao Bi via Ocfs2-devel
  2022-06-04 10:10 ` heming.zhao--- via Ocfs2-devel
  2022-06-05 13:46 ` Joseph Qi via Ocfs2-devel
  0 siblings, 2 replies; 12+ messages in thread
From: Junxiao Bi via Ocfs2-devel @ 2022-06-03 22:31 UTC (permalink / raw)
  To: ocfs2-devel

When unlink a dlmfs, first it will invoke dlmfs_unlink(), and then invoke
dlmfs_evict_inode(), user_dlm_destroy_lock() is invoked in both places,
the second one from dlmfs_evict_inode() will get EBUSY error because
USER_LOCK_IN_TEARDOWN is already set in lockres. This doesn't affect
any function, just the error log is anonying.

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
---
 fs/ocfs2/dlmfs/dlmfs.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index e360543ad7e7..a120610dff7e 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -296,17 +296,25 @@ static void dlmfs_evict_inode(struct inode *inode)
 {
 	int status;
 	struct dlmfs_inode_private *ip;
+	struct user_lock_res *lockres;
+	int destroyed;
 
 	clear_inode(inode);
 
 	mlog(0, "inode %lu\n", inode->i_ino);
 
 	ip = DLMFS_I(inode);
+	lockres = &ip->ip_lockres;
 
 	if (S_ISREG(inode->i_mode)) {
-		status = user_dlm_destroy_lock(&ip->ip_lockres);
-		if (status < 0)
-			mlog_errno(status);
+		spin_lock(&lockres->l_lock);
+		destroyed = !!(lockres->l_flags & USER_LOCK_IN_TEARDOWN);
+		spin_unlock(&lockres->l_lock);
+		if (!destroyed) {
+			status = user_dlm_destroy_lock(lockres);
+			if (status < 0)
+				mlog_errno(status);
+		}
 		iput(ip->ip_parent);
 		goto clear_fields;
 	}
-- 
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] 12+ messages in thread

end of thread, other threads:[~2022-06-07  1:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 22:31 [Ocfs2-devel] [PATCH] ocfs2: kill EBUSY from dlmfs_evict_inode Junxiao Bi via Ocfs2-devel
2022-06-04 10:10 ` heming.zhao--- via Ocfs2-devel
2022-06-04 22:27   ` Junxiao Bi via Ocfs2-devel
2022-06-04 23:16     ` heming.zhao--- via Ocfs2-devel
2022-06-05  0:48       ` Junxiao Bi via Ocfs2-devel
2022-06-05  1:12         ` heming.zhao--- via Ocfs2-devel
2022-06-05  1:48         ` Heming Zhao via Ocfs2-devel
2022-06-05  2:40           ` Junxiao Bi via Ocfs2-devel
2022-06-05  3:45             ` heming.zhao--- via Ocfs2-devel
2022-06-05 13:46 ` Joseph Qi via Ocfs2-devel
2022-06-06 15:33   ` Junxiao Bi via Ocfs2-devel
2022-06-07  1:40     ` Joseph Qi 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.