Skip to content

Commit 64c14ea

Browse files
committed
[GFS2] Fix ref count bug that used to bite us on umount
The ref count of certain glock's got elevated too far during unlink which caused umount to fail. This fixes it. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent b9cb981 commit 64c14ea

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

‎fs/gfs2/inode.c‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -297,19 +297,13 @@ static int inode_create(struct gfs2_glock *i_gl, const struct gfs2_inum *inum,
297297
if (!ip)
298298
return -ENOMEM;
299299
memset(ip, 0, sizeof(struct gfs2_inode));
300-
301300
ip->i_num = *inum;
302-
303301
atomic_set(&ip->i_count, 1);
304-
305302
ip->i_vn = i_gl->gl_vn - 1;
306-
307303
ip->i_gl = i_gl;
308304
ip->i_sbd = sdp;
309-
310305
spin_lock_init(&ip->i_spin);
311306
init_rwsem(&ip->i_rw_mutex);
312-
313307
ip->i_greedy = gfs2_tune_get(sdp, gt_greedy_default);
314308

315309
if (need_lock) {
@@ -318,27 +312,23 @@ static int inode_create(struct gfs2_glock *i_gl, const struct gfs2_inum *inum,
318312
&ip->i_iopen_gh);
319313
if (error)
320314
goto fail;
321-
}
322315

323-
spin_lock(&io_gl->gl_spin);
324-
gfs2_glock_hold(i_gl);
325-
io_gl->gl_object = i_gl;
326-
spin_unlock(&io_gl->gl_spin);
316+
spin_lock(&io_gl->gl_spin);
317+
gfs2_glock_hold(i_gl);
318+
io_gl->gl_object = i_gl;
319+
spin_unlock(&io_gl->gl_spin);
320+
}
327321

328322
gfs2_glock_hold(i_gl);
329323
i_gl->gl_object = ip;
330-
331324
atomic_inc(&sdp->sd_inode_count);
332-
333325
*ipp = ip;
334-
335326
return 0;
336327

337-
fail:
328+
fail:
338329
gfs2_meta_cache_flush(ip);
339330
kmem_cache_free(gfs2_inode_cachep, ip);
340331
*ipp = NULL;
341-
342332
return error;
343333
}
344334

0 commit comments

Comments
 (0)