lkml.org 
[lkml]   [2007]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Handle i_size > s_maxbytes correctly
On Sat, Dec 22, 2007 at 12:12:06AM -0800, Andrew Morton wrote:
> This patch takes the total text size of the affected nine files from 74167
> bytes up to 75066 on i386. This is core, core kernel. Ouch.

Yeah, as you note below - this should be un-inlined.


> It's also pretty fragile. We now have i_size_read()s and
> i_size_read_trunc()s sprinkled all over the place with no obvious rules to
> determine when we should use one versus the other.

Hmm, I hadn't thought about that one, but what you say makes sense. If I was
a 3rd party looking at this, I'd be pretty confused as to which i_size
function to use, etc.


> uninlining i_size_read_trunc() is obviously the first thing to look at but
> the cost is still appreciable and boy the problem which is being fixed here
> is rare and obscure.
>
> Can we look at alternatives please? What about just failing the open
> attempt?

The problem is that Ocfs2 can have this happen while a file is open (if a 64
bit node extends it past what the 32 bit node can see while they both have
open file descriptors). Even in Ocfs2 by the way, this is a bit rare - most
of the time folks run nodes of the same architecture. We still allow mixed
arch clusters though.

We could stop the VFS changes at some open checks and leave the rest
internally in Ocfs2 [and GFS2 I'm betting]. Generally though, it seems like
the type of thing that the VFS could help more with.


Jan, what if we just define a helper function which checks that a particular
file access is within the bounds allowed by the file system:

int check_file_access_offsets(struct inode *inode, loff_t pos, size_t count);

Something like that would be potentially better documenting than another
i_size accessor. Also, we could try to just leave it in the higher level
functions (write, read, splice, fault, mkwrite). I'm still not convinced
that we'd need to do anything in readpage/writepage if we just catch the
problem higher up.

Thanks,
--Mark

--
Mark Fasheh
Principal Software Developer, Oracle
mark.fasheh@oracle.com


\
 
 \ /
  Last update: 2007-12-22 21:07    [W:0.618 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site