Message ID | 20140121062204.20507.93142.stgit@birch.djwong.org |
---|---|
State | Accepted, archived |
Headers | show |
On Mon, Jan 20, 2014 at 10:22:04PM -0800, Darrick J. Wong wrote: > When modifying/removing an extent during punch, don't forget to update > the extent's parents. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Zheng Liu <wenqing.lz@taobao.com> - Zheng > --- > lib/ext2fs/punch.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > > diff --git a/lib/ext2fs/punch.c b/lib/ext2fs/punch.c > index 657cb53..a3d020e 100644 > --- a/lib/ext2fs/punch.c > +++ b/lib/ext2fs/punch.c > @@ -353,6 +353,9 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, > if (extent.e_len) { > dbg_print_extent("replacing", &extent); > retval = ext2fs_extent_replace(handle, 0, &extent); > + if (retval) > + goto errout; > + retval = ext2fs_extent_fix_parents(handle); > } else { > struct ext2fs_extent newex; > blk64_t old_lblk, next_lblk; > @@ -387,6 +390,11 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, > if (retval) > goto errout; > > + retval = ext2fs_extent_fix_parents(handle); > + if (retval && retval != EXT2_ET_NO_CURRENT_NODE) > + goto errout; > + retval = 0; > + > /* Jump forward to the next extent. */ > ext2fs_extent_goto(handle, next_lblk); > op = EXT2_EXTENT_CURRENT; > > -- > 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 -- 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
On Tue, Jan 21, 2014 at 03:43:43PM +0800, Zheng Liu wrote: > On Mon, Jan 20, 2014 at 10:22:04PM -0800, Darrick J. Wong wrote: > > When modifying/removing an extent during punch, don't forget to update > > the extent's parents. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > Reviewed-by: Zheng Liu <wenqing.lz@taobao.com> Thanks, applied. - 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
diff --git a/lib/ext2fs/punch.c b/lib/ext2fs/punch.c index 657cb53..a3d020e 100644 --- a/lib/ext2fs/punch.c +++ b/lib/ext2fs/punch.c @@ -353,6 +353,9 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, if (extent.e_len) { dbg_print_extent("replacing", &extent); retval = ext2fs_extent_replace(handle, 0, &extent); + if (retval) + goto errout; + retval = ext2fs_extent_fix_parents(handle); } else { struct ext2fs_extent newex; blk64_t old_lblk, next_lblk; @@ -387,6 +390,11 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, if (retval) goto errout; + retval = ext2fs_extent_fix_parents(handle); + if (retval && retval != EXT2_ET_NO_CURRENT_NODE) + goto errout; + retval = 0; + /* Jump forward to the next extent. */ ext2fs_extent_goto(handle, next_lblk); op = EXT2_EXTENT_CURRENT;
When modifying/removing an extent during punch, don't forget to update the extent's parents. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- lib/ext2fs/punch.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 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