Re: [PATCH] xfs: inode lockdep annotations broke non-lockdep build

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

 



On Wed, Aug 19, 2015 at 08:23:34PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> Fix CONFIG_LOCKDEP=n build, because asserts I put in to ensure we
> aren't overrunning lockdep subclasses in commit 0952c81 ("xfs:
> clean up inode lockdep annotations") use a define that doesn't
> exist when CONFIG_LOCKDEP=n
> 
> Only check the subclass limits when lockdep is actually enabled.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> ---
>  fs/xfs/xfs_inode.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index dd584da..30555f8 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -362,6 +362,17 @@ int xfs_lots_retries;
>  int xfs_lock_delays;
>  #endif
>  
> +#ifdef CONFIG_LOCKDEP
> +static bool
> +xfs_lockdep_subclass_ok(
> +	int subclass)
> +{
> +	return subclass < MAX_LOCKDEP_SUBCLASSES;
> +}
> +#else
> +#define xfs_lockdep_subclass_ok(subclass)	(true)
> +#endif
> +

FYI, there's a compile warning with debug and verbose warnings disabled:

...
  CC [M]  fs/xfs//xfs_super.o
fs/xfs//xfs_inode.c:367:1: warning: ‘xfs_lockdep_subclass_ok’ defined but not used [-Wunused-function]
 xfs_lockdep_subclass_ok(
 ^
...

Perhaps it's best to just use the #define in both cases?

Brian

>  /*
>   * Bump the subclass so xfs_lock_inodes() acquires each lock with a different
>   * value. This can be called for any type of inode lock combination, including
> @@ -375,11 +386,12 @@ xfs_lock_inumorder(int lock_mode, int subclass)
>  
>  	ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
>  			      XFS_ILOCK_RTSUM)));
> +	ASSERT(xfs_lockdep_subclass_ok(subclass));
>  
>  	if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL)) {
>  		ASSERT(subclass <= XFS_IOLOCK_MAX_SUBCLASS);
> -		ASSERT(subclass + XFS_IOLOCK_PARENT_VAL <
> -						MAX_LOCKDEP_SUBCLASSES);
> +		ASSERT(xfs_lockdep_subclass_ok(subclass +
> +						XFS_IOLOCK_PARENT_VAL));
>  		class += subclass << XFS_IOLOCK_SHIFT;
>  		if (lock_mode & XFS_IOLOCK_PARENT)
>  			class += XFS_IOLOCK_PARENT_VAL << XFS_IOLOCK_SHIFT;
> -- 
> 2.5.0
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux