NetBSD-Bugs archive

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

Re: kern/46734: pool not drained



The following reply was made to PR kern/46734; it has been noted by GNATS.

From: Emmanuel Dreyfus <manu%netbsd.org@localhost>
To: Emmanuel Dreyfus <manu%netbsd.org@localhost>
Cc: Martin Husemann <martin%duskware.de@localhost>, 
gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/46734: pool not drained
Date: Tue, 24 Jul 2012 16:31:47 +0000

 --zhXaljGHf11kAtnf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Tue, Jul 24, 2012 at 01:40:44PM +0000, Emmanuel Dreyfus wrote:
 > I see where is the bug but I do not know how to fix it. I will ask
 > on tech-kern
 
 It was not what I thought at once, I think I have a fix.
 
 Please test the attached patch.
 
 -- 
 Emmanuel Dreyfus
 manu%netbsd.org@localhost
 
 --zhXaljGHf11kAtnf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="umountdrain.patch"
 
 Index: sys/fs/puffs/puffs_msgif.c
 ===================================================================
 RCS file: /cvsroot/src/sys/fs/puffs/puffs_msgif.c,v
 retrieving revision 1.91
 diff -U4 -r1.91 puffs_msgif.c
 --- sys/fs/puffs/puffs_msgif.c 22 Jul 2012 17:40:46 -0000      1.91
 +++ sys/fs/puffs/puffs_msgif.c 24 Jul 2012 16:27:40 -0000
 @@ -845,10 +845,10 @@
  /*
   * Node expiry. We come here after an inactive on an unexpired node.
   * The expiry has been queued and is done in sop thread.
   */
 -static bool
 -puffsop_expire(struct puffs_mount *pmp, puffs_cookie_t cookie)
 +static void
 +puffsop_expire(struct puffs_mount *pmp, puffs_cookie_t cookie, int force)
  {
        struct vnode *vp;
  
        KASSERT(PUFFS_USE_FS_TTL(pmp));
 @@ -856,15 +856,21 @@
        /* 
         * If it still exists and has no reference,
         * vrele should cause it to be reclaimed.
         * Otherwise, we have nothing to do.
 +       *
 +       * On unmount, we mark the node with PNODE_NOREFS 
 +       * to make sure it will go away even if it was 
 +       * reused recently and have a grace time again.
         */
        if (puffs_cookie2vnode(pmp, cookie, 0, 0, &vp) == 0) {
 +              if (force)
 +                      VPTOPP(vp)->pn_stat |= PNODE_NOREFS;
                VPTOPP(vp)->pn_stat &= ~PNODE_SOPEXP;
                vrele(vp); 
        }
  
 -      return false;
 +      return;
  }
  
  static void
  puffsop_flush(struct puffs_mount *pmp, struct puffs_flush *pf)
 @@ -1057,13 +1063,11 @@
  
        mutex_enter(&pmp->pmp_sopmtx);
        for (keeprunning = true; keeprunning; ) {
                /*
 -               * We have a higher priority queue for flush and umount
 -               * and a lower priority queue for reclaims. Request on
 -               * slower queue are not honoured before clock reaches 
 -               * psopr_at. This code assumes that requests are ordered 
 -               * by psopr_at in queues.
 +               * We have a fast queue for flush and umount, and a node 
 +               * queue for delayes node reclaims. Requests on node queue      
                 * are not honoured before clock reaches psopr_at. This 
 +               * code assumes that requests are ordered by psopr_at.
                 */
                do {
                        psopr = TAILQ_FIRST(&pmp->pmp_sopfastreqs);
                        if (psopr != NULL) {
 @@ -1071,11 +1075,11 @@
                                             psopr, psopr_entries);
                                break;
                        }
  
 -                      psopr = TAILQ_FIRST(&pmp->pmp_sopslowreqs);
 +                      psopr = TAILQ_FIRST(&pmp->pmp_sopnodereqs);
                        if ((psopr != NULL) && TIMED_OUT(psopr->psopr_at)) {
 -                              TAILQ_REMOVE(&pmp->pmp_sopslowreqs,
 +                              TAILQ_REMOVE(&pmp->pmp_sopnodereqs,
                                             psopr, psopr_entries);
                                break;
                        }
  
 @@ -1091,9 +1095,9 @@
                case PUFFS_SOPREQ_FLUSH:
                        puffsop_flush(pmp, &psopr->psopr_pf);
                        break;
                case PUFFS_SOPREQ_EXPIRE:
 -                      puffsop_expire(pmp, psopr->psopr_ck);
 +                      puffsop_expire(pmp, psopr->psopr_ck, 0);
                        break;
                case PUFFS_SOPREQ_UNMOUNT:
                        puffs_msg_sendresp(pmp, &psopr->psopr_preq, 0);
  
 @@ -1122,12 +1126,15 @@
                kmem_free(psopr, sizeof(*psopr));
                mutex_enter(&pmp->pmp_sopmtx);
        }
  
 -      while ((psopr = TAILQ_FIRST(&pmp->pmp_sopslowreqs)) != NULL) {
 -              TAILQ_REMOVE(&pmp->pmp_sopslowreqs, psopr, psopr_entries);
 +      while ((psopr = TAILQ_FIRST(&pmp->pmp_sopnodereqs)) != NULL) {
 +              TAILQ_REMOVE(&pmp->pmp_sopnodereqs, psopr, psopr_entries);
                mutex_exit(&pmp->pmp_sopmtx);
 -              puffs_msg_sendresp(pmp, &psopr->psopr_preq, ENXIO);
 +      
 +              KASSERT(psopr->psopr_sopreq == PUFFS_SOPREQ_EXPIRE);
 +              puffsop_expire(pmp, psopr->psopr_ck, 1);
 +
                kmem_free(psopr, sizeof(*psopr));
                mutex_enter(&pmp->pmp_sopmtx);
        }
  
 Index: sys/fs/puffs/puffs_sys.h
 ===================================================================
 RCS file: /cvsroot/src/sys/fs/puffs/puffs_sys.h,v
 retrieving revision 1.80
 diff -U4 -r1.80 puffs_sys.h
 --- sys/fs/puffs/puffs_sys.h   21 Jul 2012 05:17:10 -0000      1.80
 +++ sys/fs/puffs/puffs_sys.h   24 Jul 2012 16:27:40 -0000
 @@ -175,9 +175,9 @@
        kmutex_t                        pmp_sopmtx;
        kcondvar_t                      pmp_sopcv;
        int                             pmp_sopthrcount;
        TAILQ_HEAD(, puffs_sopreq)      pmp_sopfastreqs;
 -      TAILQ_HEAD(, puffs_sopreq)      pmp_sopslowreqs;
 +      TAILQ_HEAD(, puffs_sopreq)      pmp_sopnodereqs;
        bool                            pmp_docompat;
  };
  
  #define PUFFSTAT_BEFOREINIT   0
 Index: sys/fs/puffs/puffs_vfsops.c
 ===================================================================
 RCS file: /cvsroot/src/sys/fs/puffs/puffs_vfsops.c,v
 retrieving revision 1.103
 diff -U4 -r1.103 puffs_vfsops.c
 --- sys/fs/puffs/puffs_vfsops.c        22 Jul 2012 17:40:46 -0000      1.103
 +++ sys/fs/puffs/puffs_vfsops.c        24 Jul 2012 16:27:40 -0000
 @@ -307,9 +307,9 @@
        cv_init(&pmp->pmp_sopcv, "puffsop");
        TAILQ_INIT(&pmp->pmp_msg_touser);
        TAILQ_INIT(&pmp->pmp_msg_replywait);
        TAILQ_INIT(&pmp->pmp_sopfastreqs);
 -      TAILQ_INIT(&pmp->pmp_sopslowreqs);
 +      TAILQ_INIT(&pmp->pmp_sopnodereqs);
  
        if ((error = kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
            puffs_sop_thread, pmp, NULL, "puffsop")) != 0)
                goto out;
 Index: sys/fs/puffs/puffs_vnops.c
 ===================================================================
 RCS file: /cvsroot/src/sys/fs/puffs/puffs_vnops.c,v
 retrieving revision 1.170
 diff -U4 -r1.170 puffs_vnops.c
 --- sys/fs/puffs/puffs_vnops.c 23 Jul 2012 19:06:10 -0000      1.170
 +++ sys/fs/puffs/puffs_vnops.c 24 Jul 2012 16:27:40 -0000
 @@ -1278,9 +1278,9 @@
                         */
                        if (pmp->pmp_sopthrcount == 0) {
                                kmem_free(psopr, sizeof(*psopr));
                        } else {
 -                              TAILQ_INSERT_TAIL(&pmp->pmp_sopslowreqs,
 +                              TAILQ_INSERT_TAIL(&pmp->pmp_sopnodereqs,
                                    psopr, psopr_entries); 
                                pnode->pn_stat |= PNODE_SOPEXP;
                        }
  
 
 --zhXaljGHf11kAtnf--
 


Home | Main Index | Thread Index | Old Index