Wengang Wang
2010-Feb-25 14:00 UTC
[Ocfs2-devel] [PATCH] ocfs2: send SIGXFSZ if new filesize exceeds limit
This patch makes ocfs2 send SIGXFSZ if new file size exceeds limit. No suprise that processes get SIGXFSZ on one node(in the cluster) while they don't on another if file size limits are different on the two nodes. Signed-off-by: Wengang Wang <wen.gang.wang at oracle.com> --- fs/ocfs2/file.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 558ce03..13d7c68 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -993,6 +993,14 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) } if (size_change && attr->ia_size != i_size_read(inode)) { + unsigned long limit; + + limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; + if (limit != RLIM_INFINITY && attr->ia_size > limit) { + status = -EFBIG; + send_sig(SIGXFSZ, current, 0); + goto bail_unlock; + } if (attr->ia_size > sb->s_maxbytes) { status = -EFBIG; goto bail_unlock; -- 1.6.6
Joel Becker
2010-Feb-25 16:11 UTC
[Ocfs2-devel] [PATCH] ocfs2: send SIGXFSZ if new filesize exceeds limit
On Thu, Feb 25, 2010 at 10:00:59PM +0800, Wengang Wang wrote:> This patch makes ocfs2 send SIGXFSZ if new file size exceeds limit. > No suprise that processes get SIGXFSZ on one node(in the cluster) while they > don't on another if file size limits are different on the two nodes.Why aren't you using inode_newsize_ok()? Joel -- "You must remember this: A kiss is just a kiss, A sigh is just a sigh. The fundamental rules apply As time goes by." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127