Re: [RFC][PATCH] vfs: lockdep annotate of stacked inode_lock()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 1, 2016 at 11:48 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> An overlayfs instance can be the lower layer of another stacked
> overlayfs instance.
>
> This setup triggers a lockdep splat of possible recursive locking
> of sb->s_type->i_mutex_key in iterate_dir().
>
> Fix this by annotating stackable inode_lock() according to stack
> level of the super block instance.
>
> Stackable fs inode_lock() is annotated at lockdep_class level,
> so it is independent of the inner fs I_MUTEX subclass annotations.
>
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---
>  fs/inode.c         | 10 ++++++----
>  include/linux/fs.h | 14 ++++++++++++--
>  2 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/fs/inode.c b/fs/inode.c
> index 88110fd..f46b267 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -169,7 +169,8 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
>         lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key);
>
>         init_rwsem(&inode->i_rwsem);
> -       lockdep_set_class(&inode->i_rwsem, &sb->s_type->i_mutex_key);
> +       lockdep_set_class(&inode->i_rwsem,
> +                         &sb->s_type->i_mutex_key[FS_STACK_NESTING(sb)]);
>

NACK to self. This new annotated lock name looks ugly in lockdep stats.
I'll move the annotation for the special nested case into the file system

Amir.
--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux