autofs - Fix sparse warning: context imbalance in autofs4_d_automount() different lock contexts for basic block
Subsystems (2)
Ian Kent
maintainerPATCH 1/2 autofs - Fix sparse warning: context imbalance in autofs4_d_automount() different lock contexts for basic block
From: Peter Huewe <[email protected]>
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 commitf55fb0c243 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.
--- fs/autofs4/root.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/autofs4/root.c +3 -1
@@ -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);
Ian Kent
maintainerPATCH 2/2 autofs4 - autofs4_catatonic_mode(): remove redundant null check on kfree()
From: Tim Gardner <[email protected]>
smatch analysis:
fs/autofs4/waitq.c:46 autofs4_catatonic_mode() info: redundant null
check on wq->name.name calling kfree()
--- fs/autofs4/waitq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/autofs4/waitq.c +2 -4
@@ -42,10 +42,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)while (wq) { nwq = wq->next; wq->status = -ENOENT ;/* Magic is gone - report failure */ -if (wq->name.name) { -kfree (wq->name.name); - wq->name.name =NULL ; - } +kfree (wq->name.name); + wq->name.name =NULL ; wq->wait_ctr--;wake_up_interruptible (&wq->queue); wq = nwq;