kernel - Fix improper tmpfs resource limit check
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 23 Jan 2013 00:51:52 +0000 (16:51 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 23 Jan 2013 18:15:30 +0000 (10:15 -0800)
* Fix an improper check that was causing tmpfs to blow up when used as
  backing store for a VN device.

Reported-by: tuxillo
sys/vfs/tmpfs/tmpfs_vnops.c

index 56a800b..43d7cbd 100644 (file)
@@ -535,7 +535,10 @@ tmpfs_write (struct vop_write_args *ap)
                return (EFBIG);
        }
 
-       if (vp->v_type == VREG && td != NULL) {
+       /*
+        * NOTE: Ignore if UIO does not come from a user thread (e.g. VN).
+        */
+       if (vp->v_type == VREG && td != NULL && td->td_lwp != NULL) {
                error = kern_getrlimit(RLIMIT_FSIZE, &limit);
                if (error != 0) {
                        lwkt_reltoken(&vp->v_mount->mnt_token);