[dm-devel] 2.6.9-udm1

Lars Marowsky-Bree lmb at suse.de
Tue Oct 19 21:55:33 UTC 2004


On 2004-10-19T18:05:22, Alasdair G Kergon <agk at redhat.com> wrote:

> ftp://sources.redhat.com/pub/dm/patches/2.6-unstable/2.6.9/2.6.9-udm1.tar.bz2
> 
> - Re-based to 2.6.9
> - dm-crypt patch split and improved
> - A few trivial patches added
> 
> Should be ready to submit patches 1,2,3,4,5,10 and possibly 6 and 7.

As it might ease patch review by others, find attached the incremental
changes from the rc3-udm1 patchset to this one.


Sincerely,
    Lars Marowsky-Brée <lmb at suse.de>

-- 
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX AG - A Novell company

-------------- next part --------------
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm-bio-record.h linux-2.6.9.udm1/drivers/md/dm-bio-record.h
--- linux-2.6.9.rc3udm1/drivers/md/dm-bio-record.h	2004-10-19 23:52:59.445665529 +0200
+++ linux-2.6.9.udm1/drivers/md/dm-bio-record.h	2004-10-19 23:53:13.705553033 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004 Red Hat UK Ltd.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm-crypt.c linux-2.6.9.udm1/drivers/md/dm-crypt.c
--- linux-2.6.9.rc3udm1/drivers/md/dm-crypt.c	2004-10-19 23:52:59.419669380 +0200
+++ linux-2.6.9.udm1/drivers/md/dm-crypt.c	2004-10-19 23:53:13.679556884 +0200
@@ -42,12 +42,22 @@
 	struct bio *bio_out;
 	unsigned int offset_in;
 	unsigned int offset_out;
-	int idx_in;
-	int idx_out;
+	unsigned int idx_in;
+	unsigned int idx_out;
 	sector_t sector;
 	int write;
 };
 
+struct crypt_config;
+
+struct crypt_iv_operations {
+	int (*ctr)(struct crypt_config *cc, struct dm_target *ti,
+	           const char *opts);
+	void (*dtr)(struct crypt_config *cc);
+	const char *(*status)(struct crypt_config *cc);
+	int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector);
+};
+
 /*
  * Crypt: maps a linear range of a block device
  * and encrypts / decrypts at the same time.
@@ -66,12 +76,14 @@
 	/*
 	 * crypto related data
 	 */
-	struct crypto_tfm *tfm;
-	sector_t iv_offset;
-	int (*iv_generator)(struct crypt_config *cc, u8 *iv, sector_t sector);
+	struct crypt_iv_operations *iv_gen_ops;
+	char *iv_mode;
 	void *iv_gen_private;
-	int iv_size;
-	int key_size;
+	sector_t iv_offset;
+	unsigned int iv_size;
+
+	struct crypto_tfm *tfm;
+	unsigned int key_size;
 	u8 key[0];
 };
 
@@ -98,7 +110,7 @@
 /*
  * Different IV generation algorithms:
  *
- * plain: the initial vector is the 32-bit low-endien version of the sector
+ * plain: the initial vector is the 32-bit low-endian version of the sector
  *        number, padded with zeros if neccessary.
  *
  * ess_iv: "encrypted sector|salt initial vector", the sector number is 
@@ -109,7 +121,7 @@
  * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454
  */
 
-static int crypt_iv_plain(struct crypt_config *cc, u8 *iv, sector_t sector)
+static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
 {
 	memset(iv, 0, cc->iv_size);
 	*(u32 *)iv = cpu_to_le32(sector & 0xffffffff);
@@ -117,7 +129,82 @@
 	return 0;
 }
 
-static int crypt_iv_essiv(struct crypt_config *cc, u8 *iv, sector_t sector)
+static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
+	                      const char *opts)
+{
+	struct crypto_tfm *essiv_tfm;
+	struct crypto_tfm *hash_tfm;
+	struct scatterlist sg;
+	unsigned int saltsize;
+	u8 *salt;
+
+	if (opts == NULL) {
+		ti->error = PFX "Digest algorithm missing for ESSIV mode";
+		return -EINVAL;
+	}
+
+	/* Hash the cipher key with the given hash algorithm */
+	hash_tfm = crypto_alloc_tfm(opts, 0);
+	if (hash_tfm == NULL) {
+		ti->error = PFX "Error initializing ESSIV hash";
+		return -EINVAL;
+	}
+
+	if (crypto_tfm_alg_type(hash_tfm) != CRYPTO_ALG_TYPE_DIGEST) {
+		ti->error = PFX "Expected digest algorithm for ESSIV hash";
+		crypto_free_tfm(hash_tfm);
+		return -EINVAL;
+	}
+
+	saltsize = crypto_tfm_alg_digestsize(hash_tfm);
+	salt = kmalloc(saltsize, GFP_KERNEL);
+	if (salt == NULL) {
+		ti->error = PFX "Error kmallocing salt storage in ESSIV";
+		crypto_free_tfm(hash_tfm);
+		return -ENOMEM;
+	}
+
+	sg.page = virt_to_page(cc->key);
+	sg.offset = offset_in_page(cc->key);
+	sg.length = cc->key_size;
+	crypto_digest_digest(hash_tfm, &sg, 1, salt);
+	crypto_free_tfm(hash_tfm);
+
+	/* Setup the essiv_tfm with the given salt */
+	essiv_tfm = crypto_alloc_tfm(crypto_tfm_alg_name(cc->tfm),
+	                             CRYPTO_TFM_MODE_ECB);
+	if (essiv_tfm == NULL) {
+		ti->error = PFX "Error allocating crypto tfm for ESSIV";
+		kfree(salt);
+		return -EINVAL;
+	}
+	if (crypto_tfm_alg_blocksize(essiv_tfm)
+	    != crypto_tfm_alg_ivsize(cc->tfm)) {
+		ti->error = PFX "Block size of ESSIV cipher does "
+			        "not match IV size of block cipher";
+		crypto_free_tfm(essiv_tfm);
+		kfree(salt);
+		return -EINVAL;
+	}
+	if (crypto_cipher_setkey(essiv_tfm, salt, saltsize) < 0) {
+		ti->error = PFX "Failed to set key for ESSIV cipher";
+		crypto_free_tfm(essiv_tfm);
+		kfree(salt);
+		return -EINVAL;
+	}
+	kfree(salt);
+
+	cc->iv_gen_private = (void *)essiv_tfm;
+	return 0;
+}
+
+static void crypt_iv_essiv_dtr(struct crypt_config *cc)
+{
+	crypto_free_tfm((struct crypto_tfm *)cc->iv_gen_private);
+	cc->iv_gen_private = NULL;
+}
+
+static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
 {
 	struct scatterlist sg = { NULL, };
 
@@ -133,6 +220,17 @@
 	return 0;
 }
 
+static struct crypt_iv_operations crypt_iv_plain_ops = {
+	.generator = crypt_iv_plain_gen
+};
+
+static struct crypt_iv_operations crypt_iv_essiv_ops = {
+	.ctr       = crypt_iv_essiv_ctr,
+	.dtr       = crypt_iv_essiv_dtr,
+	.generator = crypt_iv_essiv_gen
+};
+
+
 static inline int
 crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out,
                           struct scatterlist *in, unsigned int length,
@@ -141,8 +239,8 @@
 	u8 iv[cc->iv_size];
 	int r;
 
-	if (cc->iv_generator) {
-		r = cc->iv_generator(cc, iv, sector);
+	if (cc->iv_gen_ops) {
+		r = cc->iv_gen_ops->generator(cc, iv, sector);
 		if (r < 0)
 			return r;
 
@@ -228,13 +326,13 @@
  */
 static struct bio *
 crypt_alloc_buffer(struct crypt_config *cc, unsigned int size,
-                   struct bio *base_bio, int *bio_vec_idx)
+                   struct bio *base_bio, unsigned int *bio_vec_idx)
 {
 	struct bio *bio;
-	int nr_iovecs = dm_div_up(size, PAGE_SIZE);
+	unsigned int nr_iovecs = dm_div_up(size, PAGE_SIZE);
 	int gfp_mask = GFP_NOIO | __GFP_HIGHMEM;
-	int flags = current->flags;
-	int i;
+	unsigned long flags = current->flags;
+	unsigned int i;
 
 	/*
 	 * Tell VM to act less aggressively and fail earlier.
@@ -308,9 +406,8 @@
 static void crypt_free_buffer_pages(struct crypt_config *cc,
                                     struct bio *bio, unsigned int bytes)
 {
-	unsigned int start, end;
+	unsigned int i, start, end;
 	struct bio_vec *bv;
-	int i;
 
 	/*
 	 * This is ugly, but Jens Axboe thinks that using bi_idx in the
@@ -394,11 +491,11 @@
 /*
  * Decode key from its hex representation
  */
-static int crypt_decode_key(u8 *key, char *hex, int size)
+static int crypt_decode_key(u8 *key, char *hex, unsigned int size)
 {
 	char buffer[3];
 	char *endp;
-	int i;
+	unsigned int i;
 
 	buffer[2] = '\0';
 
@@ -421,9 +518,9 @@
 /*
  * Encode key into its hex representation
  */
-static void crypt_encode_key(char *hex, u8 *key, int size)
+static void crypt_encode_key(char *hex, u8 *key, unsigned int size)
 {
-	int i;
+	unsigned int i;
 
 	for(i = 0; i < size; i++) {
 		sprintf(hex, "%02x", *key);
@@ -444,9 +541,9 @@
 	char *cipher;
 	char *chainmode;
 	char *ivmode;
-	int crypto_flags;
-	int key_size;
-	int need_iv;
+	char *ivopts;
+	unsigned int crypto_flags;
+	unsigned int key_size;
 
 	if (argc != 5) {
 		ti->error = PFX "Not enough arguments";
@@ -456,7 +553,8 @@
 	tmp = argv[0];
 	cipher = strsep(&tmp, "-");
 	chainmode = strsep(&tmp, "-");
-	ivmode = strsep(&tmp, "-");
+	ivopts = strsep(&tmp, "-");
+	ivmode = strsep(&ivopts, ":");
 
 	if (tmp)
 		DMWARN(PFX "Unexpected additional cipher options");
@@ -478,111 +576,57 @@
 	}
 
 	/* Compatiblity mode for old dm-crypt cipher strings */
-	if (!chainmode || strcmp(chainmode, "plain") == 0) {
+	if (!chainmode || (strcmp(chainmode, "plain") == 0 && !ivmode)) {
 		chainmode = "cbc";
 		ivmode = "plain";
 	}
 
 	/* Choose crypto_flags according to chainmode */
-	if (strcmp(chainmode, "cbc") == 0) {
+	if (strcmp(chainmode, "cbc") == 0)
 		crypto_flags = CRYPTO_TFM_MODE_CBC;
-		need_iv = 1;
-	} else if (strcmp(chainmode, "ecb") == 0) {
+	else if (strcmp(chainmode, "ecb") == 0)
 		crypto_flags = CRYPTO_TFM_MODE_ECB;
-		need_iv = 0;
-	}  else {
+	else {
 		ti->error = PFX "Unknown chaining mode";
 		goto bad1;
 	}
 
+	if (crypto_flags != CRYPTO_TFM_MODE_ECB && !ivmode) {
+		ti->error = PFX "This chaining mode requires an IV mechanism";
+		goto bad1;
+	}
+
 	tfm = crypto_alloc_tfm(cipher, crypto_flags);
 	if (!tfm) {
 		ti->error = PFX "Error allocating crypto tfm";
 		goto bad1;
 	}
+	if (crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER) {
+		ti->error = PFX "Expected cipher algorithm";
+		goto bad2;
+	}
+
+	cc->tfm = tfm;
 
 	/* 
 	 * Choose ivmode. Valid modes: "plain", "essiv:<esshash>". 
 	 * See comments at iv code
 	 */
 
-	if (!need_iv)
-		cc->iv_generator = NULL;
+	if (ivmode == NULL)
+		cc->iv_gen_ops = NULL;
 	else if (strcmp(ivmode, "plain") == 0)
-		cc->iv_generator = crypt_iv_plain;
-	else if (strncmp(ivmode, "essiv:", 6) == 0) {
-		struct crypto_tfm *essiv_tfm;
-		struct crypto_tfm *hash_tfm;
-		struct scatterlist sg;
-		char *salt;
-		int saltsize;
-
-		strsep(&ivmode, ":");	/* iv mode points to hash string now */
-
-		/* Hash the cipher key with the given hash algorithm */
-		hash_tfm = crypto_alloc_tfm(ivmode, 0);
-		if (hash_tfm == NULL) {
-			ti->error = PFX "Error initializing ESSIV hash";
-			goto bad1;
-		}
-
-		if (crypto_tfm_alg_type(hash_tfm) != CRYPTO_ALG_TYPE_DIGEST) {
-			ti->error =
-				PFX "Expected digest algorithm for ESSIV hash";
-			crypto_free_tfm(hash_tfm);
-			goto bad1;
-		}
-
-		saltsize = crypto_tfm_alg_digestsize(hash_tfm);
-		salt = kmalloc(saltsize, GFP_KERNEL);
-		if (salt == NULL) {
-			ti->error =
-				PFX "Error kmallocing salt storage in ESSIV";
-			crypto_free_tfm(hash_tfm);
-			goto bad1;
-		}
-
-		sg.page = virt_to_page(cc->key);
-		sg.offset = offset_in_page(cc->key);
-		sg.length = cc->key_size;
-		crypto_digest_digest(hash_tfm, &sg, 1, salt);
-		crypto_free_tfm(hash_tfm);
-
-		/* Setup the essiv_tfm with the given salt */
-		essiv_tfm = crypto_alloc_tfm(cipher, CRYPTO_TFM_MODE_ECB);
-		if (essiv_tfm == NULL) {
-			ti->error =
-				PFX "Error allocating crypto tfm for ESSIV";
-			kfree(salt);
-			goto bad1;
-		}
-		if (crypto_tfm_alg_blocksize(essiv_tfm)
-		    != crypto_tfm_alg_ivsize(tfm)) {
-			ti->error = PFX "Block size of ESSIV cipher does "
-				        "not match IV size of block cipher";
-			crypto_free_tfm(essiv_tfm);
-			kfree(salt);
-			goto bad1;
-		}
-		if (crypto_cipher_setkey(essiv_tfm, salt, saltsize) < 0) {
-			ti->error = PFX "Failed to set key for ESSIV cipher";
-			crypto_free_tfm(essiv_tfm);
-			kfree(salt);
-			goto bad1;
-		}
-
-		kfree(salt);
-		cc->iv_gen_private = (void *)essiv_tfm;
-		cc->iv_generator = crypt_iv_essiv;
-	} else {
+		cc->iv_gen_ops = &crypt_iv_plain_ops;
+	else if (strcmp(ivmode, "essiv") == 0)
+		cc->iv_gen_ops = &crypt_iv_essiv_ops;
+	else {
 		ti->error = PFX "Invalid IV mode";
-		goto bad1;
+		goto bad2;
 	}
 
-	if (crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER) {
-		ti->error = PFX "Expected cipher algorithm";
+	if (cc->iv_gen_ops && cc->iv_gen_ops->ctr &&
+	    cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0)
 		goto bad2;
-	}
 
 	if (tfm->crt_cipher.cit_decrypt_iv && tfm->crt_cipher.cit_encrypt_iv)
 		/* at least a 64 bit sector number should fit in our buffer */
@@ -590,9 +634,11 @@
 		                  (unsigned int)(sizeof(u64) / sizeof(u8)));
 	else {
 		cc->iv_size = 0;
-		if (cc->iv_generator) {
+		if (cc->iv_gen_ops) {
 			DMWARN(PFX "Selected cipher does not support IVs");
-			cc->iv_generator = NULL;
+			if (cc->iv_gen_ops->dtr)
+				cc->iv_gen_ops->dtr(cc);
+			cc->iv_gen_ops = NULL;
 		}
 	}
 
@@ -600,51 +646,62 @@
 				     mempool_free_slab, _crypt_io_pool);
 	if (!cc->io_pool) {
 		ti->error = PFX "Cannot allocate crypt io mempool";
-		goto bad2;
+		goto bad3;
 	}
 
 	cc->page_pool = mempool_create(MIN_POOL_PAGES, mempool_alloc_page,
 				       mempool_free_page, NULL);
 	if (!cc->page_pool) {
 		ti->error = PFX "Cannot allocate page mempool";
-		goto bad3;
+		goto bad4;
 	}
 
-	cc->tfm = tfm;
-
 	if (tfm->crt_cipher.cit_setkey(tfm, cc->key, key_size) < 0) {
 		ti->error = PFX "Error setting key";
-		goto bad4;
+		goto bad5;
 	}
 
 	if (sscanf(argv[2], SECTOR_FORMAT, &cc->iv_offset) != 1) {
 		ti->error = PFX "Invalid iv_offset sector";
-		goto bad4;
+		goto bad5;
 	}
 
 	if (sscanf(argv[4], SECTOR_FORMAT, &cc->start) != 1) {
 		ti->error = PFX "Invalid device sector";
-		goto bad4;
+		goto bad5;
 	}
 
 	if (dm_get_device(ti, argv[3], cc->start, ti->len,
 	                  dm_table_get_mode(ti->table), &cc->dev)) {
 		ti->error = PFX "Device lookup failed";
-		goto bad4;
+		goto bad5;
 	}
 
+	if (ivmode && cc->iv_gen_ops) {
+		if (ivopts)
+			*(ivopts - 1) = ':';
+		cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL);
+		if (!cc->iv_mode) {
+			ti->error = PFX "Error kmallocing iv_mode string";
+			goto bad5;
+		}
+		strcpy(cc->iv_mode, ivmode);
+	} else
+		cc->iv_mode = NULL;
+
 	ti->private = cc;
 	return 0;
 
-bad4:
+bad5:
 	mempool_destroy(cc->page_pool);
-bad3:
+bad4:
 	mempool_destroy(cc->io_pool);
+bad3:
+	if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
+		cc->iv_gen_ops->dtr(cc);
 bad2:
 	crypto_free_tfm(tfm);
 bad1:
-	if (cc->iv_generator == crypt_iv_essiv)
-		crypto_free_tfm((struct crypto_tfm *)cc->iv_gen_private);
 	kfree(cc);
 	return -EINVAL;
 }
@@ -656,9 +713,11 @@
 	mempool_destroy(cc->page_pool);
 	mempool_destroy(cc->io_pool);
 
+	if (cc->iv_mode)
+		kfree(cc->iv_mode);
+	if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
+		cc->iv_gen_ops->dtr(cc);
 	crypto_free_tfm(cc->tfm);
-	if (cc->iv_generator == crypt_iv_essiv)
-		crypto_free_tfm((struct crypto_tfm *)cc->iv_gen_private);
 	dm_put_device(ti, cc->dev);
 	kfree(cc);
 }
@@ -696,7 +755,8 @@
 
 static inline struct bio *
 crypt_clone(struct crypt_config *cc, struct crypt_io *io, struct bio *bio,
-            sector_t sector, int *bvec_idx, struct convert_context *ctx)
+            sector_t sector, unsigned int *bvec_idx,
+            struct convert_context *ctx)
 {
 	struct bio *clone;
 
@@ -749,7 +809,7 @@
 	struct bio *clone;
 	unsigned int remaining = bio->bi_size;
 	sector_t sector = bio->bi_sector - ti->begin;
-	int bvec_idx = 0;
+	unsigned int bvec_idx = 0;
 
 	io->target = ti;
 	io->bio = bio;
@@ -811,8 +871,8 @@
 	struct crypt_config *cc = (struct crypt_config *) ti->private;
 	char buffer[32];
 	const char *cipher;
-	const char *mode = NULL;
-	int offset;
+	const char *chainmode = NULL;
+	unsigned int sz = 0;
 
 	switch (type) {
 	case STATUSTYPE_INFO:
@@ -824,34 +884,35 @@
 
 		switch(cc->tfm->crt_cipher.cit_mode) {
 		case CRYPTO_TFM_MODE_CBC:
-			mode = "plain";
+			chainmode = "cbc";
 			break;
 		case CRYPTO_TFM_MODE_ECB:
-			mode = "ecb";
+			chainmode = "ecb";
 			break;
 		default:
 			BUG();
 		}
 
-		snprintf(result, maxlen, "%s-%s ", cipher, mode);
-		offset = strlen(result);
+		if (cc->iv_mode)
+			DMEMIT("%s-%s-%s ", cipher, chainmode, cc->iv_mode);
+		else
+			DMEMIT("%s-%s ", cipher, chainmode);
 
 		if (cc->key_size > 0) {
-			if ((maxlen - offset) < ((cc->key_size << 1) + 1))
+			if ((maxlen - sz) < ((cc->key_size << 1) + 1))
 				return -ENOMEM;
 
-			crypt_encode_key(result + offset, cc->key, cc->key_size);
-			offset += cc->key_size << 1;
+			crypt_encode_key(result + sz, cc->key, cc->key_size);
+			sz += cc->key_size << 1;
 		} else {
-			if (offset >= maxlen)
+			if (sz >= maxlen)
 				return -ENOMEM;
-			result[offset++] = '-';
+			result[sz++] = '-';
 		}
 
 		format_dev_t(buffer, cc->dev->bdev->bd_dev);
-		snprintf(result + offset, maxlen - offset, " " SECTOR_FORMAT
-		         " %s " SECTOR_FORMAT, cc->iv_offset,
-		         buffer, cc->start);
+		DMEMIT(" " SECTOR_FORMAT " %s " SECTOR_FORMAT,
+		       cc->iv_offset, buffer, cc->start);
 		break;
 	}
 	return 0;
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm-flakey.c linux-2.6.9.udm1/drivers/md/dm-flakey.c
--- linux-2.6.9.rc3udm1/drivers/md/dm-flakey.c	2004-10-19 23:52:59.461663159 +0200
+++ linux-2.6.9.udm1/drivers/md/dm-flakey.c	2004-10-19 23:53:13.730549329 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2003 Sistina Software (UK) Limited.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
@@ -154,5 +155,5 @@
 module_exit(dm_flakey_exit);
 
 MODULE_DESCRIPTION(DM_NAME " flakey target");
-MODULE_AUTHOR("Joe Thornber <thornber at sistina.com>");
+MODULE_AUTHOR("Joe Thornber <dm-devel at redhat.com>");
 MODULE_LICENSE("GPL");
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm-ioctl.c linux-2.6.9.udm1/drivers/md/dm-ioctl.c
--- linux-2.6.9.rc3udm1/drivers/md/dm-ioctl.c	2004-10-19 23:52:59.436666862 +0200
+++ linux-2.6.9.udm1/drivers/md/dm-ioctl.c	2004-10-19 23:53:13.696554366 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
@@ -17,7 +18,7 @@
 
 #include <asm/uaccess.h>
 
-#define DM_DRIVER_EMAIL "dm at uk.sistina.com"
+#define DM_DRIVER_EMAIL "dm-devel at redhat.com"
 
 /*-----------------------------------------------------------------
  * The ioctl interface needs to be able to look up devices by
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm-mpath.c linux-2.6.9.udm1/drivers/md/dm-mpath.c
--- linux-2.6.9.rc3udm1/drivers/md/dm-mpath.c	2004-10-19 23:52:59.447665233 +0200
+++ linux-2.6.9.udm1/drivers/md/dm-mpath.c	2004-10-19 23:53:13.707552736 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2003 Sistina Software Limited.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm-path-selector.c linux-2.6.9.udm1/drivers/md/dm-path-selector.c
--- linux-2.6.9.rc3udm1/drivers/md/dm-path-selector.c	2004-10-19 23:52:59.448665084 +0200
+++ linux-2.6.9.udm1/drivers/md/dm-path-selector.c	2004-10-19 23:53:13.714551699 +0200
@@ -75,16 +75,21 @@
 {
 	struct ps_internal *psi;
 
+	if (!pst)
+		return;
+
 	down_read(&_ps_lock);
 	psi = __find_path_selector_type(pst->name);
 	if (!psi)
-		return;
+		goto out;
 
 	if (--psi->use == 0)
 		module_put(psi->pst.module);
 
 	if (psi->use < 0)
 		BUG();
+
+out:
 	up_read(&_ps_lock);
 }
 
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm-table.c linux-2.6.9.udm1/drivers/md/dm-table.c
--- linux-2.6.9.rc3udm1/drivers/md/dm-table.c	2004-10-19 23:52:59.426668343 +0200
+++ linux-2.6.9.udm1/drivers/md/dm-table.c	2004-10-19 23:53:13.685555995 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2001 Sistina Software (UK) Limited.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm.c linux-2.6.9.udm1/drivers/md/dm.c
--- linux-2.6.9.rc3udm1/drivers/md/dm.c	2004-10-19 23:52:59.438666566 +0200
+++ linux-2.6.9.udm1/drivers/md/dm.c	2004-10-19 23:53:13.719550959 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
@@ -807,7 +808,7 @@
 {
 	struct mapped_device *md = (struct mapped_device *) context;
 
-	atomic_inc(&md->event_nr);;
+	atomic_inc(&md->event_nr);
 	wake_up(&md->eventq);
 }
 
@@ -1170,5 +1171,5 @@
 module_param(major, uint, 0);
 MODULE_PARM_DESC(major, "The major number of the device mapper");
 MODULE_DESCRIPTION(DM_NAME " driver");
-MODULE_AUTHOR("Joe Thornber <thornber at sistina.com>");
+MODULE_AUTHOR("Joe Thornber <dm-devel at redhat.com>");
 MODULE_LICENSE("GPL");
diff -ruN linux-2.6.9.rc3udm1/drivers/md/dm.h linux-2.6.9.udm1/drivers/md/dm.h
--- linux-2.6.9.rc3udm1/drivers/md/dm.h	2004-10-19 23:52:59.438666566 +0200
+++ linux-2.6.9.udm1/drivers/md/dm.h	2004-10-19 23:53:13.698554069 +0200
@@ -2,6 +2,7 @@
  * Internal header file for device mapper
  *
  * Copyright (C) 2001, 2002 Sistina Software
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the LGPL.
  */
@@ -27,7 +28,7 @@
  * in types.h.
  */
 #ifdef CONFIG_LBD
-#define SECTOR_FORMAT "%Lu"
+#define SECTOR_FORMAT "%llu"
 #else
 #define SECTOR_FORMAT "%lu"
 #endif
diff -ruN linux-2.6.9.rc3udm1/include/linux/device-mapper.h linux-2.6.9.udm1/include/linux/device-mapper.h
--- linux-2.6.9.rc3udm1/include/linux/device-mapper.h	2004-10-19 23:52:59.429667899 +0200
+++ linux-2.6.9.udm1/include/linux/device-mapper.h	2004-10-19 23:53:13.689555402 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2001 Sistina Software (UK) Limited.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the LGPL.
  */
diff -ruN linux-2.6.9.rc3udm1/include/linux/dm-ioctl.h linux-2.6.9.udm1/include/linux/dm-ioctl.h
--- linux-2.6.9.rc3udm1/include/linux/dm-ioctl.h	2004-10-19 23:52:59.440666269 +0200
+++ linux-2.6.9.udm1/include/linux/dm-ioctl.h	2004-10-19 23:53:13.699553921 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the LGPL.
  */


More information about the dm-devel mailing list