ocfs2: move the mlog from the spinlock to outside
PATCH 1/1 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.
--- fs/ocfs2/dlmglue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +1 -1
@@ -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; }
Signature · 1 line
2.7.4
PATCH 1/1 ocfs2: move the mlog from the spinlock to outside
Quoted 13 lines · On Mon, 30 Sep 2019 11:17:39 +0800 Shuning Zhang <[email protected]>…
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....
fs/ocfs2/dlmglue.c +0
-0@@ -2315,10 +2315,10 @@ static int ocfs2_inode_lock_update(struct inode *inode,
fs/ocfs2/dlmglue.c static int ocfs2_inode_lock_update(struct inode *inode, · line 2324
Quoted 10 lines
fs/ocfs2/dlmglue.c +1
-1spin_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?
Joseph Qi
maintainerPATCH 1/1 ocfs2: move the mlog from the spinlock to outside
Quoted 15 lines · Andrew Morton
Quoted 13 lines · On Mon, 30 Sep 2019 11:17:39 +0800 Shuning Zhang <[email protected]>…
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....
fs/ocfs2/dlmglue.c +0
-0@@ -2315,10 +2315,10 @@ static int ocfs2_inode_lock_update(struct inode *inode,
Quoted 14 lines
fs/ocfs2/dlmglue.c static int ocfs2_inode_lock_update(struct inode *inode, · line 2324
Quoted 10 lines
fs/ocfs2/dlmglue.c +1
-1spin_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?
I guess Shuning refers the calling of printk with spin lock.
Quoted 6 lines
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel
PATCH 1/1 ocfs2: move the mlog from the spinlock to outside
? 2019/10/8 ??9:14, Joseph Qi ??:
Quoted 30 lines · Andrew Morton
Quoted 15 lines · On Mon, 30 Sep 2019 11:17:39 +0800 Shuning Zhang <[email protected]>…
Quoted 14 lines
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....
fs/ocfs2/dlmglue.c +0
-0@@ -2315,10 +2315,10 @@ static int ocfs2_inode_lock_update(struct inode *inode,Quoted 13 lines
fs/ocfs2/dlmglue.c static int ocfs2_inode_lock_update(struct inode *inode, · line 2324
Quoted 10 lines
fs/ocfs2/dlmglue.c +1
-1spin_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?
Quoted 1 line
I guess Shuning refers the calling of printk with spin lock.
Yes, It is the calling of printk.
Sorry for the description is not clear enough. :)
Quoted 5 lines
Quoted 5 lines
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel
Joseph Qi
maintainerPATCH 1/1 ocfs2: move the mlog from the spinlock to outside
Quoted 31 lines · sunnyZhang
? 2019/10/8 ??9:14, Joseph Qi ??:
Quoted 29 lines · Andrew Morton
Quoted 27 lines · On Mon, 30 Sep 2019 11:17:39 +0800 Shuning Zhang <[email protected]>…
Quoted 16 lines
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....
fs/ocfs2/dlmglue.c +1
-0@@ -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);Quoted 7 lines
????????? 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?
Quoted 6 lines
Quoted 1 line
I guess Shuning refers the calling of printk with spin lock.
Yes, It is the calling of printk.
Sorry for the description is not clear enough. :)
IIUC, we can call printk with spinlock, no deadlock will happen. So I have the same question, where is the "potential deadlock"?
Thanks,
Joseph
PATCH 1/1 ocfs2: move the mlog from the spinlock to outside
? 2019/10/8 ??5:51, Joseph Qi ??:
Quoted 31 lines · sunnyZhang
Quoted 29 lines
? 2019/10/8 ??9:14, Joseph Qi ??:
Quoted 28 lines · Andrew Morton
Quoted 27 lines · On Mon, 30 Sep 2019 11:17:39 +0800 Shuning Zhang <[email protected]>…
Quoted 13 lines
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....
fs/ocfs2/dlmglue.c static int ocfs2_inode_lock_update(struct inode *inode, · line 2323
Quoted 10 lines
fs/ocfs2/dlmglue.c +1
-1@@ -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?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I guess Shuning refers the calling of printk with spin lock.
Yes, It is the calling of printk.
Sorry for the description is not clear enough. :)
IIUC, we can call printk with spinlock, no deadlock will happen. So I have the same question, where is the "potential deadlock"?
I apology for my stupidity.
I have always had a wrong memory, I think printk() can sleep.
@Andrew Please can you help me to withdraw this patch?
Thanks
Quoted 3 lines
Thanks,
Joseph