diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2009-09-17 14:47:39 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-10-01 15:15:42 -0400 |
commit | 9ddb27b44ffeb3080b71cc493b2edff2224d9356 (patch) | |
tree | c4ad897a3f4b6fbd2bf1b1ed0a13e3e52482a8e1 | |
parent | 8ce51966d3b809d6c1ae4f3902058558589480b8 (diff) |
cciss: Clear all sysfs-exposed data for deleted logical drives.
When removing a logical drive, clear all the information that is
now exposed by sysfs (e.g. vendor, model, serial number.)
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | drivers/block/cciss.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index aa95eeb30206..09a0f7bb433b 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2134,6 +2134,25 @@ mem_msg: | |||
2134 | goto freeret; | 2134 | goto freeret; |
2135 | } | 2135 | } |
2136 | 2136 | ||
2137 | static void cciss_clear_drive_info(drive_info_struct *drive_info) | ||
2138 | { | ||
2139 | /* zero out the disk size info */ | ||
2140 | drive_info->nr_blocks = 0; | ||
2141 | drive_info->block_size = 0; | ||
2142 | drive_info->heads = 0; | ||
2143 | drive_info->sectors = 0; | ||
2144 | drive_info->cylinders = 0; | ||
2145 | drive_info->raid_level = -1; | ||
2146 | memset(drive_info->serial_no, 0, sizeof(drive_info->serial_no)); | ||
2147 | memset(drive_info->model, 0, sizeof(drive_info->model)); | ||
2148 | memset(drive_info->rev, 0, sizeof(drive_info->rev)); | ||
2149 | memset(drive_info->vendor, 0, sizeof(drive_info->vendor)); | ||
2150 | /* | ||
2151 | * don't clear the LUNID though, we need to remember which | ||
2152 | * one this one is. | ||
2153 | */ | ||
2154 | } | ||
2155 | |||
2137 | /* This function will deregister the disk and it's queue from the | 2156 | /* This function will deregister the disk and it's queue from the |
2138 | * kernel. It must be called with the controller lock held and the | 2157 | * kernel. It must be called with the controller lock held and the |
2139 | * drv structures busy_configuring flag set. It's parameters are: | 2158 | * drv structures busy_configuring flag set. It's parameters are: |
@@ -2212,16 +2231,8 @@ static int deregister_disk(ctlr_info_t *h, int drv_index, | |||
2212 | } | 2231 | } |
2213 | 2232 | ||
2214 | --h->num_luns; | 2233 | --h->num_luns; |
2215 | /* zero out the disk size info */ | 2234 | cciss_clear_drive_info(drv); |
2216 | drv->nr_blocks = 0; | 2235 | |
2217 | drv->block_size = 0; | ||
2218 | drv->heads = 0; | ||
2219 | drv->sectors = 0; | ||
2220 | drv->cylinders = 0; | ||
2221 | drv->raid_level = -1; /* This can be used as a flag variable to | ||
2222 | * indicate that this element of the drive | ||
2223 | * array is free. | ||
2224 | */ | ||
2225 | if (clear_all) { | 2236 | if (clear_all) { |
2226 | /* check to see if it was the last disk */ | 2237 | /* check to see if it was the last disk */ |
2227 | if (drv == h->drv + h->highest_lun) { | 2238 | if (drv == h->drv + h->highest_lun) { |