aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2012-06-11 08:49:47 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-06-11 08:49:47 -0400
commit0fe2f1e929ecabf834f4af2ffd300fe70700f4b3 (patch)
tree4f885ec0bc860bef382f50b4261c01a1d589efda /fs/gfs2
parent1bb49303b7a82eb9bce0595087523343683abdf0 (diff)
GFS2: Size seq_file buffer more carefully
This places a limit on the buffer size for archs with larger PAGE_SIZE. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/glock.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 4d5d63d9d2c0..1ed81f40da0d 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1977,6 +1977,8 @@ static const struct seq_operations gfs2_sbstats_seq_ops = {
1977 .show = gfs2_sbstats_seq_show, 1977 .show = gfs2_sbstats_seq_show,
1978}; 1978};
1979 1979
1980#define GFS2_SEQ_GOODSIZE min(PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER, 65536UL)
1981
1980static int gfs2_glocks_open(struct inode *inode, struct file *file) 1982static int gfs2_glocks_open(struct inode *inode, struct file *file)
1981{ 1983{
1982 int ret = seq_open_private(file, &gfs2_glock_seq_ops, 1984 int ret = seq_open_private(file, &gfs2_glock_seq_ops,
@@ -1985,9 +1987,9 @@ static int gfs2_glocks_open(struct inode *inode, struct file *file)
1985 struct seq_file *seq = file->private_data; 1987 struct seq_file *seq = file->private_data;
1986 struct gfs2_glock_iter *gi = seq->private; 1988 struct gfs2_glock_iter *gi = seq->private;
1987 gi->sdp = inode->i_private; 1989 gi->sdp = inode->i_private;
1988 seq->buf = kmalloc(8*PAGE_SIZE, GFP_KERNEL | __GFP_NOWARN); 1990 seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN);
1989 if (seq->buf) 1991 if (seq->buf)
1990 seq->size = 8*PAGE_SIZE; 1992 seq->size = GFS2_SEQ_GOODSIZE;
1991 } 1993 }
1992 return ret; 1994 return ret;
1993} 1995}
@@ -2000,9 +2002,9 @@ static int gfs2_glstats_open(struct inode *inode, struct file *file)
2000 struct seq_file *seq = file->private_data; 2002 struct seq_file *seq = file->private_data;
2001 struct gfs2_glock_iter *gi = seq->private; 2003 struct gfs2_glock_iter *gi = seq->private;
2002 gi->sdp = inode->i_private; 2004 gi->sdp = inode->i_private;
2003 seq->buf = kmalloc(8*PAGE_SIZE, GFP_KERNEL | __GFP_NOWARN); 2005 seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN);
2004 if (seq->buf) 2006 if (seq->buf)
2005 seq->size = 8*PAGE_SIZE; 2007 seq->size = GFS2_SEQ_GOODSIZE;
2006 } 2008 }
2007 return ret; 2009 return ret;
2008} 2010}