From: Vivek Goyal <vgoyal@redhat.com>
To: Vasily Tarasov <tarasov@vasily.name>
Cc: Joe Thornber <thornber@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
dm-devel@redhat.com, Philip Shilane <philip.shilane@emc.com>,
Sonam Mandal <sonam.dp42@gmail.com>,
Erez Zadok <ezk@fsl.cs.sunysb.edu>
Subject: Re: [PATCH RFCv2 05/10] dm-dedup: COW B-tree backend
Date: Tue, 10 Feb 2015 16:31:02 -0500 [thread overview]
Message-ID: <20150210213102.GA20918@redhat.com> (raw)
In-Reply-To: <20150210152541.GA13266@redhat.com>
On Tue, Feb 10, 2015 at 10:25:41AM -0500, Vivek Goyal wrote:
> On Thu, Aug 28, 2014 at 06:07:29PM -0400, Vasily Tarasov wrote:
>
> [..]
> > +static struct metadata *init_meta_cowbtree(void *input_param, bool *unformatted)
> > +{
> > + int ret;
> > + struct metadata *md;
> > + struct dm_block_manager *meta_bm;
> > + struct dm_space_map *meta_sm;
> > + struct dm_space_map *data_sm = NULL;
> > + struct dm_transaction_manager *tm;
> > + struct init_param_cowbtree *p =
> > + (struct init_param_cowbtree *)input_param;
> > +
> > + DMINFO("Initializing COWBTREE backend");
> > +
> > + md = kzalloc(sizeof(*md), GFP_NOIO);
> > + if (!md)
> > + return ERR_PTR(-ENOMEM);
> > +
> > + meta_bm = dm_block_manager_create(p->metadata_bdev, METADATA_BSIZE,
> > + METADATA_CACHESIZE, METADATA_MAXLOCKS);
> > + if (IS_ERR(meta_bm)) {
> > + md = (struct metadata *)meta_bm;
> > + goto badbm;
> > + }
>
> I am wondering how is the error handling working in this function. Upon
> error, we are replacing the md pointer (which is pointing to a kzalloc
> memory) and later calling kfree(md).
>
> md = kzalloc(sizeof(*md), GFP_NOIO);
> if (err)
> md = struct metadata *)meta_bm;
> kfree(md).
>
> What am I missing here.
>
> [..]
> > +badwritesuper:
> > + dm_sm_destroy(data_sm);
> > +badsm:
> > + dm_tm_destroy(tm);
> > + dm_sm_destroy(meta_sm);
> > +badtm:
> > + dm_block_manager_destroy(meta_bm);
> > +badbm:
> > + kfree(md);
> > + return md;
> > +}
>
> There are multiple such substituions in this function. I think these are
> bugs (until and unless I am missing something). I will fix these.
>
> For now, I have pulled in dm-dedup-devel branch and will do code changes
> locally. I am planning to push my branch in following repo for everybody
> to have a look.
>
> https://github.com/rhvgoyal/linux
>
> I have yet to push a branch though.
Ok, I have fixed the error handling in init_meta_cowbtree() and also have
refactored the code into smaller functions so that it is much more
readable. (Primarily taken from dm-thin).
I have pushed the branch here.
https://github.com/rhvgoyal/linux/tree/dm-dedup-devel
I am planning to use this branch for committing my improvements and
cleanups. If you like you can send me patches which apply on top of
this branch and I will commit these after review.
So idea is to get dm-dedup merge ready on this branch and then ask
mike snitzer to pull it in.
Thanks
Vivek
prev parent reply other threads:[~2015-02-10 21:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 22:07 [PATCH RFCv2 05/10] dm-dedup: COW B-tree backend Vasily Tarasov
2015-02-10 15:25 ` Vivek Goyal
2015-02-10 21:31 ` Vivek Goyal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150210213102.GA20918@redhat.com \
--to=vgoyal@redhat.com \
--cc=dm-devel@redhat.com \
--cc=ezk@fsl.cs.sunysb.edu \
--cc=hch@infradead.org \
--cc=philip.shilane@emc.com \
--cc=snitzer@redhat.com \
--cc=sonam.dp42@gmail.com \
--cc=tarasov@vasily.name \
--cc=thornber@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.