aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorBen Myers <bpm@sgi.com>2013-12-06 15:30:11 -0500
committerBen Myers <bpm@sgi.com>2013-12-18 16:52:36 -0500
commit40194ecc6d78327d98e66de3213db96ca0a31e6f (patch)
treeaee54569d5f12b96146822791a1ca1d27f62e2ed /fs/xfs
parentefa70be165497826f674846f681e6e2364af906c (diff)
xfs: reinstate the ilock in xfs_readdir
Although it was removed in commit 051e7cd44ab8, ilock needs to be taken in xfs_readdir because we might have to read the extent list in from disk. This keeps other threads from reading from or writing to the extent list while it is being read in and is still in a transitional state. This has been associated with "Access to block zero" messages on directories with large numbers of extents resulting from excessive filesytem fragmentation, as well as extent list corruption. Unfortunately no test case at this point. Signed-off-by: Ben Myers <bpm@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_dir2_readdir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index c4e50c6ed584..aead369e1c30 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -674,6 +674,7 @@ xfs_readdir(
674{ 674{
675 int rval; /* return value */ 675 int rval; /* return value */
676 int v; /* type-checking value */ 676 int v; /* type-checking value */
677 uint lock_mode;
677 678
678 trace_xfs_readdir(dp); 679 trace_xfs_readdir(dp);
679 680
@@ -683,6 +684,7 @@ xfs_readdir(
683 ASSERT(S_ISDIR(dp->i_d.di_mode)); 684 ASSERT(S_ISDIR(dp->i_d.di_mode));
684 XFS_STATS_INC(xs_dir_getdents); 685 XFS_STATS_INC(xs_dir_getdents);
685 686
687 lock_mode = xfs_ilock_data_map_shared(dp);
686 if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) 688 if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
687 rval = xfs_dir2_sf_getdents(dp, ctx); 689 rval = xfs_dir2_sf_getdents(dp, ctx);
688 else if ((rval = xfs_dir2_isblock(NULL, dp, &v))) 690 else if ((rval = xfs_dir2_isblock(NULL, dp, &v)))
@@ -691,5 +693,7 @@ xfs_readdir(
691 rval = xfs_dir2_block_getdents(dp, ctx); 693 rval = xfs_dir2_block_getdents(dp, ctx);
692 else 694 else
693 rval = xfs_dir2_leaf_getdents(dp, ctx, bufsize); 695 rval = xfs_dir2_leaf_getdents(dp, ctx, bufsize);
696 xfs_iunlock(dp, lock_mode);
697
694 return rval; 698 return rval;
695} 699}