Commit 5bd5e8d8 authored by Mike Snitzer's avatar Mike Snitzer

dm: remove fmode_t argument from .prepare_ioctl hook

Use the fmode_t that is passed to dm_blk_ioctl() rather than
inconsistently (varies across targets) drop it on the floor by
overriding it with the fmode_t stored in 'struct dm_dev'.

All the persistent reservation functions weren't using the fmode_t they
got back from .prepare_ioctl so remove them.
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 971888c4
...@@ -442,8 +442,7 @@ static void flakey_status(struct dm_target *ti, status_type_t type, ...@@ -442,8 +442,7 @@ static void flakey_status(struct dm_target *ti, status_type_t type,
} }
} }
static int flakey_prepare_ioctl(struct dm_target *ti, static int flakey_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
struct block_device **bdev, fmode_t *mode)
{ {
struct flakey_c *fc = ti->private; struct flakey_c *fc = ti->private;
......
...@@ -130,8 +130,7 @@ static void linear_status(struct dm_target *ti, status_type_t type, ...@@ -130,8 +130,7 @@ static void linear_status(struct dm_target *ti, status_type_t type,
} }
} }
static int linear_prepare_ioctl(struct dm_target *ti, static int linear_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
struct block_device **bdev, fmode_t *mode)
{ {
struct linear_c *lc = (struct linear_c *) ti->private; struct linear_c *lc = (struct linear_c *) ti->private;
struct dm_dev *dev = lc->dev; struct dm_dev *dev = lc->dev;
......
...@@ -864,7 +864,7 @@ static void log_writes_status(struct dm_target *ti, status_type_t type, ...@@ -864,7 +864,7 @@ static void log_writes_status(struct dm_target *ti, status_type_t type,
} }
static int log_writes_prepare_ioctl(struct dm_target *ti, static int log_writes_prepare_ioctl(struct dm_target *ti,
struct block_device **bdev, fmode_t *mode) struct block_device **bdev)
{ {
struct log_writes_c *lc = ti->private; struct log_writes_c *lc = ti->private;
struct dm_dev *dev = lc->dev; struct dm_dev *dev = lc->dev;
......
...@@ -1876,7 +1876,7 @@ static int multipath_message(struct dm_target *ti, unsigned argc, char **argv, ...@@ -1876,7 +1876,7 @@ static int multipath_message(struct dm_target *ti, unsigned argc, char **argv,
} }
static int multipath_prepare_ioctl(struct dm_target *ti, static int multipath_prepare_ioctl(struct dm_target *ti,
struct block_device **bdev, fmode_t *mode) struct block_device **bdev)
{ {
struct multipath *m = ti->private; struct multipath *m = ti->private;
struct pgpath *current_pgpath; struct pgpath *current_pgpath;
...@@ -1889,7 +1889,6 @@ static int multipath_prepare_ioctl(struct dm_target *ti, ...@@ -1889,7 +1889,6 @@ static int multipath_prepare_ioctl(struct dm_target *ti,
if (current_pgpath) { if (current_pgpath) {
if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) { if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) {
*bdev = current_pgpath->path.dev->bdev; *bdev = current_pgpath->path.dev->bdev;
*mode = current_pgpath->path.dev->mode;
r = 0; r = 0;
} else { } else {
/* pg_init has not started or completed */ /* pg_init has not started or completed */
......
...@@ -512,8 +512,7 @@ static void switch_status(struct dm_target *ti, status_type_t type, ...@@ -512,8 +512,7 @@ static void switch_status(struct dm_target *ti, status_type_t type,
* *
* Passthrough all ioctls to the path for sector 0 * Passthrough all ioctls to the path for sector 0
*/ */
static int switch_prepare_ioctl(struct dm_target *ti, static int switch_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
struct block_device **bdev, fmode_t *mode)
{ {
struct switch_ctx *sctx = ti->private; struct switch_ctx *sctx = ti->private;
unsigned path_nr; unsigned path_nr;
...@@ -521,7 +520,6 @@ static int switch_prepare_ioctl(struct dm_target *ti, ...@@ -521,7 +520,6 @@ static int switch_prepare_ioctl(struct dm_target *ti,
path_nr = switch_get_path_nr(sctx, 0); path_nr = switch_get_path_nr(sctx, 0);
*bdev = sctx->path_list[path_nr].dmdev->bdev; *bdev = sctx->path_list[path_nr].dmdev->bdev;
*mode = sctx->path_list[path_nr].dmdev->mode;
/* /*
* Only pass ioctls through if the device sizes match exactly. * Only pass ioctls through if the device sizes match exactly.
......
...@@ -723,8 +723,7 @@ static void verity_status(struct dm_target *ti, status_type_t type, ...@@ -723,8 +723,7 @@ static void verity_status(struct dm_target *ti, status_type_t type,
} }
} }
static int verity_prepare_ioctl(struct dm_target *ti, static int verity_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
struct block_device **bdev, fmode_t *mode)
{ {
struct dm_verity *v = ti->private; struct dm_verity *v = ti->private;
......
...@@ -898,8 +898,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits) ...@@ -898,8 +898,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
/* /*
* Pass on ioctl to the backend device. * Pass on ioctl to the backend device.
*/ */
static int dmz_prepare_ioctl(struct dm_target *ti, static int dmz_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
struct block_device **bdev, fmode_t *mode)
{ {
struct dmz_target *dmz = ti->private; struct dmz_target *dmz = ti->private;
......
...@@ -459,7 +459,7 @@ static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) ...@@ -459,7 +459,7 @@ static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
} }
static int dm_prepare_ioctl(struct mapped_device *md, int *srcu_idx, static int dm_prepare_ioctl(struct mapped_device *md, int *srcu_idx,
struct block_device **bdev, fmode_t *mode) struct block_device **bdev)
__acquires(md->io_barrier) __acquires(md->io_barrier)
{ {
struct dm_target *tgt; struct dm_target *tgt;
...@@ -483,7 +483,7 @@ static int dm_prepare_ioctl(struct mapped_device *md, int *srcu_idx, ...@@ -483,7 +483,7 @@ static int dm_prepare_ioctl(struct mapped_device *md, int *srcu_idx,
if (dm_suspended_md(md)) if (dm_suspended_md(md))
return -EAGAIN; return -EAGAIN;
r = tgt->type->prepare_ioctl(tgt, bdev, mode); r = tgt->type->prepare_ioctl(tgt, bdev);
if (r == -ENOTCONN && !fatal_signal_pending(current)) { if (r == -ENOTCONN && !fatal_signal_pending(current)) {
dm_put_live_table(md, *srcu_idx); dm_put_live_table(md, *srcu_idx);
msleep(10); msleep(10);
...@@ -505,7 +505,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, ...@@ -505,7 +505,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
struct mapped_device *md = bdev->bd_disk->private_data; struct mapped_device *md = bdev->bd_disk->private_data;
int r, srcu_idx; int r, srcu_idx;
r = dm_prepare_ioctl(md, &srcu_idx, &bdev, &mode); r = dm_prepare_ioctl(md, &srcu_idx, &bdev);
if (r < 0) if (r < 0)
goto out; goto out;
...@@ -3034,10 +3034,9 @@ static int dm_pr_reserve(struct block_device *bdev, u64 key, enum pr_type type, ...@@ -3034,10 +3034,9 @@ static int dm_pr_reserve(struct block_device *bdev, u64 key, enum pr_type type,
{ {
struct mapped_device *md = bdev->bd_disk->private_data; struct mapped_device *md = bdev->bd_disk->private_data;
const struct pr_ops *ops; const struct pr_ops *ops;
fmode_t mode;
int r, srcu_idx; int r, srcu_idx;
r = dm_prepare_ioctl(md, &srcu_idx, &bdev, &mode); r = dm_prepare_ioctl(md, &srcu_idx, &bdev);
if (r < 0) if (r < 0)
goto out; goto out;
...@@ -3055,10 +3054,9 @@ static int dm_pr_release(struct block_device *bdev, u64 key, enum pr_type type) ...@@ -3055,10 +3054,9 @@ static int dm_pr_release(struct block_device *bdev, u64 key, enum pr_type type)
{ {
struct mapped_device *md = bdev->bd_disk->private_data; struct mapped_device *md = bdev->bd_disk->private_data;
const struct pr_ops *ops; const struct pr_ops *ops;
fmode_t mode;
int r, srcu_idx; int r, srcu_idx;
r = dm_prepare_ioctl(md, &srcu_idx, &bdev, &mode); r = dm_prepare_ioctl(md, &srcu_idx, &bdev);
if (r < 0) if (r < 0)
goto out; goto out;
...@@ -3077,10 +3075,9 @@ static int dm_pr_preempt(struct block_device *bdev, u64 old_key, u64 new_key, ...@@ -3077,10 +3075,9 @@ static int dm_pr_preempt(struct block_device *bdev, u64 old_key, u64 new_key,
{ {
struct mapped_device *md = bdev->bd_disk->private_data; struct mapped_device *md = bdev->bd_disk->private_data;
const struct pr_ops *ops; const struct pr_ops *ops;
fmode_t mode;
int r, srcu_idx; int r, srcu_idx;
r = dm_prepare_ioctl(md, &srcu_idx, &bdev, &mode); r = dm_prepare_ioctl(md, &srcu_idx, &bdev);
if (r < 0) if (r < 0)
goto out; goto out;
...@@ -3098,10 +3095,9 @@ static int dm_pr_clear(struct block_device *bdev, u64 key) ...@@ -3098,10 +3095,9 @@ static int dm_pr_clear(struct block_device *bdev, u64 key)
{ {
struct mapped_device *md = bdev->bd_disk->private_data; struct mapped_device *md = bdev->bd_disk->private_data;
const struct pr_ops *ops; const struct pr_ops *ops;
fmode_t mode;
int r, srcu_idx; int r, srcu_idx;
r = dm_prepare_ioctl(md, &srcu_idx, &bdev, &mode); r = dm_prepare_ioctl(md, &srcu_idx, &bdev);
if (r < 0) if (r < 0)
goto out; goto out;
......
...@@ -90,8 +90,7 @@ typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, ...@@ -90,8 +90,7 @@ typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv, typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv,
char *result, unsigned maxlen); char *result, unsigned maxlen);
typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device **bdev);
struct block_device **bdev, fmode_t *mode);
/* /*
* These iteration functions are typically used to check (and combine) * These iteration functions are typically used to check (and combine)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment