fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block
Subsystems (2)
PATCH 57/427 fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block
tree: git://git.cmpxchg.org/linux-mmotm.git master head: 065f1d86a58cc88249cd8371b29a57c97483753a commit: 8a09937cacc099da21313223443237cbc84d5876 [57/427] ocfs2: add orphan recovery types in ocfs2_recover_orphans reproduce: # apt-get install sparse git checkout 8a09937cacc099da21313223443237cbc84d5876 make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__
fs/ocfs2/journal.c:111:6: sparse: symbol 'ocfs2_replay_map_set_state' was not declared. Should it be static? fs/ocfs2/journal.c:156:6: sparse: symbol 'ocfs2_queue_replay_slots' was not declared. Should it be static? fs/ocfs2/journal.c:176:6: sparse: symbol 'ocfs2_free_replay_slots' was not declared. Should it be static? fs/ocfs2/journal.c:1888:6: sparse: symbol 'ocfs2_queue_orphan_scan' was not declared. Should it be static? fs/ocfs2/journal.c:1937:6: sparse: symbol 'ocfs2_orphan_scan_work' was not declared. Should it be static?
Quoted 1 line
Quoted 1 line
fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block
git remote add mmotm git://git.cmpxchg.org/linux-mmotm.git
git remote update mmotm
git checkout 8a09937cacc099da21313223443237cbc84d5876 vim +/ocfs2_recover_orphans +2204 fs/ocfs2/journal.c
8a09937c WeiWei Wang 2014-09-26 2188 * if the orphan scan work, continue to process the
8a09937c WeiWei Wang 2014-09-26 2189 * next orphan.
8a09937c WeiWei Wang 2014-09-26 2190 */
8a09937c WeiWei Wang 2014-09-26 2191 else if (orphan_reco_type == ORPHAN_SCAN_WORK) {
8a09937c WeiWei Wang 2014-09-26 2192 spin_unlock(&oi->ip_lock);
8a09937c WeiWei Wang 2014-09-26 2193 inode = iter;
8a09937c WeiWei Wang 2014-09-26 2194 continue;
8a09937c WeiWei Wang 2014-09-26 2195 }
ccd979bd Mark Fasheh 2005-12-15 2196 spin_unlock(&oi->ip_lock);
ccd979bd Mark Fasheh 2005-12-15 2197
ccd979bd Mark Fasheh 2005-12-15 2198 iput(inode);
ccd979bd Mark Fasheh 2005-12-15 2199
ccd979bd Mark Fasheh 2005-12-15 2200 inode = iter;
ccd979bd Mark Fasheh 2005-12-15 2201 }
ccd979bd Mark Fasheh 2005-12-15 2202
8a09937c WeiWei Wang 2014-09-26 2203 out:Sparse error messages are hard to understand. It's saying that there is a missing unlock if ocfs2_start_trans() fails and we "goto out;"
"out" labels are the worst btw. The name is too vague. Sometimes they do something and sometimes they don't do anything but the name doesn't give any clue what it does. In theory, out labels future proof the code from locking bugs but they don't work. It just means you have to jump around like a rabbit to follow all the goto paths. A return statement is easier to understand.
b4df6ed8 Mark Fasheh 2006-02-22 @2204 return ret;
ccd979bd Mark Fasheh 2005-12-15 2205 }
ccd979bd Mark Fasheh 2005-12-15 2206
19ece546 Jan Kara 2008-08-21 2207 static int __ocfs2_wait_on_mount(struct ocfs2_super *osb, int quota)
ccd979bd Mark Fasheh 2005-12-15 2208 {
ccd979bd Mark Fasheh 2005-12-15 2209 /* This check is good because ocfs2 will wait on our recovery
ccd979bd Mark Fasheh 2005-12-15 2210 * thread before changing it to something other than MOUNTED
ccd979bd Mark Fasheh 2005-12-15 2211 * or DISABLED. */
ccd979bd Mark Fasheh 2005-12-15 2212 wait_event(osb->osb_mount_event,---
0-DAY kernel build testing backend Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
_______________________________________________
kbuild mailing list
[email protected]
https://lists.01.org/mailman/listinfo/kbuild
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 6 lines · On Fri, 26 Sep 2014 17:36:37 +0300 Dan Carpenter <[email protected]>…
commit:
8a09937cacc099da21313223443237cbc84d5876[57/427] ocfs2: add orphan recovery types inocfs2_recover_orphans...
Quoted 1 line
Quoted 1 line
fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block
this?
fs/ocfs2/journal.c renamed from fs/ocfs2/journal.c~ocfs2-add-orphan-recovery-types-in-ocfs2_recover_orphans-fix +7 -6
@@ -2160,8 +2160,7 @@ static int ocfs2_recover_orphans(struct ret =ocfs2_inode_lock (inode, &di_bh,1 );if (ret) {mlog_errno (ret); -spin_unlock (&oi->ip_lock); - goto out; + goto out_unlock; }ocfs2_truncate_file (inode, di_bh,i_size_read (inode));ocfs2_inode_unlock (inode,1 );
@@ -2173,14 +2172,13 @@ static int ocfs2_recover_orphans(struct OCFS2_INODE_DEL_FROM_ORPHAN_CREDITS);if (IS_ERR (handle)) { ret =PTR_ERR (handle); - goto out; + goto out_unlock; } ret =ocfs2_del_inode_from_orphan (osb, handle, inode);if (ret) {mlog_errno (ret);ocfs2_commit_trans (osb, handle); -spin_unlock (&oi->ip_lock); - goto out; + goto out_unlock; }ocfs2_commit_trans (osb, handle); }
@@ -2200,7 +2198,10 @@ static int ocfs2_recover_orphans(struct inode = iter; } -out: +return ret; + +out_unlock: +spin_unlock (&oi->ip_lock);return ret; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Andrew Morton
Quoted 6 lines · On Fri, 26 Sep 2014 17:36:37 +0300 Dan Carpenter <[email protected]>…
commit:
8a09937cacc099da21313223443237cbc84d5876[57/427] ocfs2: add orphan recovery types inocfs2_recover_orphans...
Quoted 1 line
Quoted 1 line
fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic blockthis?
I think there is another deadlock case in ocfs2_recover_orphans.
*spin_lock(&oi->ip_lock)*
ocfs2_inode_lock ocfs2_inode_lock_full_nested ocfs2_inode_lock_update *spin_lock(&oi->ip_lock)*
Since ip_lock only wants to protect ip_flags and the added new logic ocfs2_del_inode_from_orphan has nothing to do with it, distinguish them.
Quoted 44 lines
fs/ocfs2/journal.c renamed from fs/ocfs2/journal.c~ocfs2-add-orphan-recovery-types-in-ocfs2_recover_orphans-fix +7
-7@@ -2160,8 +2160,7 @@ static int ocfs2_recover_orphans(struct ret =ocfs2_inode_lock (inode, &di_bh,1 );if (ret) {mlog_errno (ret); -spin_unlock (&oi->ip_lock); - goto out; + goto out_unlock; }ocfs2_truncate_file (inode, di_bh,i_size_read (inode));ocfs2_inode_unlock (inode,1 );@@ -2173,14 +2172,13 @@ static int ocfs2_recover_orphans(struct OCFS2_INODE_DEL_FROM_ORPHAN_CREDITS);if (IS_ERR (handle)) { ret =PTR_ERR (handle); - goto out; + goto out_unlock; } ret =ocfs2_del_inode_from_orphan (osb, handle, inode);if (ret) {mlog_errno (ret);ocfs2_commit_trans (osb, handle); -spin_unlock (&oi->ip_lock); - goto out; + goto out_unlock; }ocfs2_commit_trans (osb, handle); }@@ -2200,7 +2198,10 @@ static int ocfs2_recover_orphans(struct inode = iter; } -out: +return ret; + +out_unlock: +spin_unlock (&oi->ip_lock);return ret; } --
Quoted 6 lines
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>