Shuning Zhang
2019-Sep-30 03:17 UTC
[Ocfs2-devel] [PATCH] ocfs2: move the mlog from the spinlock to outside
There is a potential task of deadlock. Because the mask is 0, the deadlock does not occur now. But There is a potential task. If someone change the mask of mlog, but forget to modify the order of the mlog and spin_unlock, There will be a potential deadlock.So I move the mlog from the spinlock to outsize. Signed-off-by: Shuning Zhang <sunny.s.zhang at oracle.com> --- fs/ocfs2/dlmglue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 1420723..9960e61 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -2315,10 +2315,10 @@ static int ocfs2_inode_lock_update(struct inode *inode, spin_lock(&oi->ip_lock); if (oi->ip_flags & OCFS2_INODE_DELETED) { + spin_unlock(&oi->ip_lock); mlog(0, "Orphaned inode %llu was deleted while we " "were waiting on a lock. ip_flags = 0x%x\n", (unsigned long long)oi->ip_blkno, oi->ip_flags); - spin_unlock(&oi->ip_lock); status = -ENOENT; goto bail; } -- 2.7.4
Andrew Morton
2019-Oct-07 22:11 UTC
[Ocfs2-devel] [PATCH] ocfs2: move the mlog from the spinlock to outside
On Mon, 30 Sep 2019 11:17:39 +0800 Shuning Zhang <sunny.s.zhang at oracle.com> wrote:> There is a potential task of deadlock. Because the mask > is 0, the deadlock does not occur now. But There is a > potential task. If someone change the mask of mlog, but > forget to modify the order of the mlog and spin_unlock, > There will be a potential deadlock.So I move the mlog > from the spinlock to outsize. > > ... > > --- a/fs/ocfs2/dlmglue.c > +++ b/fs/ocfs2/dlmglue.c > @@ -2315,10 +2315,10 @@ static int ocfs2_inode_lock_update(struct inode *inode, > > spin_lock(&oi->ip_lock); > if (oi->ip_flags & OCFS2_INODE_DELETED) { > + spin_unlock(&oi->ip_lock); > mlog(0, "Orphaned inode %llu was deleted while we " > "were waiting on a lock. ip_flags = 0x%x\n", > (unsigned long long)oi->ip_blkno, oi->ip_flags); > - spin_unlock(&oi->ip_lock); > status = -ENOENT; > goto bail; > }The patch is obviously OK but I don't see any deadlock. mlog() doesn't take any locks?