]> Pileus Git - ~andy/linux/blobdiff - fs/xfs/xfs_dir2_readdir.c
Merge branches 'acpi-resources', 'acpi-ec' and 'acpi-sleep'
[~andy/linux] / fs / xfs / xfs_dir2_readdir.c
index c4e50c6ed5845fb94a46c77a0f4f1ae987d4d87f..aead369e1c30471f5b176661afc4e2ee7beb5afa 100644 (file)
@@ -674,6 +674,7 @@ xfs_readdir(
 {
        int             rval;           /* return value */
        int             v;              /* type-checking value */
+       uint            lock_mode;
 
        trace_xfs_readdir(dp);
 
@@ -683,6 +684,7 @@ xfs_readdir(
        ASSERT(S_ISDIR(dp->i_d.di_mode));
        XFS_STATS_INC(xs_dir_getdents);
 
+       lock_mode = xfs_ilock_data_map_shared(dp);
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
                rval = xfs_dir2_sf_getdents(dp, ctx);
        else if ((rval = xfs_dir2_isblock(NULL, dp, &v)))
@@ -691,5 +693,7 @@ xfs_readdir(
                rval = xfs_dir2_block_getdents(dp, ctx);
        else
                rval = xfs_dir2_leaf_getdents(dp, ctx, bufsize);
+       xfs_iunlock(dp, lock_mode);
+
        return rval;
 }