Skip to content

Commit

Permalink
autofs - Fix sparse warning: context imbalance in autofs4_d_automount…
Browse files Browse the repository at this point in the history
…() different lock contexts for basic block

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 f55fb0c ("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 <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Acked-by: Ian Kent <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
PeterHuewe authored and torvalds committed Mar 1, 2013
1 parent b0af9cd commit 9d8072e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/autofs4/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9d8072e

Please sign in to comment.