Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs In lfs_mkdir fix wrong return path in case of EM...



details:   https://anonhg.NetBSD.org/src/rev/ac86b7a27465
branches:  trunk
changeset: 834384:ac86b7a27465
user:      zafer <zafer%NetBSD.org@localhost>
date:      Sat Aug 11 20:16:21 2018 +0000

description:
In lfs_mkdir fix wrong return path in case of EMLINK which causes a panic. Also, check earlier before setting up dirop.

diffstat:

 sys/ufs/lfs/lfs_vnops.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 6680386764c6 -r ac86b7a27465 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Sat Aug 11 19:46:03 2018 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Sat Aug 11 20:16:21 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.321 2017/08/20 05:37:03 maya Exp $     */
+/*     $NetBSD: lfs_vnops.c,v 1.322 2018/08/11 20:16:21 zafer Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.321 2017/08/20 05:37:03 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.322 2018/08/11 20:16:21 zafer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -959,6 +959,11 @@
        if (fs->lfs_ronly) {
                return EROFS;
        }
+
+       if ((nlink_t)dp->i_nlink >= LINK_MAX) {
+               return EMLINK;
+       }
+
        dirblksiz = fs->um_dirblksiz;
        /* XXX dholland 20150911 I believe this to be true, but... */
        //KASSERT(dirblksiz == LFS_DIRBLKSIZ);
@@ -967,11 +972,6 @@
        if (error)
                return error;
 
-       if ((nlink_t)dp->i_nlink >= LINK_MAX) {
-               error = EMLINK;
-               goto out;
-       }
-
        /*
         * Must simulate part of lfs_makeinode here to acquire the inode,
         * but not have it entered in the parent directory. The entry is



Home | Main Index | Thread Index | Old Index