diff options
author | Dave Chinner <david@fromorbit.com> | 2014-03-13 19:12:13 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-03-13 19:12:13 +1100 |
commit | 730357a5cb72d9754a396a350653ff98a9e44783 (patch) | |
tree | 8d97cc0f756e803c8c2f991cab8f1ba00d6dbbe4 /fs/xfs/xfs_iops.c | |
parent | b6db0551fddfc8826bc07fc99d64d830530b2d77 (diff) | |
parent | 93a8614e3a4dccd526aca34e892ac0b27f64b506 (diff) | |
download | op-kernel-dev-730357a5cb72d9754a396a350653ff98a9e44783.zip op-kernel-dev-730357a5cb72d9754a396a350653ff98a9e44783.tar.gz |
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 9ddfb81..bb3bb65 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -48,6 +48,18 @@ #include <linux/fiemap.h> #include <linux/slab.h> +/* + * Directories have different lock order w.r.t. mmap_sem compared to regular + * files. This is due to readdir potentially triggering page faults on a user + * buffer inside filldir(), and this happens with the ilock on the directory + * held. For regular files, the lock order is the other way around - the + * mmap_sem is taken during the page fault, and then we lock the ilock to do + * block mapping. Hence we need a different class for the directory ilock so + * that lockdep can tell them apart. + */ +static struct lock_class_key xfs_nondir_ilock_class; +static struct lock_class_key xfs_dir_ilock_class; + static int xfs_initxattrs( struct inode *inode, @@ -1191,6 +1203,7 @@ xfs_setup_inode( xfs_diflags_to_iflags(inode, ip); ip->d_ops = ip->i_mount->m_nondir_inode_ops; + lockdep_set_class(&ip->i_lock.mr_lock, &xfs_nondir_ilock_class); switch (inode->i_mode & S_IFMT) { case S_IFREG: inode->i_op = &xfs_inode_operations; @@ -1198,6 +1211,7 @@ xfs_setup_inode( inode->i_mapping->a_ops = &xfs_address_space_operations; break; case S_IFDIR: + lockdep_set_class(&ip->i_lock.mr_lock, &xfs_dir_ilock_class); if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb)) inode->i_op = &xfs_dir_ci_inode_operations; else |