Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140159
b: refs/heads/master
c: 570b9d9
h: refs/heads/master
i:
  140157: 2c35c9d
  140155: ed398d7
  140151: 5548fac
  140143: fef0256
  140127: b5edb1e
  140095: 2447ac7
  140031: c7c9efa
v: v3
  • Loading branch information
Alasdair G Kergon committed Apr 2, 2009
1 parent 73bd6a7 commit 8e05783
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aea9058801c0acfa2831af1714da412dfb0018c2
refs/heads/master: 570b9d968bf9b16974252ef7cbce73fa6dac34f3
26 changes: 14 additions & 12 deletions trunk/drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,28 +399,30 @@ static int check_device_area(struct dm_dev_internal *dd, sector_t start,
}

/*
* This upgrades the mode on an already open dm_dev. Being
* This upgrades the mode on an already open dm_dev, being
* careful to leave things as they were if we fail to reopen the
* device.
* device and not to touch the existing bdev field in case
* it is accessed concurrently inside dm_table_any_congested().
*/
static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
struct mapped_device *md)
{
int r;
struct dm_dev_internal dd_copy;
dev_t dev = dd->dm_dev.bdev->bd_dev;
struct dm_dev_internal dd_new, dd_old;

dd_copy = *dd;
dd_new = dd_old = *dd;

dd_new.dm_dev.mode |= new_mode;
dd_new.dm_dev.bdev = NULL;

r = open_dev(&dd_new, dd->dm_dev.bdev->bd_dev, md);
if (r)
return r;

dd->dm_dev.mode |= new_mode;
dd->dm_dev.bdev = NULL;
r = open_dev(dd, dev, md);
if (!r)
close_dev(&dd_copy, md);
else
*dd = dd_copy;
close_dev(&dd_old, md);

return r;
return 0;
}

/*
Expand Down

0 comments on commit 8e05783

Please sign in to comment.