Message ID | 1310681702-13922-8-git-send-email-mfasheh@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
(2011/07/15 7:15), Mark Fasheh wrote: > In addition to properly handling allocation failure from btrfs_alloc_path, I > also fixed up the kzalloc error handling code immediately below it. Need not you correct the caller of btrfs_drop_snapshot()? Thanks, Tsutomu > > Signed-off-by: Mark Fasheh <mfasheh@suse.com> > --- > fs/btrfs/extent-tree.c | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c > index aa91773..a016590 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -6268,10 +6268,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, > int level; > > path = btrfs_alloc_path(); > - BUG_ON(!path); > + if (!path) > + return -ENOMEM; > > wc = kzalloc(sizeof(*wc), GFP_NOFS); > - BUG_ON(!wc); > + if (!wc) { > + btrfs_free_path(path); > + return -ENOMEM; > + } > > trans = btrfs_start_transaction(tree_root, 0); > BUG_ON(IS_ERR(trans)); -- 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, Jul 15, 2011 at 12:04:46PM +0900, Tsutomu Itoh wrote: > (2011/07/15 7:15), Mark Fasheh wrote: > > In addition to properly handling allocation failure from btrfs_alloc_path, I > > also fixed up the kzalloc error handling code immediately below it. > > Need not you correct the caller of btrfs_drop_snapshot()? Hmm, I don't think so - the only two callers of btrfs_drop_snapshot() are merge_reloc_roots() and btrfs_clean_old_snapshots(). Both of which currently ignore the return code. --Mark -- Mark Fasheh -- 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
Hi, Mark, (2011/07/19 7:09), Mark Fasheh wrote: > On Fri, Jul 15, 2011 at 12:04:46PM +0900, Tsutomu Itoh wrote: >> (2011/07/15 7:15), Mark Fasheh wrote: >>> In addition to properly handling allocation failure from btrfs_alloc_path, I >>> also fixed up the kzalloc error handling code immediately below it. >> >> Need not you correct the caller of btrfs_drop_snapshot()? > > Hmm, I don't think so - the only two callers of btrfs_drop_snapshot() are merge_reloc_roots() and > btrfs_clean_old_snapshots(). Both of which currently ignore the return code. If you think so, I think that you should change the type of btrfs_drop_snapshot() into 'void'. Thanks, Tsutomu > --Mark > > -- > Mark Fasheh > > -- 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
Excerpts from Tsutomu Itoh's message of 2011-07-18 20:07:44 -0400: > Hi, Mark, > > (2011/07/19 7:09), Mark Fasheh wrote: > > On Fri, Jul 15, 2011 at 12:04:46PM +0900, Tsutomu Itoh wrote: > >> (2011/07/15 7:15), Mark Fasheh wrote: > >>> In addition to properly handling allocation failure from btrfs_alloc_path, I > >>> also fixed up the kzalloc error handling code immediately below it. > >> > >> Need not you correct the caller of btrfs_drop_snapshot()? > > > > Hmm, I don't think so - the only two callers of btrfs_drop_snapshot() are merge_reloc_roots() and > > btrfs_clean_old_snapshots(). Both of which currently ignore the return code. > > If you think so, I think that you should change the type of btrfs_drop_snapshot() > into 'void'. In both of these cases we should be forcing the FS readonly instead. -chris -- 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/extent-tree.c b/fs/btrfs/extent-tree.c index aa91773..a016590 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6268,10 +6268,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int level; path = btrfs_alloc_path(); - BUG_ON(!path); + if (!path) + return -ENOMEM; wc = kzalloc(sizeof(*wc), GFP_NOFS); - BUG_ON(!wc); + if (!wc) { + btrfs_free_path(path); + return -ENOMEM; + } trans = btrfs_start_transaction(tree_root, 0); BUG_ON(IS_ERR(trans));
In addition to properly handling allocation failure from btrfs_alloc_path, I also fixed up the kzalloc error handling code immediately below it. Signed-off-by: Mark Fasheh <mfasheh@suse.com> --- fs/btrfs/extent-tree.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)