Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/chfs Release mutexes in few more places on failure p...



details:   https://anonhg.NetBSD.org/src/rev/001ddcdc7df8
branches:  trunk
changeset: 1022452:001ddcdc7df8
user:      andvar <andvar%NetBSD.org@localhost>
date:      Mon Jul 19 21:04:39 2021 +0000

description:
Release mutexes in few more places on failure path. Reviewed them in chfs code after fixing PR kern/56242.
ok riastradh

diffstat:

 sys/ufs/chfs/chfs_build.c |  10 +++++++---
 sys/ufs/chfs/chfs_write.c |   6 ++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r 175d36422ca2 -r 001ddcdc7df8 sys/ufs/chfs/chfs_build.c
--- a/sys/ufs/chfs/chfs_build.c Mon Jul 19 19:13:33 2021 +0000
+++ b/sys/ufs/chfs/chfs_build.c Mon Jul 19 21:04:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_build.c,v 1.5 2012/10/19 12:44:39 ttoth Exp $     */
+/*     $NetBSD: chfs_build.c,v 1.6 2021/07/19 21:04:39 andvar Exp $    */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -252,8 +252,10 @@
                                if (chmp->chm_nextblock) {
                                        err = chfs_close_eraseblock(chmp,
                                            chmp->chm_nextblock);
-                                       if (err)
+                                       if (err) {
+                                               mutex_exit(&chmp->chm_lock_mountfields);
                                                return err;
+                                       }
                                }
                                chmp->chm_nextblock = &chmp->chm_blocks[i];
                        } else {
@@ -261,8 +263,10 @@
                                 * dirty and put it on a list */
                                err = chfs_close_eraseblock(chmp,
                                    &chmp->chm_blocks[i]);
-                               if (err)
+                               if (err) {
+                                       mutex_exit(&chmp->chm_lock_mountfields);
                                        return err;
+                               }
                        }
                        break;
                case CHFS_BLK_STATE_ALLDIRTY:
diff -r 175d36422ca2 -r 001ddcdc7df8 sys/ufs/chfs/chfs_write.c
--- a/sys/ufs/chfs/chfs_write.c Mon Jul 19 19:13:33 2021 +0000
+++ b/sys/ufs/chfs/chfs_write.c Mon Jul 19 21:04:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_write.c,v 1.5 2012/10/19 12:44:39 ttoth Exp $     */
+/*     $NetBSD: chfs_write.c,v 1.6 2021/07/19 21:04:39 andvar Exp $    */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -438,8 +438,10 @@
 
        /* update vnode information */
        error = chfs_write_flash_vnode(chmp, ip, ALLOC_NORMAL);
-       if (error)
+       if (error) {
+               mutex_exit(&chmp->chm_lock_mountfields);
                return error;
+       }
 
        /* write out the new dirent */
        error = chfs_write_flash_dirent(chmp,



Home | Main Index | Thread Index | Old Index