[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b040c32a0705211830h127dfd8dk8930de6655d37d90@mail.gmail.com>
Date: Mon, 21 May 2007 18:30:15 -0700
From: "Ken Chen" <kenchen@...gle.com>
To: "Al Viro" <viro@....linux.org.uk>
Cc: akpm@...ux-foundation.org, mm-commits@...r.kernel.org,
viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org
Subject: Re: + loop-preallocate-eight-loop-devices.patch added to -mm tree
On 5/21/07, Al Viro <viro@....linux.org.uk> wrote:
> On Mon, May 21, 2007 at 03:00:55PM -0700, akpm@...ux-foundation.org wrote:
> > + if (register_blkdev(LOOP_MAJOR, "loop"))
> > + return -EIO;
> > + blk_register_region(MKDEV(LOOP_MAJOR, 0), range,
> > + THIS_MODULE, loop_probe, NULL, NULL);
> > +
> > + for (i = 0; i < nr; i++) {
> > + if (!loop_init_one(i))
> > + goto err;
> > + }
> > +
> > + printk(KERN_INFO "loop: module loaded\n");
> > + return 0;
> > +err:
> > + loop_exit();
>
> This isn't good. You *can't* fail once a single disk has been registered.
> Anyone could've opened it by now.
>
> IOW, you need to
> * register region *after* you are past the point of no return
That option is a lot harder than I thought. This requires an array to
keep intermediate result of preallocated "lo" device, blk_queue, and
disk structure before calling add_disk() or register region. And this
array could be potentially 1 million entries. Maybe I will use
vmalloc for it, but seems rather sick.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists