Skip to content

Commit

Permalink
kernel - Fix smbfs readdir and umount
Browse files Browse the repository at this point in the history
* Fix a bug in smbfs's readdir that was causing an empty list and also
  a later deadlock.

* Fix a bug in smbfs's umount that was panicing the machine.
  • Loading branch information
Matthew Dillon committed Dec 2, 2016
1 parent d555fba commit d8b10ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions sys/vfs/smbfs/smbfs_vfsops.c
Expand Up @@ -234,6 +234,9 @@ smbfs_unmount(struct mount *mp, int mntflags)
if (error)
return error;
smb_makescred(&scred, curthread, smp->sm_cred);
error = smb_share_lock(smp->sm_share, LK_EXCLUSIVE);
if (error)
goto out;
smb_share_put(smp->sm_share, &scred);
mp->mnt_data = (qaddr_t)0;

Expand All @@ -244,6 +247,7 @@ smbfs_unmount(struct mount *mp, int mntflags)
lockdestroy(&smp->sm_hashlock);
kfree(smp, M_SMBFSDATA);
mp->mnt_flag &= ~MNT_LOCAL;
out:
return error;
}

Expand Down
2 changes: 1 addition & 1 deletion sys/vfs/smbfs/smbfs_vnops.c
Expand Up @@ -714,7 +714,7 @@ smbfs_readdir(struct vop_readdir_args *ap)
}
#endif
error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_FAILRECLAIM);
if (error) {
if (error == 0) {
error = smbfs_readvnode(vp, uio, ap->a_cred);
vn_unlock(vp);
}
Expand Down

0 comments on commit d8b10ae

Please sign in to comment.