History log of /drivers/md/dm-delay.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
31998ef19385c944600d9a981b96252f98204bee 28-Mar-2012 Mikulas Patocka <mpatocka@redhat.com> dm: reject trailing characters in sccanf input

Device mapper uses sscanf to convert arguments to numbers. The problem is that
the way we use it ignores additional unmatched characters in the scanned string.

For example, this `if (sscanf(string, "%d", &number) == 1)' will match a number,
but also it will match number with some garbage appended, like "123abc".

As a result, device mapper accepts garbage after some numbers. For example
the command `dmsetup create vg1-new --table "0 16384 linear 254:1bla 34816bla"'
will pass without an error.

This patch fixes all sscanf uses in device mapper. It appends "%c" with
a pointer to a dummy character variable to every sscanf statement.

The construct `if (sscanf(string, "%d%c", &number, &dummy) == 1)' succeeds
only if string is a null-terminated number (optionally preceded by some
whitespace characters). If there is some character appended after the number,
sscanf matches "%c", writes the character to the dummy variable and returns 2.
We check the return value for 1 and consequently reject numbers with some
garbage appended.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
4d4d66ab5322fa9b0f51842a76139387a40e1ce9 13-Jan-2011 Tejun Heo <tj@kernel.org> dm: convert workqueues to alloc_ordered

Convert all create[_singlethread]_work() users to the new
alloc[_ordered]_workqueue(). This conversion is mechanical and
doesn't introduce any behavior change.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
3fd5d48027181168ce85e8094b926aeb9f34c556 12-Aug-2010 Mike Snitzer <snitzer@redhat.com> dm delay: support discard

Enable discard support for the delay target.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
b441a262e7d1c56fbe21794c91d7a9c83809113f 12-Aug-2010 Alasdair G Kergon <agk@redhat.com> dm: use dm_target_offset macro

Use new dm_target_offset() macro to avoid most references to ti->begin
in dm targets.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
8215d6ec5fee1e76545decea2cd73717efb5cb42 06-Mar-2010 Nikanth Karthikesan <knikanth@novell.com> dm table: remove unused dm_get_device range parameters

Remove unused parameters(start and len) of dm_get_device()
and fix the callers.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
5dea271b6d87bd1d79a59c1d5baac2596a841c37 23-Jul-2009 Mike Snitzer <snitzer@redhat.com> dm table: pass correct dev area size to device_area_is_valid

Incorrect device area lengths are being passed to device_area_is_valid().

The regression appeared in 2.6.31-rc1 through commit
754c5fc7ebb417b23601a6222a6005cc2e7f2913.

With the dm-stripe target, the size of the target (ti->len) was used
instead of the stripe_width (ti->len/#stripes). An example of a
consequent incorrect error message is:

device-mapper: table: 254:0: sdb too small for target

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
af4874e03ed82f050d5872d8c39ce64bf16b5c38 22-Jun-2009 Mike Snitzer <snitzer@redhat.com> dm target:s introduce iterate devices fn

Add .iterate_devices to 'struct target_type' to allow a function to be
called for all devices in a DM target. Implemented it for all targets
except those in dm-snap.c (origin and snapshot).

(The raid1 version number jumps to 1.12 because we originally reserved
1.1 to 1.11 for 'block_on_error' but ended up using 'handle_errors'
instead.)

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: martin.petersen@oracle.com
/drivers/md/dm-delay.c
c927259e34e518d913d86f51c71b786a513f94d6 22-Jun-2009 Mikulas Patocka <mpatocka@redhat.com> dm delay: support barriers

Flush support for dm-delay target.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
8f3d8ba20e67991b531e9c0227dcd1f99271a32c 07-Apr-2009 Christoph Hellwig <hch@lst.de> block: move bio list helpers into bio.h

It's used by DM and MD and generally useful, so move the bio list
helpers into bio.h.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/md/dm-delay.c
10d3bd09a3c25df114f74f7f86e1b58d070bef32 06-Jan-2009 Mikulas Patocka <mpatocka@redhat.com> dm: consolidate target deregistration error handling

Change dm_unregister_target to return void and use BUG() for error
reporting.

dm_unregister_target can only fail because of programming bug in the
target driver. It can't fail because of user's behavior or disk errors.

This patch changes unregister_target to return void and use BUG if
someone tries to unregister non-registered target or unregister target
that is in use.

This patch removes code duplication (testing of error codes in all dm
targets) and reports bugs in just one place, in dm_unregister_target. In
some target drivers, these return codes were ignored, which could lead
to a situation where bugs could be missed.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
586e80e6ee0d137c7d79fbae183bb37bc60ee97e 21-Oct-2008 Mikulas Patocka <mpatocka@redhat.com> dm: remove dm header from targets

Change #include "dm.h" to #include <linux/device-mapper.h> in all targets.
Targets should not need direct access to internal DM structures.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
051814c69fac92f1964739c0cf08b5e3b1156b04 19-Oct-2007 Alasdair G Kergon <agk@redhat.com> dm: bio_list macro renaming

Remove BIO_LIST and DEFINE_BIO_LIST macros that gain us nothing
since contents are initialised to NULL.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
79662d1ea37392651f2cff08626cab6a40ba3adc 19-Oct-2007 Milan Broz <mbroz@redhat.com> dm delay: fix status

Fix missing space in dm-delay target status output
if separate read and write delay are configured.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
2e64a0f92830791f160274c46aef3678fabcf044 19-Oct-2007 Dmitry Monakhov <dmonakhov@openvz.org> dm delay: fix ctr error paths

Add missing 'dm_put_device' to dm-delay target constructor.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
/drivers/md/dm-delay.c
ac818646d4be79123ad8dc5f1c4da8575d4960f8 12-Jul-2007 Alasdair G Kergon <agk@redhat.com> dm delay: cleanup

Use setup_timer().
Replace semaphore with mutex.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/md/dm-delay.c
028867ac28e51afc834a5931e7545c022557eded 12-Jul-2007 Alasdair G Kergon <agk@redhat.com> dm: use kmem_cache macro

Use new KMEM_CACHE() macro and make the newly-exposed structure names more
meaningful. Also remove some superfluous casts and inlines (let a modern
compiler be the judge).

Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/md/dm-delay.c
26b9f228703f0518a90e7513d6fe7b6abeed5138 09-May-2007 Heinz Mauelshagen <mauelshagen@redhat.com> dm: delay target

New device-mapper target that can delay I/O (for testing). Reads can be
separated from writes, redirected to different underlying devices and delayed
by differing amounts of time.

Signed-off-by: Heinz Mauelshagen <mauelshagen@redhat.com>
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/md/dm-delay.c