[Ocfs2-tools-devel] [PATCH 5/9] fsck.ocfs2: Implement Pass 1C, scanning for inode names.
Joel Becker
Joel.Becker at oracle.com
Sun Aug 2 00:35:37 PDT 2009
On Sun, Aug 02, 2009 at 03:07:02PM +0800, tristan.ye wrote:
> Joel Becker Wrote:
> >+static errcode_t o2fsck_pass1c(o2fsck_state *ost, struct dup_context *dct)
> >+{
> >+ errcode_t ret;
>
> I've tested your patches, all were fine, just one question:
>
> Here the 'ret' was defined without initialization. and you never
> used the var in this function. we therefore will definitely get a
> unknown return value if this func get called. and then it aborts our
> fsck finally.
>
> >+ struct dir_scan_context scan = {
> >+ .ds_ost = ost,
> >+ .ds_dct = dct,
> >+ .ds_inodes_left = dct->dup_inode_count,
> >+ };
> >+
> >+ whoami = "pass1c";
> >+ printf("Pass 1c: Scanning directories to name the inode owning "
> >+ "multiply-claimed clusters\n");
> >+
> >+ INIT_LIST_HEAD(&scan.ds_paths);
> >+ push_dir(&scan, &(struct ocfs2_dir_entry){
> >+ .name = "/",
> >+ .name_len = 1,
> >+ .file_type = OCFS2_FT_DIR,
> >+ .inode = ost->ost_fs->fs_root_blkno,
> >+ });
> >+ push_dir(&scan, &(struct ocfs2_dir_entry){
> >+ .name = "//",
> >+ .name_len = 2,
> >+ .file_type = OCFS2_FT_DIR,
> >+ .inode = ost->ost_fs->fs_sysdir_blkno,
> >+ });
> >+
> >+ while (scan.ds_inodes_left && !list_empty(&scan.ds_paths)) {
> >+ set_next_cwd(&scan);
> >+ walk_cwd(&scan);
> >+ }
> >+
> >+ return ret;
> See, you return this at the end of func, while it neither was
> initilized nor used.
>
> It should be a potential bug.
Yeah, pass1c should be void. Good catch. Patch attached.
Interestingly, I've never run into this while testing.
Joel
--
"Senator let's be sincere,
As much as you can."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fsck.ocfs2-pass-1C-should-be-void.patch
Type: text/x-diff
Size: 1380 bytes
Desc: not available
Url : http://oss.oracle.com/pipermail/ocfs2-tools-devel/attachments/20090802/4dbbd74b/attachment.bin
More information about the Ocfs2-tools-devel
mailing list