dm-mpath.c (633a08b81206122469365b4c72eaeb71f04f2cb4) | dm-mpath.c (586e80e6ee0d137c7d79fbae183bb37bc60ee97e) |
---|---|
1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 | 1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 |
8#include "dm.h" | 8#include <linux/device-mapper.h> 9 |
9#include "dm-path-selector.h" 10#include "dm-bio-list.h" 11#include "dm-bio-record.h" 12#include "dm-uevent.h" 13 14#include <linux/ctype.h> 15#include <linux/init.h> 16#include <linux/mempool.h> --- 1373 unchanged lines hidden (view full) --- 1390 1391 return r; 1392 1393error: 1394 DMWARN("Unrecognised multipath message received."); 1395 return -EINVAL; 1396} 1397 | 10#include "dm-path-selector.h" 11#include "dm-bio-list.h" 12#include "dm-bio-record.h" 13#include "dm-uevent.h" 14 15#include <linux/ctype.h> 16#include <linux/init.h> 17#include <linux/mempool.h> --- 1373 unchanged lines hidden (view full) --- 1391 1392 return r; 1393 1394error: 1395 DMWARN("Unrecognised multipath message received."); 1396 return -EINVAL; 1397} 1398 |
1398static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, | 1399static int multipath_ioctl(struct dm_target *ti, struct inode *inode, 1400 struct file *filp, unsigned int cmd, |
1399 unsigned long arg) 1400{ 1401 struct multipath *m = (struct multipath *) ti->private; 1402 struct block_device *bdev = NULL; | 1401 unsigned long arg) 1402{ 1403 struct multipath *m = (struct multipath *) ti->private; 1404 struct block_device *bdev = NULL; |
1403 fmode_t mode = 0; | |
1404 unsigned long flags; | 1405 unsigned long flags; |
1406 struct file fake_file = {}; 1407 struct dentry fake_dentry = {}; |
|
1405 int r = 0; 1406 | 1408 int r = 0; 1409 |
1410 fake_file.f_path.dentry = &fake_dentry; 1411 |
|
1407 spin_lock_irqsave(&m->lock, flags); 1408 1409 if (!m->current_pgpath) 1410 __choose_pgpath(m); 1411 1412 if (m->current_pgpath) { 1413 bdev = m->current_pgpath->path.dev->bdev; | 1412 spin_lock_irqsave(&m->lock, flags); 1413 1414 if (!m->current_pgpath) 1415 __choose_pgpath(m); 1416 1417 if (m->current_pgpath) { 1418 bdev = m->current_pgpath->path.dev->bdev; |
1414 mode = m->current_pgpath->path.dev->mode; | 1419 fake_dentry.d_inode = bdev->bd_inode; 1420 fake_file.f_mode = m->current_pgpath->path.dev->mode; |
1415 } 1416 1417 if (m->queue_io) 1418 r = -EAGAIN; 1419 else if (!bdev) 1420 r = -EIO; 1421 1422 spin_unlock_irqrestore(&m->lock, flags); 1423 | 1421 } 1422 1423 if (m->queue_io) 1424 r = -EAGAIN; 1425 else if (!bdev) 1426 r = -EIO; 1427 1428 spin_unlock_irqrestore(&m->lock, flags); 1429 |
1424 return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg); | 1430 return r ? : blkdev_driver_ioctl(bdev->bd_inode, &fake_file, 1431 bdev->bd_disk, cmd, arg); |
1425} 1426 1427/*----------------------------------------------------------------- 1428 * Module setup 1429 *---------------------------------------------------------------*/ 1430static struct target_type multipath_target = { 1431 .name = "multipath", 1432 .version = {1, 0, 5}, --- 77 unchanged lines hidden --- | 1432} 1433 1434/*----------------------------------------------------------------- 1435 * Module setup 1436 *---------------------------------------------------------------*/ 1437static struct target_type multipath_target = { 1438 .name = "multipath", 1439 .version = {1, 0, 5}, --- 77 unchanged lines hidden --- |