Make sure that mutex is released before conditional return statements. Fixes PR kern/56242
ok riastradh
This commit is contained in:
parent
b393dec2d4
commit
6ca8aaa395
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chfs_readinode.c,v 1.10 2017/06/01 02:45:15 chs Exp $ */
|
||||
/* $NetBSD: chfs_readinode.c,v 1.11 2021/07/15 22:39:06 andvar Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 Department of Software Engineering,
|
||||
|
@ -1012,6 +1012,7 @@ retry:
|
|||
(unsigned long long)vc->vno, vc->state);
|
||||
chfs_err("wants to read a nonexistent ino %llu\n",
|
||||
(unsigned long long)vc->vno);
|
||||
mutex_exit(&chmp->chm_lock_vnocache);
|
||||
return ENOENT;
|
||||
default:
|
||||
panic("BUG() Bad vno cache state.");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chfs_scan.c,v 1.8 2019/06/17 17:14:56 ryoon Exp $ */
|
||||
/* $NetBSD: chfs_scan.c,v 1.9 2021/07/15 22:39:06 andvar Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 Department of Software Engineering,
|
||||
|
@ -151,6 +151,7 @@ chfs_scan_check_vnode(struct chfs_mount *chmp,
|
|||
} else {
|
||||
err = chfs_update_eb_dirty(chmp, cheb,
|
||||
sizeof(struct chfs_flash_vnode));
|
||||
mutex_exit(&chmp->chm_lock_vnocache);
|
||||
return CHFS_NODE_OK;
|
||||
}
|
||||
} else {
|
||||
|
@ -325,6 +326,7 @@ chfs_scan_check_dirent_node(struct chfs_mount *chmp,
|
|||
parentvc = chfs_scan_make_vnode_cache(chmp, le64toh(dirent->pvno));
|
||||
if (!parentvc) {
|
||||
chfs_free_dirent(fd);
|
||||
mutex_exit(&chmp->chm_lock_vnocache);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -381,8 +383,10 @@ chfs_scan_check_data_node(struct chfs_mount *chmp,
|
|||
vc = chfs_vnode_cache_get(chmp, vno);
|
||||
if (!vc) {
|
||||
vc = chfs_scan_make_vnode_cache(chmp, vno);
|
||||
if (!vc)
|
||||
if (!vc) {
|
||||
mutex_exit(&chmp->chm_lock_vnocache);
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
chfs_add_node_to_list(chmp, vc, nref, &vc->dnode);
|
||||
mutex_exit(&chmp->chm_lock_vnocache);
|
||||
|
|
Loading…
Reference in New Issue