Patchwork [v3,11/30] libext2fs: handle inline data in dir iterator function

login
register
mail settings
Submitter Theodore Ts'o
Date March 4, 2014, 1:56 p.m.
Message ID <20140304135624.GA18385@thunk.org>
Download mbox | patch
Permalink /patch/326305/
State Accepted
Headers show

Comments

Theodore Ts'o - March 4, 2014, 1:56 p.m.
On Mon, Mar 03, 2014 at 03:31:54PM -0800, Darrick J. Wong wrote:
> > diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
> > index 6bdfae5..8afccbe 100644
> > --- a/lib/ext2fs/dir_iterate.c
> > +++ b/lib/ext2fs/dir_iterate.c
> > @@ -129,9 +129,7 @@ errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
> >  		ext2fs_free_mem(&ctx.buf);
> >  	if (retval == EXT2_ET_INLINE_DATA_CANT_ITERATE) {
> >  		ctx.flags |= DIRENT_FLAG_INCLUDE_INLINE_DATA;
> > -		retval = ext2fs_inline_data_dir_iterate(fs, dir,
> > -						ext2fs_process_dir_block,
> > -						&ctx);
> > +		(void) ext2fs_inline_data_dir_iterate(fs, dir, &ctx);
> >  	}
> >  	if (retval)
> >  		return retval;
> 
> Hmm.  In order to get into ext2fs_inline_data_dir_iterate(), it has to be the
> case that retval == EXT2_ET_INLINE_DATA_CANT_ITERATE.  But then we immediately
> return that error code, which means that anything interesting in ctx.errcode
> will be lost.  I /think/ you want to set retval = 0 in that if clause?

Yes, I noticed this morning that it caused a regression test failure
(which is comforting from a code coverage point of view :-).  I've
made that change.

> 
> Was BLOCK_INLINE_DATA_CHANGED ever cleared from retval?  As written, I /think/
> that writing either dot or dotdot entries will result in the EA being written
> too, even if nothing changes there.

Yes, good point.  I've added the following change.

     	  	       
> Guess I'll have a look at the other patches too.

I've updated the pu branch with the inline data patches, so if you and
Zheng could take a look at it and sanity check it, I'd really
appreicate it.  Thanks!!

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c
index db1bc03..9bfc8ef 100644
--- a/lib/ext2fs/inline_data.c
+++ b/lib/ext2fs/inline_data.c
@@ -133,6 +133,7 @@  int ext2fs_inline_data_dir_iterate(ext2_filsys fs, ext2_ino_t ino,
 		err = ext2fs_write_inode(fs, ino, &inode);
 		if (err)
 			goto out;
+		ret &= ~BLOCK_INLINE_DATA_CHANGED;
 	}
 	if (ret & BLOCK_ABORT)
 		goto out;
@@ -159,6 +160,7 @@  int ext2fs_inline_data_dir_iterate(ext2_filsys fs, ext2_ino_t ino,
 		ctx->errcode = ext2fs_write_inode(fs, ino, &inode);
 		if (ctx->errcode)
 			ret |= BLOCK_ABORT;
+		ret &= ~BLOCK_INLINE_DATA_CHANGED;
 	}
 	if (ret & BLOCK_ABORT)
 		goto out;