lkml.org 
[lkml]   [2006]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: cramfs mounts provide corrupted content since 2.6.15
Chris Mason writes:
> On Monday 27 February 2006 11:31, Dave Johnson wrote:
>
> > I think I've spotted an issue.
> >
> > Both ifind() and find_inode() will call the test function on inodes
> > that still have I_LOCK|I_NEW set. This means everything that the
> > test function needs _must_ be set in the set function (which is called
> > while the inode_lock is still held).
> >
> > This could cause issues for inodes of 1 (only i_ino is getting set
> > right now).
>
> The problem is that two files are getting the same inode number because
> their offsets are the same.
>
> ls -lai:
> 3412140 -rw-r--r-- 1 root root 0 Jan 1 1970 ./etc/mtab
> 3412140 -rw-r--r-- 1 root root 1220 Jan 1 1970 ./etc/nsswitch.conf
>
> So, if /etc/mtab is read first, /etc/nsswitch.conf ends up with size zero,
> because it uses the mtab inode.
>
> Andreas Gruenbacher suggested this change. Along with your patch, things
> are working here again:
>
> -chris
>
> diff -r 0f4fc87886c2 fs/cramfs/inode.c
> --- a/fs/cramfs/inode.c Fri Feb 24 16:18:23 2006 -0500
> +++ b/fs/cramfs/inode.c Tue Feb 28 14:00:11 2006 -0500
> @@ -36,7 +36,7 @@ static DECLARE_MUTEX(read_mutex);
>
> /* These two macros may change in future, to provide better st_ino
> semantics. */
> -#define CRAMINO(x) ((x)->offset?(x)->offset<<2:1)
> +#define CRAMINO(x) (((x)->offset && (x)->size)?(x)->offset<<2:1)
> #define OFFSET(x) ((x)->i_ino)


What version of mkcramfs are you using? Empty regular files should
have offset set to 0 already.


--
Dave Johnson
Starent Networks

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-28 21:42    [W:0.080 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site