aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/lops.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-02-13 07:27:43 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-02-13 07:27:43 -0500
commit7359a19cc758946aba0e45233b8641256b194884 (patch)
treed96aaeb2fb239efe6fdb0b4698eb94108719f423 /fs/gfs2/lops.c
parent18ec7d5c3f434aed9661ed10a9e1f48cdeb4981d (diff)
[GFS2] Fix for root inode ref count bug
Umount is now working correctly again. The bug was due to not getting an extra ref count when mounting the fs. We should have bumped it by two (once for the internal pointer to the root inode from the super block and once for the inode hanging off the dcache entry for root). Also this patch tidys up the code dealing with looking up and creating inodes. We now pass Linux inodes (with gfs2_inodes attached) rather than the other way around and this reduces code duplication in various places. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/lops.c')
-rw-r--r--fs/gfs2/lops.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index dd41863810d7..23be00141901 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -177,7 +177,7 @@ static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
177static void buf_lo_before_scan(struct gfs2_jdesc *jd, 177static void buf_lo_before_scan(struct gfs2_jdesc *jd,
178 struct gfs2_log_header *head, int pass) 178 struct gfs2_log_header *head, int pass)
179{ 179{
180 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 180 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
181 181
182 if (pass != 0) 182 if (pass != 0)
183 return; 183 return;
@@ -190,8 +190,8 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
190 struct gfs2_log_descriptor *ld, __be64 *ptr, 190 struct gfs2_log_descriptor *ld, __be64 *ptr,
191 int pass) 191 int pass)
192{ 192{
193 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 193 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
194 struct gfs2_glock *gl = jd->jd_inode->i_gl; 194 struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl;
195 unsigned int blks = be32_to_cpu(ld->ld_data1); 195 unsigned int blks = be32_to_cpu(ld->ld_data1);
196 struct buffer_head *bh_log, *bh_ip; 196 struct buffer_head *bh_log, *bh_ip;
197 uint64_t blkno; 197 uint64_t blkno;
@@ -236,16 +236,16 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
236 236
237static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 237static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
238{ 238{
239 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 239 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
240 240
241 if (error) { 241 if (error) {
242 gfs2_meta_sync(jd->jd_inode->i_gl, DIO_START | DIO_WAIT); 242 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT);
243 return; 243 return;
244 } 244 }
245 if (pass != 1) 245 if (pass != 1)
246 return; 246 return;
247 247
248 gfs2_meta_sync(jd->jd_inode->i_gl, DIO_START | DIO_WAIT); 248 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT);
249 249
250 fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n", 250 fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n",
251 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); 251 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks);
@@ -320,7 +320,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
320static void revoke_lo_before_scan(struct gfs2_jdesc *jd, 320static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
321 struct gfs2_log_header *head, int pass) 321 struct gfs2_log_header *head, int pass)
322{ 322{
323 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 323 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
324 324
325 if (pass != 0) 325 if (pass != 0)
326 return; 326 return;
@@ -333,7 +333,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
333 struct gfs2_log_descriptor *ld, __be64 *ptr, 333 struct gfs2_log_descriptor *ld, __be64 *ptr,
334 int pass) 334 int pass)
335{ 335{
336 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 336 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
337 unsigned int blks = be32_to_cpu(ld->ld_length); 337 unsigned int blks = be32_to_cpu(ld->ld_length);
338 unsigned int revokes = be32_to_cpu(ld->ld_data1); 338 unsigned int revokes = be32_to_cpu(ld->ld_data1);
339 struct buffer_head *bh; 339 struct buffer_head *bh;
@@ -379,7 +379,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
379 379
380static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 380static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
381{ 381{
382 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 382 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
383 383
384 if (error) { 384 if (error) {
385 gfs2_revoke_clean(sdp); 385 gfs2_revoke_clean(sdp);
@@ -458,8 +458,6 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
458 gfs2_trans_add_gl(bd->bd_gl); 458 gfs2_trans_add_gl(bd->bd_gl);
459 list_add(&bd->bd_list_tr, &tr->tr_list_buf); 459 list_add(&bd->bd_list_tr, &tr->tr_list_buf);
460 gfs2_pin(sdp, bd->bd_bh); 460 gfs2_pin(sdp, bd->bd_bh);
461 } else {
462 clear_buffer_pinned(bd->bd_bh);
463 } 461 }
464 gfs2_log_lock(sdp); 462 gfs2_log_lock(sdp);
465 if (ip->i_di.di_flags & GFS2_DIF_JDATA) 463 if (ip->i_di.di_flags & GFS2_DIF_JDATA)
@@ -630,8 +628,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
630 struct gfs2_log_descriptor *ld, 628 struct gfs2_log_descriptor *ld,
631 __be64 *ptr, int pass) 629 __be64 *ptr, int pass)
632{ 630{
633 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 631 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
634 struct gfs2_glock *gl = jd->jd_inode->i_gl; 632 struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl;
635 unsigned int blks = be32_to_cpu(ld->ld_data1); 633 unsigned int blks = be32_to_cpu(ld->ld_data1);
636 struct buffer_head *bh_log, *bh_ip; 634 struct buffer_head *bh_log, *bh_ip;
637 uint64_t blkno; 635 uint64_t blkno;
@@ -680,17 +678,17 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
680 678
681static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 679static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
682{ 680{
683 struct gfs2_sbd *sdp = jd->jd_inode->i_sbd; 681 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
684 682
685 if (error) { 683 if (error) {
686 gfs2_meta_sync(jd->jd_inode->i_gl, DIO_START | DIO_WAIT); 684 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT);
687 return; 685 return;
688 } 686 }
689 if (pass != 1) 687 if (pass != 1)
690 return; 688 return;
691 689
692 /* data sync? */ 690 /* data sync? */
693 gfs2_meta_sync(jd->jd_inode->i_gl, DIO_START | DIO_WAIT); 691 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT);
694 692
695 fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n", 693 fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n",
696 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); 694 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks);