[Ocfs2-devel] [PATCH] ocfs2: send SIGXFSZ if new filesize exceeds limit

Wengang Wang wen.gang.wang at oracle.com
Thu Feb 25 06:00:59 PST 2010


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




More information about the Ocfs2-devel mailing list