mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs/autofs: Fix sparse warning: context imbalance in 'autofs4_d_automount' - different lock contexts for basic block
@ 2013-01-03 14:52 Peter Huewe
  2013-01-03 23:54 ` Ian Kent
  2013-01-09  7:16 ` Ian Kent
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Huewe @ 2013-01-03 14:52 UTC (permalink / raw)
  To: Ian Kent; +Cc: autofs, linux-kernel, Fengguang Wu, Peter Huewe

Sparse complains:
+ fs/autofs4/root.c:409:9: sparse: context imbalance in
'autofs4_d_automount' - different lock contexts for basic block

This was introduced by commit
f55fb0c243 autofs4 - dont clear DCACHE_NEED_AUTOMOUNT on rootless mount

The function autofs4_d_automount can be left with the (&sbi->fs_lock)
held if sbi->version <= 4 and simple_empty(dentry) == false so the warning seems valid.

--> Add an spin_unlock in this case before we jump to done

Unfortunately compile tested only.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 fs/autofs4/root.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index c934476..74a299f 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -383,8 +383,10 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
 				goto done;
 			}
 		} else {
-			if (!simple_empty(dentry))
+			if (!simple_empty(dentry)) {
+				spin_unlock(&sbi->fs_lock);
 				goto done;
+			}
 		}
 		ino->flags |= AUTOFS_INF_PENDING;
 		spin_unlock(&sbi->fs_lock);
-- 
1.7.8.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/autofs: Fix sparse warning: context imbalance in 'autofs4_d_automount' - different lock contexts for basic block
  2013-01-03 14:52 [PATCH] fs/autofs: Fix sparse warning: context imbalance in 'autofs4_d_automount' - different lock contexts for basic block Peter Huewe
@ 2013-01-03 23:54 ` Ian Kent
  2013-01-09  7:16 ` Ian Kent
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Kent @ 2013-01-03 23:54 UTC (permalink / raw)
  To: Peter Huewe; +Cc: autofs, linux-kernel, Fengguang Wu

On Thu, 2013-01-03 at 15:52 +0100, Peter Huewe wrote:
> Sparse complains:
> + fs/autofs4/root.c:409:9: sparse: context imbalance in
> 'autofs4_d_automount' - different lock contexts for basic block
> 
> This was introduced by commit
> f55fb0c243 autofs4 - dont clear DCACHE_NEED_AUTOMOUNT on rootless mount
> 
> The function autofs4_d_automount can be left with the (&sbi->fs_lock)
> held if sbi->version <= 4 and simple_empty(dentry) == false so the warning seems valid.
> 
> --> Add an spin_unlock in this case before we jump to done
> 
> Unfortunately compile tested only.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>

Yes, good catch, it looks right to me.
Acked-by: Ian Kent <raven@themaw.net>

> ---
>  fs/autofs4/root.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
> index c934476..74a299f 100644
> --- a/fs/autofs4/root.c
> +++ b/fs/autofs4/root.c
> @@ -383,8 +383,10 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
>  				goto done;
>  			}
>  		} else {
> -			if (!simple_empty(dentry))
> +			if (!simple_empty(dentry)) {
> +				spin_unlock(&sbi->fs_lock);
>  				goto done;
> +			}
>  		}
>  		ino->flags |= AUTOFS_INF_PENDING;
>  		spin_unlock(&sbi->fs_lock);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/autofs: Fix sparse warning: context imbalance in 'autofs4_d_automount' - different lock contexts for basic block
  2013-01-03 14:52 [PATCH] fs/autofs: Fix sparse warning: context imbalance in 'autofs4_d_automount' - different lock contexts for basic block Peter Huewe
  2013-01-03 23:54 ` Ian Kent
@ 2013-01-09  7:16 ` Ian Kent
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Kent @ 2013-01-09  7:16 UTC (permalink / raw)
  To: Peter Huewe; +Cc: autofs, linux-kernel, Fengguang Wu

Hi all,

I see this hasn't been merged yet.
Do I need to re-post this (perhaps to Linus)?

On Thu, 2013-01-03 at 15:52 +0100, Peter Huewe wrote:
> Sparse complains:
> + fs/autofs4/root.c:409:9: sparse: context imbalance in
> 'autofs4_d_automount' - different lock contexts for basic block
> 
> This was introduced by commit
> f55fb0c243 autofs4 - dont clear DCACHE_NEED_AUTOMOUNT on rootless mount
> 
> The function autofs4_d_automount can be left with the (&sbi->fs_lock)
> held if sbi->version <= 4 and simple_empty(dentry) == false so the warning seems valid.
> 
> --> Add an spin_unlock in this case before we jump to done
> 
> Unfortunately compile tested only.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
> ---
>  fs/autofs4/root.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
> index c934476..74a299f 100644
> --- a/fs/autofs4/root.c
> +++ b/fs/autofs4/root.c
> @@ -383,8 +383,10 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
>  				goto done;
>  			}
>  		} else {
> -			if (!simple_empty(dentry))
> +			if (!simple_empty(dentry)) {
> +				spin_unlock(&sbi->fs_lock);
>  				goto done;
> +			}
>  		}
>  		ino->flags |= AUTOFS_INF_PENDING;
>  		spin_unlock(&sbi->fs_lock);



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-09  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 14:52 [PATCH] fs/autofs: Fix sparse warning: context imbalance in 'autofs4_d_automount' - different lock contexts for basic block Peter Huewe
2013-01-03 23:54 ` Ian Kent
2013-01-09  7:16 ` Ian Kent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®