Whamcloud - gitweb
Revert "b=20645 Call vmtruncate again after truncate."
authorRobert Read <rread@sun.com>
Fri, 18 Dec 2009 22:11:11 +0000 (14:11 -0800)
committerRobert Read <rread@sun.com>
Fri, 18 Dec 2009 22:11:11 +0000 (14:11 -0800)
This reverts commit 3bbe90f2827dd972dfb9bb5ca52bd3b60b553069.

Just hit the new assertion in racer, so backing this out for now.
http://buffalo.lustre.org:8080/display_report.pl?report_id=450093

lustre/llite/vvp_io.c

index 176abfc..a29574c 100644 (file)
@@ -303,22 +303,6 @@ static int vvp_io_trunc_lock(const struct lu_env *env,
         return result;
 }
 
-static int vvp_do_vmtruncate(struct inode *inode, size_t size)
-{
-        int     result;
-        /*
-         * Only ll_inode_size_lock is taken at this level. lov_stripe_lock()
-         * is grabbed by ll_truncate() only over call to obd_adjust_kms().  If
-         * vmtruncate returns 0, then ll_truncate dropped ll_inode_size_lock()
-         */
-        ll_inode_size_lock(inode, 0);
-        result = vmtruncate(inode, size);
-        if (result != 0)
-                ll_inode_size_unlock(inode, 0);
-
-        return result;
-}
-
 static int vvp_io_trunc_start(const struct lu_env *env,
                               const struct cl_io_slice *ios)
 {
@@ -337,8 +321,15 @@ static int vvp_io_trunc_start(const struct lu_env *env,
         DOWN_WRITE_I_ALLOC_SEM(inode);
         cio->u.trunc.cui_locks_released = 0;
 
-        result = vvp_do_vmtruncate(inode, size);
-
+        /*
+         * Only ll_inode_size_lock is taken at this level. lov_stripe_lock()
+         * is grabbed by ll_truncate() only over call to obd_adjust_kms().  If
+         * vmtruncate returns 0, then ll_truncate dropped ll_inode_size_lock()
+         */
+        ll_inode_size_lock(inode, 0);
+        result = vmtruncate(inode, size);
+        if (result != 0)
+                ll_inode_size_unlock(inode, 0);
         /*
          * If a page is partially truncated, keep it owned across truncate to
          * prevent... races.
@@ -372,23 +363,13 @@ static int vvp_io_trunc_start(const struct lu_env *env,
 static void vvp_io_trunc_end(const struct lu_env *env,
                              const struct cl_io_slice *ios)
 {
-        struct vvp_io        *vio = cl2vvp_io(env, ios);
-        struct cl_io         *io    = ios->cis_io;
-        struct inode         *inode = ccc_object_inode(io->ci_obj);
-        size_t                size  = io->u.ci_truncate.tr_size;
+        struct vvp_io *vio = cl2vvp_io(env, ios);
 
         if (vio->cui_partpage != NULL) {
                 cl_page_disown(env, ios->cis_io, vio->cui_partpage);
                 cl_page_put(env, vio->cui_partpage);
                 vio->cui_partpage = NULL;
         }
-
-        /*
-         * Do vmtruncate again, to remove possible stale pages populated by
-         * competing read threads. bz20645.
-         */
-        LASSERT(size == i_size_read(inode));
-        vvp_do_vmtruncate(inode, size);
 }
 
 static void vvp_io_trunc_fini(const struct lu_env *env,