diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-09-08 13:00:30 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-09-08 13:00:30 -0400 |
commit | acf7e2444acfaf4c8540603b76d71010eea3fc24 (patch) | |
tree | 7c31957ffbbb4008f368b8640c289f72657330a5 /fs/gfs2/super.c | |
parent | 8d8291ae93ecb4a246e87e452d55cca412373300 (diff) |
GFS2: Be extra careful about deallocating inodes
There is a potential race in the inode deallocation code if two
nodes try to deallocate the same inode at the same time. Most of
the issue is solved by the iopen locking. There is still a small
window which is not covered by the iopen lock. This patches fixes
that and also makes the deallocation code more robust in the face of
any errors in the rgrp bitmaps, or erroneous iopen callbacks from
other nodes.
This does introduce one extra disk read, but that is generally not
an issue since its the same block that must be written to later
in the deallocation process. The total disk accesses therefore stay
the same,
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index d95cf777d244..0ec3ec672de1 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1286,6 +1286,10 @@ static void gfs2_delete_inode(struct inode *inode) | |||
1286 | goto out; | 1286 | goto out; |
1287 | } | 1287 | } |
1288 | 1288 | ||
1289 | error = gfs2_check_blk_type(sdp, ip->i_no_addr, GFS2_BLKST_UNLINKED); | ||
1290 | if (error) | ||
1291 | goto out_truncate; | ||
1292 | |||
1289 | gfs2_glock_dq_wait(&ip->i_iopen_gh); | 1293 | gfs2_glock_dq_wait(&ip->i_iopen_gh); |
1290 | gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); | 1294 | gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); |
1291 | error = gfs2_glock_nq(&ip->i_iopen_gh); | 1295 | error = gfs2_glock_nq(&ip->i_iopen_gh); |