diff options
author | Dave Chinner <david@fromorbit.com> | 2014-03-13 04:12:13 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-03-13 04:12:13 -0400 |
commit | 730357a5cb72d9754a396a350653ff98a9e44783 (patch) | |
tree | 8d97cc0f756e803c8c2f991cab8f1ba00d6dbbe4 /fs/xfs/xfs_iops.c | |
parent | b6db0551fddfc8826bc07fc99d64d830530b2d77 (diff) | |
parent | 93a8614e3a4dccd526aca34e892ac0b27f64b506 (diff) |
Merge branch 'xfs-stack-fixes' into for-next
Diffstat (limited to 'fs/xfs/xfs_iops.c')
-rw-r--r-- | fs/xfs/xfs_iops.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 9ddfb8190ca1..bb3bb658e39c 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -48,6 +48,18 @@ | |||
48 | #include <linux/fiemap.h> | 48 | #include <linux/fiemap.h> |
49 | #include <linux/slab.h> | 49 | #include <linux/slab.h> |
50 | 50 | ||
51 | /* | ||
52 | * Directories have different lock order w.r.t. mmap_sem compared to regular | ||
53 | * files. This is due to readdir potentially triggering page faults on a user | ||
54 | * buffer inside filldir(), and this happens with the ilock on the directory | ||
55 | * held. For regular files, the lock order is the other way around - the | ||
56 | * mmap_sem is taken during the page fault, and then we lock the ilock to do | ||
57 | * block mapping. Hence we need a different class for the directory ilock so | ||
58 | * that lockdep can tell them apart. | ||
59 | */ | ||
60 | static struct lock_class_key xfs_nondir_ilock_class; | ||
61 | static struct lock_class_key xfs_dir_ilock_class; | ||
62 | |||
51 | static int | 63 | static int |
52 | xfs_initxattrs( | 64 | xfs_initxattrs( |
53 | struct inode *inode, | 65 | struct inode *inode, |
@@ -1191,6 +1203,7 @@ xfs_setup_inode( | |||
1191 | xfs_diflags_to_iflags(inode, ip); | 1203 | xfs_diflags_to_iflags(inode, ip); |
1192 | 1204 | ||
1193 | ip->d_ops = ip->i_mount->m_nondir_inode_ops; | 1205 | ip->d_ops = ip->i_mount->m_nondir_inode_ops; |
1206 | lockdep_set_class(&ip->i_lock.mr_lock, &xfs_nondir_ilock_class); | ||
1194 | switch (inode->i_mode & S_IFMT) { | 1207 | switch (inode->i_mode & S_IFMT) { |
1195 | case S_IFREG: | 1208 | case S_IFREG: |
1196 | inode->i_op = &xfs_inode_operations; | 1209 | inode->i_op = &xfs_inode_operations; |
@@ -1198,6 +1211,7 @@ xfs_setup_inode( | |||
1198 | inode->i_mapping->a_ops = &xfs_address_space_operations; | 1211 | inode->i_mapping->a_ops = &xfs_address_space_operations; |
1199 | break; | 1212 | break; |
1200 | case S_IFDIR: | 1213 | case S_IFDIR: |
1214 | lockdep_set_class(&ip->i_lock.mr_lock, &xfs_dir_ilock_class); | ||
1201 | if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb)) | 1215 | if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb)) |
1202 | inode->i_op = &xfs_dir_ci_inode_operations; | 1216 | inode->i_op = &xfs_dir_ci_inode_operations; |
1203 | else | 1217 | else |