hammer2 - major simplification 1/many (stabilization C)
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 1 Aug 2014 03:08:30 +0000 (20:08 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 1 Aug 2014 03:08:30 +0000 (20:08 -0700)
* Remove lock-count test from write path where async reads can be
  queued.  Fixes false assertion.

* Deleted-but-still-open files are moved to a hidden directory, and on
  mount a scan is done to remove them.  The scan was improperly passing
  a NODATA flag when inode data is needed to do a proper stats rollup
  during the deletion.

sys/vfs/hammer2/hammer2_inode.c
sys/vfs/hammer2/hammer2_vnops.c

index 8a192cc..e64b495 100644 (file)
@@ -1420,11 +1420,14 @@ hammer2_inode_install_hidden(hammer2_pfsmount_t *pmp)
                /*
                 * Remove any unlinked files which were left open as-of
                 * any system crash.
+                *
+                * Don't pass NODATA, we need the inode data so the delete
+                * can do proper statistics updates.
                 */
                count = 0;
                scan = hammer2_cluster_lookup(cluster, &key_next,
                                              0, HAMMER2_TID_MAX,
-                                             HAMMER2_LOOKUP_NODATA, &ddflag);
+                                             0, &ddflag);
                while (scan) {
                        if (hammer2_cluster_type(scan) ==
                            HAMMER2_BREF_TYPE_INODE) {
@@ -1433,8 +1436,7 @@ hammer2_inode_install_hidden(hammer2_pfsmount_t *pmp)
                                ++count;
                        }
                        scan = hammer2_cluster_next(cluster, scan, &key_next,
-                                                   0, HAMMER2_TID_MAX,
-                                                   HAMMER2_LOOKUP_NODATA);
+                                                   0, HAMMER2_TID_MAX, 0);
                }
 
                hammer2_inode_unlock_ex(pmp->ihidden, cluster);
index 90f74f6..2691e2c 100644 (file)
@@ -883,12 +883,9 @@ hammer2_vop_write(struct vop_write_args *ap)
        /*
         * Read operations supported on this vnode?
         */
-       LOCKSTART;
        vp = ap->a_vp;
-       if (vp->v_type != VREG) {
-               LOCKSTOP;
+       if (vp->v_type != VREG)
                return (EINVAL);
-       }
 
        /*
         * Misc
@@ -897,7 +894,6 @@ hammer2_vop_write(struct vop_write_args *ap)
        uio = ap->a_uio;
        error = 0;
        if (ip->pmp->ronly) {
-               LOCKSTOP;
                return (EROFS);
        }
 
@@ -911,7 +907,6 @@ hammer2_vop_write(struct vop_write_args *ap)
            uio->uio_offset + uio->uio_resid >
             td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
                lwpsignal(td->td_proc, td->td_lwp, SIGXFSZ);
-               LOCKSTOP;
                return (EFBIG);
        }
 
@@ -925,7 +920,6 @@ hammer2_vop_write(struct vop_write_args *ap)
        error = hammer2_write_file(ip, uio, ap->a_ioflag, seqcount);
        hammer2_trans_done(&trans);
 
-       LOCKSTOP;
        return (error);
 }
 
@@ -1706,12 +1700,9 @@ hammer2_vop_nsymlink(struct vop_nsymlink_args *ap)
        size_t name_len;
        int error;
        
-       LOCKSTART;
        dip = VTOI(ap->a_dvp);
-       if (dip->pmp->ronly) {
-               LOCKSTOP;
+       if (dip->pmp->ronly)
                return (EROFS);
-       }
 
        ncp = ap->a_nch->ncp;
        name = ncp->nc_name;
@@ -1728,7 +1719,6 @@ hammer2_vop_nsymlink(struct vop_nsymlink_args *ap)
                KKASSERT(nip == NULL);
                *ap->a_vpp = NULL;
                hammer2_trans_done(&trans);
-               LOCKSTOP;
                return error;
        }
        *ap->a_vpp = hammer2_igetv(nip, ncparent, &error);
@@ -1785,7 +1775,6 @@ hammer2_vop_nsymlink(struct vop_nsymlink_args *ap)
                cache_setvp(ap->a_nch, *ap->a_vpp);
                /* hammer2_knote(ap->a_dvp, NOTE_WRITE); */
        }
-       LOCKSTOP;
        return error;
 }