From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Evgeniy Polyakov" <johnpol@2ka.mipt.ru>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [3/3] POHMELFS high performance network filesystem.
Date: Sun, 15 Jun 2008 09:47:03 +0200 [thread overview]
Message-ID: <19f34abd0806150047w4338502en9a75681fb0c95438@mail.gmail.com> (raw)
In-Reply-To: <20080613164241.GC26166@2ka.mipt.ru>
Hi,
I have just one question yet :-)
On Fri, Jun 13, 2008 at 6:42 PM, Evgeniy Polyakov <johnpol@2ka.mipt.ru> wrote:
> +int pohmelfs_copy_config(struct pohmelfs_sb *psb)
> +{
> + struct pohmelfs_config *c, *dst;
> + int err = -ENODEV;
> +
> + mutex_lock(&pohmelfs_config_lock);
> + list_for_each_entry(c, &pohmelfs_config_list, config_entry) {
> + if (c->state.ctl.idx != psb->idx)
> + continue;
> +
> + err = 0;
> + list_for_each_entry(dst, &psb->state_list, config_entry) {
> + if (pohmelfs_config_eql(&dst->state.ctl, &c->state.ctl)) {
> + err = -EEXIST;
> + break;
> + }
> + }
> +
> + if (err)
> + continue;
> +
> + dst = kzalloc(sizeof(struct pohmelfs_config), GFP_KERNEL);
> + if (!dst) {
> + err = -ENOMEM;
> + goto err_out_unlock;
> + }
> +
> + memcpy(&dst->state.ctl, &c->state.ctl, sizeof(struct pohmelfs_ctl));
> +
> + list_add_tail(&dst->config_entry, &psb->state_list);
> +
> + err = pohmelfs_state_init_one(psb, dst);
> + if (err) {
> + list_del(&dst->config_entry);
> + kfree(dst);
> + }
> + }
> + mutex_unlock(&pohmelfs_config_lock);
> +
> + return err;
> +
> +err_out_unlock:
> + mutex_unlock(&pohmelfs_config_lock);
> +
> + mutex_lock(&psb->state_lock);
> + list_for_each_entry_safe(dst, c, &psb->state_list, config_entry) {
> + list_del(&dst->config_entry);
> + kfree(dst);
> + }
> + mutex_unlock(&psb->state_lock);
> +
> + return err;
> +}
I'm having a hard time convincing myself that the error handling here
is correct. You have this kind of setup:
1. for each config in config list {
2. for each config in superblock state list {
pohmelfs_config_eql();
...
}
}
And according to your code, if pohmelfs_config_eql returns non-zero in
the last iteration of #1, then -EEXISTS will be the return value of
the whole function (but the config _will_ be copied; it is not undone
in this case). But if pohmenlfs_config_eql returns non-zero in any but
the last iteration of #1, then 0 will be the return value. Is this
your intention?
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
next prev parent reply other threads:[~2008-06-15 7:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-13 16:37 [0/3] POHMELFS high performance network filesystem. First steps in parallel processing Evgeniy Polyakov
2008-06-13 16:40 ` [1/3] POHMELFS: VFS trivial change Evgeniy Polyakov
2008-06-13 16:41 ` [2/3] POHMELFS: Documentation Evgeniy Polyakov
2008-06-14 2:15 ` Jamie Lokier
2008-06-14 6:56 ` Evgeniy Polyakov
2008-06-14 9:49 ` Jeff Garzik
2008-06-14 18:45 ` Trond Myklebust
2008-06-14 19:25 ` Evgeniy Polyakov
2008-06-15 4:27 ` Sage Weil
2008-06-15 5:57 ` Evgeniy Polyakov
2008-06-15 16:41 ` Sage Weil
2008-06-15 17:50 ` Evgeniy Polyakov
2008-06-16 3:17 ` Sage Weil
2008-06-16 10:20 ` Evgeniy Polyakov
2008-06-13 16:42 ` [3/3] POHMELFS high performance network filesystem Evgeniy Polyakov
2008-06-15 7:47 ` Vegard Nossum [this message]
2008-06-15 9:14 ` Evgeniy Polyakov
2008-06-14 9:52 ` [0/3] POHMELFS high performance network filesystem. First steps in parallel processing Jeff Garzik
2008-06-14 10:10 ` Evgeniy Polyakov
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=19f34abd0806150047w4338502en9a75681fb0c95438@mail.gmail.com \
--to=vegard.nossum@gmail.com \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).