Date: Sat, 19 May 2012 22:22:13 +0200 From: Mateusz Guzik <mjguzik@gmail.com> To: pjd@freebsd.org Cc: freebsd-fs@freebsd.org Subject: [patch] Broken RLIMIT_FSIZE handling in ZFS Message-ID: <20120519202213.GA17691@dft-labs.eu>
next in thread | raw e-mail | index | archive | help
Hello, vn_rlimit_fsize takes uio->uio_offset and uio->uio_resid into account when determining whether given write would exceed RLIMIT_FSIZE. When APPEND flag is specified, ZFS updates uio->uio_offset to point to the end of file. But this happens after a call to vn_rlimit_fsize, so vn_rlimit_fsize check can be rendered ineffective by thread that opens some file with O_APPEND and lseeks below RLIMIT_FSIZE before calling write. This fixes the problem for me: http://student.agh.edu.pl/~mjguzik/patches/zfs-rlimit-fsize.patch Slightly modified testcase stolen from pr standards/164793: http://student.agh.edu.pl/~mjguzik/patches/writelimit.c Without the patch this testacase will just finish by producing 80000 bytes file on ZFS. On UFS it gives the following output: failed when adding 27 bytes after 59994 bytes (error: File too large) Same happens on ZFS with the patch. -- Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120519202213.GA17691>