Skip to contentSkip to conversation

ocfs2: bug fix when bh is null

PATCH In review Ghanshyam Agrawal 3 participants 3 messages Sep 6, 2024 – Sep 9, 2024 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: bug fix when bh is null

---
 fs/ocfs2/buffer_head_io.c | 1 -
 fs/ocfs2/uptodate.c       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
fs/ocfs2/buffer_head_io.c +0 -1
index cdb9b9bdea1f..e62c7e1de4eb 100644
@@ -235,7 +235,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
 		if (bhs[i] == NULL) {
 			bhs[i] = sb_getblk(sb, block++);
 			if (bhs[i] == NULL) {
-				ocfs2_metadata_cache_io_unlock(ci);
 				status = -ENOMEM;
 				mlog_errno(status);
 				/* Don't forget to put previous bh! */
fs/ocfs2/uptodate.c +1 -1
index 09854925fa5c..3242291402c3 100644
@@ -471,7 +471,7 @@ void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,
 
 	/* The block may very well exist in our cache already, so avoid
 	 * doing any more work in that case. */
-	if (ocfs2_buffer_cached(ci, bh))
+	if (bh == NULL || ocfs2_buffer_cached(ci, bh))
 		return;
 
 	trace_ocfs2_set_buffer_uptodate_begin(
Signature · 1 line
2.34.1
#1 lore raw

On Sat 07 Sep 2024 at 03:42, Ghanshyam Agrawal <[email protected]> wrote:

Commit message please even it's simple in one line.

Quoted 3 lines

I think it's fixed by https://lore.kernel.org/ocfs2-devel/[email protected]/T/#t .

--
Su

Quoted 34 lines
---
 fs/ocfs2/buffer_head_io.c | 1 -
 fs/ocfs2/uptodate.c       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
fs/ocfs2/buffer_head_io.c +0 -1
index cdb9b9bdea1f..e62c7e1de4eb 100644
@@ -235,7 +235,6 @@ int ocfs2_read_blocks(struct 
 ocfs2_caching_info *ci, u64 block, int nr,
 		if (bhs[i] == NULL) {
 			bhs[i] = sb_getblk(sb, block++);
 			if (bhs[i] == NULL) {
-				ocfs2_metadata_cache_io_unlock(ci);
 				status = -ENOMEM;
 				mlog_errno(status);
fs/ocfs2/buffer_head_io.c +0 -0
 				/* Don't forget to put previous bh! */
fs/ocfs2/uptodate.c +1 -1
index 09854925fa5c..3242291402c3 100644
@@ -471,7 +471,7 @@ void ocfs2_set_buffer_uptodate(struct 
 ocfs2_caching_info *ci,
 
 	/* The block may very well exist in our cache already, so 
 avoid
 	 * doing any more work in that case. */
-	if (ocfs2_buffer_cached(ci, bh))
+	if (bh == NULL || ocfs2_buffer_cached(ci, bh))
 		return;

trace_ocfs2_set_buffer_uptodate_begin(