ocfs2: goto out_unlock if ocfs2_get_clusters_nocache failed in ocfs2_fiemap
PATCH 1/1 ocfs2: goto out_unlock if ocfs2_get_clusters_nocache failed in ocfs2_fiemap
Last time we found there is lock/unlock bug in ocfs2_file_aio_write, and then we did a thorough search for all lock resources in ocfs2_inode_info, including rw, inode and open lockres and found this bug. My kernel version is 3.0.13, and it is also in the lastest version 3.9. In ocfs2_fiemap, once ocfs2_get_clusters_nocache failed, it should goto out_unlock instead of out, because we need release buffer head, up read alloc sem and unlock inode.
--- fs/ocfs2/extent_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/extent_map.c +0 -0
@@ -790,7 +790,7 @@ int ocfs2_fiemap(struct inode *inode, struct
fiemap_extent_info *fieinfo,
&hole_size, &rec, &is_last);
if (ret) {
mlog_errno(ret);
- goto out;
+ goto out_unlock;
}
if (rec.e_blkno == 0ULL) {
Signature · 1 line
1.7.9.7
PATCH 1/1 ocfs2: goto out_unlock if ocfs2_get_clusters_nocache failed in ocfs2_fiemap
Quoted 20 lines · Joseph Qi
Last time we found there is lock/unlock bug in
ocfs2_file_aio_write, and then we did a thorough search for all lock resources inocfs2_inode_info, including rw, inode and open lockres and found this bug. My kernel version is 3.0.13, and it is also in the lastest version 3.9. Inocfs2_fiemap, onceocfs2_get_clusters_nocachefailed, it should gotoout_unlockinstead of out, because we need release buffer head, up read alloc sem and unlock inode.Cc stable at vger.kernel.orgSigned-off-by Joseph Qi <[email protected]>--- fs/ocfs2/extent_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ocfs2/extent_map.c +0
-0
fs/ocfs2/extent_map.c int ocfs2_fiemap(struct inode *inode, struct · line 790
Quoted 1 line
fs/ocfs2/extent_map.c +0
-0@@ -790,7 +790,7 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Corrupt patch.
After fixing this issue, you can add:
Quoted 9 lines
fs/ocfs2/extent_map.c +1
-1&hole_size, &rec, &is_last);if (ret) {mlog_errno (ret); - goto out; + goto out_unlock; }if (rec.e_blkno == 0ULL) {
-Jeff