Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
  [S390] kvm-390: Let kernel exit SIE instruction on work
  [S390] dasd: check sense type in device change handler
  [S390] pfault: fix token handling
  [S390] qdio: reset error states immediately
  [S390] fix page table walk for changing page attributes
  [S390] prng: prevent access beyond end of stack
  [S390] dasd: fix race between open and offline
  • Loading branch information
torvalds committed Apr 26, 2011
2 parents 019793b + 9ff4cfb commit fc7b3ff
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 74 deletions.
2 changes: 1 addition & 1 deletion arch/s390/crypto/prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void prng_seed(int nbytes)

/* Add the entropy */
while (nbytes >= 8) {
*((__u64 *)parm_block) ^= *((__u64 *)buf+i*8);
*((__u64 *)parm_block) ^= *((__u64 *)buf+i);
prng_add_entropy();
i += 8;
nbytes -= 8;
Expand Down
4 changes: 2 additions & 2 deletions arch/s390/kvm/sie64a.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ sie_irq_handler:
tm __TI_flags+7(%r2),_TIF_EXIT_SIE
jz 0f
larl %r2,sie_exit # work pending, leave sie
stg %r2,__LC_RETURN_PSW+8
stg %r2,SPI_PSW+8(0,%r15)
br %r14
0: larl %r2,sie_reenter # re-enter with guest id
stg %r2,__LC_RETURN_PSW+8
stg %r2,SPI_PSW+8(0,%r15)
1: br %r14

/*
Expand Down
4 changes: 2 additions & 2 deletions arch/s390/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,9 @@ static void pfault_interrupt(unsigned int ext_int_code,
* Get the token (= address of the task structure of the affected task).
*/
#ifdef CONFIG_64BIT
tsk = *(struct task_struct **) param64;
tsk = (struct task_struct *) param64;
#else
tsk = *(struct task_struct **) param32;
tsk = (struct task_struct *) param32;
#endif

if (subcode & 0x0080) {
Expand Down
5 changes: 3 additions & 2 deletions arch/s390/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ static void change_page_attr(unsigned long addr, int numpages,
WARN_ON_ONCE(1);
continue;
}
ptep = pte_offset_kernel(pmdp, addr + i * PAGE_SIZE);
ptep = pte_offset_kernel(pmdp, addr);

pte = *ptep;
pte = set(pte);
ptep_invalidate(&init_mm, addr + i * PAGE_SIZE, ptep);
ptep_invalidate(&init_mm, addr, ptep);
*ptep = pte;
addr += PAGE_SIZE;
}
}

Expand Down
40 changes: 22 additions & 18 deletions drivers/s390/block/dasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2314,15 +2314,14 @@ static void dasd_flush_request_queue(struct dasd_block *block)

static int dasd_open(struct block_device *bdev, fmode_t mode)
{
struct dasd_block *block = bdev->bd_disk->private_data;
struct dasd_device *base;
int rc;

if (!block)
base = dasd_device_from_gendisk(bdev->bd_disk);
if (!base)
return -ENODEV;

base = block->base;
atomic_inc(&block->open_count);
atomic_inc(&base->block->open_count);
if (test_bit(DASD_FLAG_OFFLINE, &base->flags)) {
rc = -ENODEV;
goto unlock;
Expand Down Expand Up @@ -2355,21 +2354,28 @@ static int dasd_open(struct block_device *bdev, fmode_t mode)
goto out;
}

dasd_put_device(base);
return 0;

out:
module_put(base->discipline->owner);
unlock:
atomic_dec(&block->open_count);
atomic_dec(&base->block->open_count);
dasd_put_device(base);
return rc;
}

static int dasd_release(struct gendisk *disk, fmode_t mode)
{
struct dasd_block *block = disk->private_data;
struct dasd_device *base;

atomic_dec(&block->open_count);
module_put(block->base->discipline->owner);
base = dasd_device_from_gendisk(disk);
if (!base)
return -ENODEV;

atomic_dec(&base->block->open_count);
module_put(base->discipline->owner);
dasd_put_device(base);
return 0;
}

Expand All @@ -2378,20 +2384,20 @@ static int dasd_release(struct gendisk *disk, fmode_t mode)
*/
static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
{
struct dasd_block *block;
struct dasd_device *base;

block = bdev->bd_disk->private_data;
if (!block)
base = dasd_device_from_gendisk(bdev->bd_disk);
if (!base)
return -ENODEV;
base = block->base;

if (!base->discipline ||
!base->discipline->fill_geometry)
!base->discipline->fill_geometry) {
dasd_put_device(base);
return -EINVAL;

base->discipline->fill_geometry(block, geo);
geo->start = get_start_sect(bdev) >> block->s2b_shift;
}
base->discipline->fill_geometry(base->block, geo);
geo->start = get_start_sect(bdev) >> base->block->s2b_shift;
dasd_put_device(base);
return 0;
}

Expand Down Expand Up @@ -2528,7 +2534,6 @@ void dasd_generic_remove(struct ccw_device *cdev)
dasd_set_target_state(device, DASD_STATE_NEW);
/* dasd_delete_device destroys the device reference. */
block = device->block;
device->block = NULL;
dasd_delete_device(device);
/*
* life cycle of block is bound to device, so delete it after
Expand Down Expand Up @@ -2650,7 +2655,6 @@ int dasd_generic_set_offline(struct ccw_device *cdev)
dasd_set_target_state(device, DASD_STATE_NEW);
/* dasd_delete_device destroys the device reference. */
block = device->block;
device->block = NULL;
dasd_delete_device(device);
/*
* life cycle of block is bound to device, so delete it after
Expand Down
30 changes: 30 additions & 0 deletions drivers/s390/block/dasd_devmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,36 @@ dasd_device_from_cdev(struct ccw_device *cdev)
return device;
}

void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device)
{
struct dasd_devmap *devmap;

devmap = dasd_find_busid(dev_name(&device->cdev->dev));
if (IS_ERR(devmap))
return;
spin_lock(&dasd_devmap_lock);
gdp->private_data = devmap;
spin_unlock(&dasd_devmap_lock);
}

struct dasd_device *dasd_device_from_gendisk(struct gendisk *gdp)
{
struct dasd_device *device;
struct dasd_devmap *devmap;

if (!gdp->private_data)
return NULL;
device = NULL;
spin_lock(&dasd_devmap_lock);
devmap = gdp->private_data;
if (devmap && devmap->device) {
device = devmap->device;
dasd_get_device(device);
}
spin_unlock(&dasd_devmap_lock);
return device;
}

/*
* SECTION: files in sysfs
*/
Expand Down
5 changes: 3 additions & 2 deletions drivers/s390/block/dasd_eckd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2037,7 +2037,7 @@ static void dasd_eckd_check_for_device_change(struct dasd_device *device,
return;

/* summary unit check */
if ((sense[7] == 0x0D) &&
if ((sense[27] & DASD_SENSE_BIT_0) && (sense[7] == 0x0D) &&
(scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK)) {
dasd_alias_handle_summary_unit_check(device, irb);
return;
Expand All @@ -2053,7 +2053,8 @@ static void dasd_eckd_check_for_device_change(struct dasd_device *device,
/* loss of device reservation is handled via base devices only
* as alias devices may be used with several bases
*/
if (device->block && (sense[7] == 0x3F) &&
if (device->block && (sense[27] & DASD_SENSE_BIT_0) &&
(sense[7] == 0x3F) &&
(scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) &&
test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) {
if (device->features & DASD_FEATURE_FAILONSLCK)
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/block/dasd_genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int dasd_gendisk_alloc(struct dasd_block *block)
if (base->features & DASD_FEATURE_READONLY ||
test_bit(DASD_FLAG_DEVICE_RO, &base->flags))
set_disk_ro(gdp, 1);
gdp->private_data = block;
dasd_add_link_to_gendisk(gdp, base);
gdp->queue = block->request_queue;
block->gdp = gdp;
set_capacity(block->gdp, 0);
Expand Down
3 changes: 3 additions & 0 deletions drivers/s390/block/dasd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,9 @@ struct dasd_device *dasd_device_from_cdev(struct ccw_device *);
struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *);
struct dasd_device *dasd_device_from_devindex(int);

void dasd_add_link_to_gendisk(struct gendisk *, struct dasd_device *);
struct dasd_device *dasd_device_from_gendisk(struct gendisk *);

int dasd_parse(void);
int dasd_busid_known(const char *);

Expand Down
Loading

0 comments on commit fc7b3ff

Please sign in to comment.