Mount problem with the GFS2 code
RFC PATCH 1/1 Mount problem with the GFS2 code
Hi all
While mounting the gfs2 filesystem,our test team had a problem and we
got this error message.
=======================================================
GFS2: fsid=: Trying to join cluster "lock_nolock", "dasde1"
GFS2: fsid=dasde1.0: Joined cluster. Now mounting FS...
GFS2: not a GFS2 filesystem
GFS2: fsid=dasde1.0: can't read superblock: -22
==========================================================================
On debugging further we found that problem is while reading the super block(gfs2_read_super) and comparing the magic number in it.
When I replace the submit_bio() call(present in gfs2_read_super) with the sb_getblk() and ll_rw_block(), mount operation succeded.
On further analysis we found that before calling submit_bio(), bio->bi_sector was set to "sector" variable. This "sector" variable has the same value of bh->b_blocknr(block number). Hence there is a need to multiply this valuwith (blocksize >> 9)(9 because,sector size 2^9,samething happens in ll_rw_block also, before calling submit_bio()). So I have developed the patch which solves this problem. Please let me know your comments.
================================================================
super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/super.c +1 -1
@@ -199,7 +199,7 @@ struct page *gfs2_read_super(struct supereturn NULL ; } - bio->bi_sector = sector; + bio->bi_sector = sector * (sb->s_blocksize >>9 ); bio->bi_bdev = sb->s_bdev;bio_add_page (bio, page,PAGE_SIZE ,0 );
Quoted 5 lines · On Thu, 30 Nov 2006 15:04:55 +0530 Srinivasa Ds <[email protected]> wrote:
==========================================================================
On debugging further we found that problem is while reading the superblock(gfs2_read_super)and comparing the magic number in it. When I replace thesubmit_bio()call(present in gfs2_read_super)with thesb_getblk()andll_rw_block(), mount operation succeded.
umm, why on earth does gfs2_read_super() go direct-to-BIO?
Switching to sb_getblk()+ll_rw_blk() sounds like a preferable fix.
Even better would be switching to a bare sb_bread(). If sb->s_blocksize
isn't set up by then then either set it up or, if you must, use __bread().
Hi,
Quoted 11 lines · Andrew Morton
Quoted 5 lines · On Thu, 30 Nov 2006 15:04:55 +0530 Srinivasa Ds <[email protected]> wrote:
==========================================================================
On debugging further we found that problem is while reading the superblock(gfs2_read_super)and comparing the magic number in it. When I replace thesubmit_bio()call(present in gfs2_read_super)with thesb_getblk()andll_rw_block(), mount operation succeded.umm, why on earth does
gfs2_read_super()go direct-to-BIO?
We want to make 100% certain that we are not reading cached data in either of the two cases in which we read the sb. It is read from disk exactly twice on each mount of a GFS2 filesystem and is never touched again while the fs is mounted. GFS2 never writes the sb, it is created by mkfs and never changes.
The reason its read twice, is that the first time its read to get the details of the locking protocol, the second time its called under a lock in order to discover the location of various bits of metadata on the disk.
Quoted 5 lines
Switching to sb_getblk()+ll_rw_blk() sounds like a preferable fix.
Even better would be switching to a bare
sb_bread(). Ifsb->s_blocksize
isn't set up by then then either set it up or, if you must, use__bread().
I'm not convinced yet... I'd be happy to take the patch as posted assuming that the reason you are suggesting using sb_bread() or similar is that you expected us to want to cache the sb. Was there another reason for not using the bio routines?
Steve.
Quoted 2 lines · On Thu, 30 Nov 2006 09:05:38 +0000 Steven Whitehouse <[email protected]>…
Was there another
reason for not using the bio routines?
Just that it's a layering violation.
Could I commend to you the use of code comments for this sort of thing?
Hi,
Quoted 9 lines · Andrew Morton
Quoted 2 lines · On Thu, 30 Nov 2006 09:05:38 +0000 Steven Whitehouse <[email protected]>…
Was there another
reason for not using the bio routines?Just that it's a layering violation.
Could I commend to you the use of code comments for this sort of thing?
Ok. I'll take the patch, and then add a suitable comment. I'll make a note to change it to use the bh based functions at some stage in the future,
Steve.