Message ID | 20170526002631.8546-6-bo.li.liu@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, May 25, 2017 at 06:26:30PM -0600, Liu Bo wrote: > Now that we have a helper to report invalid value of extent inline ref > type, we need to quit gracefully instead of throwing out a kernel panic. > > Signed-off-by: Liu Bo <bo.li.liu@oracle.com> > --- > fs/btrfs/relocation.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c > index b043e200..8b984bd 100644 > --- a/fs/btrfs/relocation.c > +++ b/fs/btrfs/relocation.c > @@ -3774,7 +3774,10 @@ int add_data_references(struct reloc_control *rc, > ret = find_data_references(rc, extent_key, > eb, dref, blocks); > } else { > - BUG(); > + ret = -EINVAL; > + WARN(1, > + "extent %llu has an invalid inline ref type\n", > + eb->start); Would be good to extend the error message, also in the previous patch. Print inode number, root id and the (invalid ref) type. > } > if (ret) { > err = ret; > -- > 2.9.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, May 26, 2017 at 08:20:11PM +0200, David Sterba wrote: > On Thu, May 25, 2017 at 06:26:30PM -0600, Liu Bo wrote: > > Now that we have a helper to report invalid value of extent inline ref > > type, we need to quit gracefully instead of throwing out a kernel panic. > > > > Signed-off-by: Liu Bo <bo.li.liu@oracle.com> > > --- > > fs/btrfs/relocation.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c > > index b043e200..8b984bd 100644 > > --- a/fs/btrfs/relocation.c > > +++ b/fs/btrfs/relocation.c > > @@ -3774,7 +3774,10 @@ int add_data_references(struct reloc_control *rc, > > ret = find_data_references(rc, extent_key, > > eb, dref, blocks); > > } else { > > - BUG(); > > + ret = -EINVAL; > > + WARN(1, > > + "extent %llu has an invalid inline ref type\n", > > + eb->start); > > Would be good to extend the error message, also in the previous patch. > Print inode number, root id and the (invalid ref) type. > I've printed out the whole leaf's content in the helper btrfs_get_extent_inline_ref_type if type is not valid, and it shows the invalid ref type. For inode number and root id, it's not available in this relocation case, I'll check that in other patches. thanks, -liubo > > } > > if (ret) { > > err = ret; > > -- > > 2.9.4 > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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-btrfs" 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/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index b043e200..8b984bd 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3774,7 +3774,10 @@ int add_data_references(struct reloc_control *rc, ret = find_data_references(rc, extent_key, eb, dref, blocks); } else { - BUG(); + ret = -EINVAL; + WARN(1, + "extent %llu has an invalid inline ref type\n", + eb->start); } if (ret) { err = ret;
Now that we have a helper to report invalid value of extent inline ref type, we need to quit gracefully instead of throwing out a kernel panic. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> --- fs/btrfs/relocation.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)