From: Bodo Eggert <7eggert@gmx.de>
To: Andrew Morton <akpm@osdl.org>,
franz_pletz@t-online.de, axboe@suse.de,
linux-kernel@vger.kernel.org, ludoschmidt@web.de
Subject: Re: [PATCH] loopback device can't act as its backing store
Date: Sat, 04 Dec 2004 01:25:20 +0100 [thread overview]
Message-ID: <E1CaNjk-0001Tu-00@be1.7eggert.dyndns.org> (raw)
In-Reply-To: <fa.gbb6job.1um2er1@ifi.uio.no>
Andrew Morton wrote:
> + /* Avoid recursion */
> + f = file;
> + while (is_loop_device(f)) {
> + struct loop_device *l;
> +
> + if (f->f_mapping->host == lo_file->f_mapping->host)
> + goto out_putf;
> + l = f->f_mapping->host->i_bdev->bd_disk->private_data;
> + if (l->lo_state == Lo_unbound)
> + break;
> + f = l->lo_backing_file;
> + }
>
This seems wrong to me. AFAI can see, this does not address
1) a->b->c->b->... (Maybe it' is catched later after some recursions)
2) the max. recursion problem you mentioned. (Maybe it's catched by
not having enough loop devices and catching (1), but this may change)
I think the real fix is something like: (guess from this patch, untested)
f = file;
i = MAX_LOOP_CHAIN;
while (is_loop_device(f)) {
struct loop_device *l;
/* if MAX_LOOP_CHAIN is high, leaving in the old check might be a nice
shortcut for the common case. Is it?
*/
if(!--i) goto out_putf;
/* off by one? I don't think so, but check it 'cause it's late. */
l = f->f_mapping->host->i_bdev->bd_disk->private_data;
if (l->lo_state == Lo_unbound)
break;
/* shouldn't we generate an error instead?
I guess the error will be generated while recursing, but we just
followed the chain and know the result.
*/
f = l->lo_backing_file;
}
next parent reply other threads:[~2004-12-04 0:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.gge7q0c.1pjgej6@ifi.uio.no>
[not found] ` <fa.gbb6job.1um2er1@ifi.uio.no>
2004-12-04 0:25 ` Bodo Eggert [this message]
2004-12-03 19:51 Franz Pletz
2004-12-03 21:42 ` Phil Oester
2004-12-03 22:31 ` Franz Pletz
2004-12-03 22:50 ` Andrew Morton
2004-12-03 22:51 ` Andrew Morton
2004-12-04 0:34 ` Franz Pletz
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=E1CaNjk-0001Tu-00@be1.7eggert.dyndns.org \
--to=7eggert@gmx.de \
--cc=7eggert@nurfuerspam.de \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=franz_pletz@t-online.de \
--cc=linux-kernel@vger.kernel.org \
--cc=ludoschmidt@web.de \
/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
all inboxes | Powered by JetHome®