Bug 53331

Summary: Nointegrity mount option bug
Product: File System Reporter: Nellie Danielyan (Nellie.92.d)
Component: JFSAssignee: Dave Kleikamp (shaggy)
Status: RESOLVED CODE_FIX    
Severity: normal CC: guz.fnst
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.7.0 Subsystem:
Regression: No Bisected commit-id:
Attachments: part of kernel log including call trace
Add check if journaling to disk has been disabled

Description Nellie Danielyan 2013-02-01 13:26:41 UTC
Created attachment 92411 [details]
part of kernel log including call trace 

Architecture : i686
Distributive : Mint 12
File System  : JFS
Detected by the Spruce System (http://linuxtesting.org/spruce)

When mounted with nointegrity mount option a bug was detected. Kernel log says that the problem is a null pointer dereference. 
For example, the bug can be aroused when  FIFREEZE ioctl is called. Generally saying it apparently comes up anytime lmLogShutdown() function is called. It calls lbmRead() funtion where:
 bio->bi_bdev = log->bdev;// log->bdev is already null
 Code disassemble showed that the null pointer is dereference in  bdev_get_queue() inline function called from generic_make_request_checks() function.

call in generic_make_request_checks() :
q = bdev_get_queue(bio->bi_bdev); //so bio->bi_bdev is null now

 static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
725 {
726         return bdev->bd_disk->queue;
727 }
Comment 1 Gu Zheng 2013-05-23 08:22:14 UTC
Hi Nellie,
    If this issue still exists, you can try the following patch.
Thanks,
Gu Zheng



Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
 fs/jfs/jfs_logmgr.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index c57499d..360d27c 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -2009,7 +2009,13 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
 
 	bio->bi_end_io = lbmIODone;
 	bio->bi_private = bp;
-	submit_bio(READ_SYNC, bio);
+	/*check if journaling to disk has been disabled*/
+	if (log->no_integrity) {
+		bio->bi_size = 0;
+		lbmIODone(bio, 0);
+	} else {
+		submit_bio(READ_SYNC, bio);
+	}
 
 	wait_event(bp->l_ioevent, (bp->l_flag != lbmREAD));
 
-- 
1.7.7
Comment 2 Gu Zheng 2013-05-23 08:26:08 UTC
Created attachment 102311 [details]
Add check if journaling to disk has been disabled
Comment 3 Dave Kleikamp 2013-06-07 20:13:28 UTC
Gu's patch has been pulled to the mainline kernel, waiting for v3.10-rc5 to be released.