diff options
author | Bob Peterson <rpeterso@redhat.com> | 2011-03-17 16:19:58 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-04-18 10:23:50 -0400 |
commit | 44ad37d69b2cc421d5b5c7ad7fed16230685b092 (patch) | |
tree | 3632c63eef9e159947316f18d48054f082c0578e /fs/gfs2/rgrp.c | |
parent | 001e8e8df4283dd4ef7a0297c012fce364c05cf1 (diff) |
GFS2: filesystem hang caused by incorrect lock order
This patch fixes a deadlock in GFS2 where two processes are trying
to reclaim an unlinked dinode:
One holds the inode glock and calls gfs2_lookup_by_inum trying to look
up the inode, which it can't, due to I_FREEING. The other has set
I_FREEING from vfs and is at the beginning of gfs2_delete_inode
waiting for the glock, which is held by the first. The solution is to
add a new non_block parameter to the gfs2_iget function that causes it
to return -ENOENT if the inode is being freed.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index cf930cd9664a..6fcae8469f6d 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -945,7 +945,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip | |||
945 | /* rgblk_search can return a block < goal, so we need to | 945 | /* rgblk_search can return a block < goal, so we need to |
946 | keep it marching forward. */ | 946 | keep it marching forward. */ |
947 | no_addr = block + rgd->rd_data0; | 947 | no_addr = block + rgd->rd_data0; |
948 | goal++; | 948 | goal = max(block + 1, goal + 1); |
949 | if (*last_unlinked != NO_BLOCK && no_addr <= *last_unlinked) | 949 | if (*last_unlinked != NO_BLOCK && no_addr <= *last_unlinked) |
950 | continue; | 950 | continue; |
951 | if (no_addr == skip) | 951 | if (no_addr == skip) |
@@ -971,7 +971,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip | |||
971 | found++; | 971 | found++; |
972 | 972 | ||
973 | /* Limit reclaim to sensible number of tasks */ | 973 | /* Limit reclaim to sensible number of tasks */ |
974 | if (found > 2*NR_CPUS) | 974 | if (found > NR_CPUS) |
975 | return; | 975 | return; |
976 | } | 976 | } |
977 | 977 | ||