Re: [PATCH]: initialize parts of udf inode earlier in create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[email protected] 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 <[email protected]>

--- 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux