Skip to content

Commit

Permalink
ocfs2: kill EBUSY from dlmfs_evict_inode
Browse files Browse the repository at this point in the history
When unlinking 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 annoying.

Link: https://lkml.kernel.org/r/20220607171226.86672-1-junxiao.bi@oracle.com
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
biger410 authored and akpm00 committed Jun 17, 2022
1 parent 0fe6ee8 commit 53fd5ff
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions fs/ocfs2/dlmfs/dlmfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 teardown;

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);
teardown = !!(lockres->l_flags & USER_LOCK_IN_TEARDOWN);
spin_unlock(&lockres->l_lock);
if (!teardown) {
status = user_dlm_destroy_lock(lockres);
if (status < 0)
mlog_errno(status);
}
iput(ip->ip_parent);
goto clear_fields;
}
Expand Down

0 comments on commit 53fd5ff

Please sign in to comment.