lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090427182434.GD4593@kernel.dk>
Date:	Mon, 27 Apr 2009 20:24:34 +0200
From:	Jens Axboe <jens.axboe@...cle.com>
To:	Boaz Harrosh <bharrosh@...asas.com>
Cc:	Jeff Garzik <jeff@...zik.org>, LKML <linux-kernel@...r.kernel.org>,
	linux-scsi@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	James.Bottomley@...senPartnership.com, osd-dev@...n-osd.org,
	Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 3/3 v3] osdblk: a Linux block device for OSD objects

On Mon, Apr 27 2009, Boaz Harrosh wrote:
> > +static struct bio *bio_chain_clone(struct bio *old_chain, gfp_t gfpmask)
> > +{
> > +	struct bio *tmp, *new_chain = NULL, *tail = NULL;
> > +
> > +	while (old_chain) {
> > +		tmp = bio_clone(old_chain, gfpmask);
> > +		if (!tmp)
> > +			goto err_out;
> > +
> > +		tmp->bi_next = NULL;
> > +		if (!new_chain)
> > +			new_chain = tail = tmp;
> > +		else {
> > +			tail->bi_next = tmp;
> > +			tail = tmp;
> > +		}
> > +
> > +		old_chain = old_chain->bi_next;
> > +	}
> > +
> > +	return new_chain;
> > +
> > +err_out:
> > +	bio_chain_put(new_chain);
> > +	return NULL;
> > +}
> > +
> 
> NOTE-TO-ME:
>   blk_bio_clone()

Note to Boaz - this is illegal, unless gfp_mask is GFP_ATOMIC (in which
case you should not pass it in). The only way to make this work is to:

1) Have a private bio pool, and
2) Make sure it has enough reserved entries to populate the chain, and
3) Ensure only a single caller at the time, or entries enough for the N
   users that are allowed. It has to be controlled either way, whether N
   is 1 or larger.

> > +static void osdblk_rq_fn(struct request_queue *q)
> > +{
> > +	struct osdblk_device *osdev = q->queuedata;
> > +	struct request *rq;
> > +	struct osdblk_request *orq;
> > +	struct osd_request *or;
> > +	struct bio *bio;
> > +	int do_write, do_flush;
> > +
> > +	while (1) {
> > +		/* peek at request from block layer */
> > +		rq = elv_next_request(q);
> > +		if (!rq)
> > +			break;
> > +
> > +		/* filter out block requests we don't understand */
> > +		if (!blk_fs_request(rq) && !blk_barrier_rq(rq)) {
> > +			end_request(rq, 0);
> > +			continue;
> > +		}
> > +
> > +		/* deduce our operation (read, write, flush) */
> > +		/* I wish the block layer simplified cmd_type/cmd_flags/cmd[]
> > +		 * into a clearly defined set of RPC commands:
> > +		 * read, write, flush, scsi command, power mgmt req,
> > +		 * driver-specific, etc.
> > +		 */
> > +
> > +		do_flush = (rq->special == (void *) 0xdeadbeefUL);
> 
> That's for real? or it needs a "FIXME" next to it?
> 
> > +		do_write = (rq_data_dir(rq) == WRITE);
> > +
> > +		/* a bio clone to be passed down to OSD request */
> > +		bio = bio_chain_clone(rq->bio, GFP_ATOMIC);
> > +		if (!bio)
> > +			break;
> 
> does blk_barrier_rq() have a rq->bio?

It may or may not.

-- 
Jens Axboe

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ