lkml.org 
[lkml]   [2006]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH]: initialize parts of udf inode earlier in create
dan@pwienterprises.com wrote:
> I ran into the same issue today, but when listing a directory with
> invalid/corrupt entries:

...

> The following patch to udf_alloc_inode() should take care of both (and
> other similar) cases, but I've only tested it with udf_lookup().
>
> Dan
>
> --
>
> Signed-off-by: Dan Bastone <dan@pwienterprises.com>
>
> --- linux-2.6.17.7/fs/udf/super.c.orig
> +++ linux-2.6.17.7/fs/udf/super.c
> @@ -116,6 +116,13 @@
> ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep,
> SLAB_KERNEL);
> if (!ei)
> return NULL;
> +
> + ei->i_unique = 0;
> + ei->i_lenExtents = 0;
> + ei->i_next_alloc_block = 0;
> + ei->i_next_alloc_goal = 0;
> + ei->i_strat4096 = 0;
> +
> return &ei->vfs_inode;
> }

That looks fine to me, but I wonder if there's a cleaner way, rather
than sprinkling these initializations in the code. If __udf_read_inode
fails, then it calls mark_bad_inode; maybe the code should check for
that before trying to discard prealloced blocks? I don't really know
enough about all the UDF codepaths (by far!) to know for sure what the
best solution is, here.

I do notice that for example ext2_put_inode() checks for bad_inode
before calling ext2_discard_prealloc. And it looks like the udf code
may have a little ext2 history in it :)

-Eric

(hm, just realized that my original patch in this thread isn't strictly
necessary for the reasons I originally proposed; udf_clear_inode checks
for MS_RDONLY before discarding the prealloc, and my first UDF patch set
the MS_RDONLY flag on these read-only-marked filesystems... ah well)
-
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-08-08 00:49    [W:0.123 / U:0.144 seconds]
©2003-2011 Jasper Spaans. Advertise on this site