dm-mpath.c (54e5c4def0614ab540fbdf68e45342a4af141702) dm-mpath.c (63d832c30142cdceb478b1cac7d943d83b95b2dc)
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 <linux/device-mapper.h>

--- 431 unchanged lines hidden (view full) ---

440
441 spin_lock_irqsave(&m->lock, flags);
442
443 if (save_old_value)
444 m->saved_queue_if_no_path = m->queue_if_no_path;
445 else
446 m->saved_queue_if_no_path = queue_if_no_path;
447 m->queue_if_no_path = queue_if_no_path;
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 <linux/device-mapper.h>

--- 431 unchanged lines hidden (view full) ---

440
441 spin_lock_irqsave(&m->lock, flags);
442
443 if (save_old_value)
444 m->saved_queue_if_no_path = m->queue_if_no_path;
445 else
446 m->saved_queue_if_no_path = queue_if_no_path;
447 m->queue_if_no_path = queue_if_no_path;
448 if (!m->queue_if_no_path)
449 dm_table_run_md_queue_async(m->ti->table);
450
451 spin_unlock_irqrestore(&m->lock, flags);
452
448 spin_unlock_irqrestore(&m->lock, flags);
449
450 if (!queue_if_no_path)
451 dm_table_run_md_queue_async(m->ti->table);
452
453 return 0;
454}
455
456/*
457 * An event is triggered whenever a path is taken out of use.
458 * Includes path failure and PG bypass.
459 */
460static void trigger_event(struct work_struct *work)

--- 488 unchanged lines hidden (view full) ---

949 return 0;
950}
951
952/*
953 * Reinstate a previously-failed path
954 */
955static int reinstate_path(struct pgpath *pgpath)
956{
453 return 0;
454}
455
456/*
457 * An event is triggered whenever a path is taken out of use.
458 * Includes path failure and PG bypass.
459 */
460static void trigger_event(struct work_struct *work)

--- 488 unchanged lines hidden (view full) ---

949 return 0;
950}
951
952/*
953 * Reinstate a previously-failed path
954 */
955static int reinstate_path(struct pgpath *pgpath)
956{
957 int r = 0;
957 int r = 0, run_queue = 0;
958 unsigned long flags;
959 struct multipath *m = pgpath->pg->m;
960
961 spin_lock_irqsave(&m->lock, flags);
962
963 if (pgpath->is_active)
964 goto out;
965

--- 7 unchanged lines hidden (view full) ---

973 r = pgpath->pg->ps.type->reinstate_path(&pgpath->pg->ps, &pgpath->path);
974 if (r)
975 goto out;
976
977 pgpath->is_active = 1;
978
979 if (!m->nr_valid_paths++) {
980 m->current_pgpath = NULL;
958 unsigned long flags;
959 struct multipath *m = pgpath->pg->m;
960
961 spin_lock_irqsave(&m->lock, flags);
962
963 if (pgpath->is_active)
964 goto out;
965

--- 7 unchanged lines hidden (view full) ---

973 r = pgpath->pg->ps.type->reinstate_path(&pgpath->pg->ps, &pgpath->path);
974 if (r)
975 goto out;
976
977 pgpath->is_active = 1;
978
979 if (!m->nr_valid_paths++) {
980 m->current_pgpath = NULL;
981 dm_table_run_md_queue_async(m->ti->table);
981 run_queue = 1;
982 } else if (m->hw_handler_name && (m->current_pg == pgpath->pg)) {
983 if (queue_work(kmpath_handlerd, &pgpath->activate_path.work))
984 m->pg_init_in_progress++;
985 }
986
987 dm_path_uevent(DM_UEVENT_PATH_REINSTATED, m->ti,
988 pgpath->path.dev->name, m->nr_valid_paths);
989
990 schedule_work(&m->trigger_event);
991
992out:
993 spin_unlock_irqrestore(&m->lock, flags);
982 } else if (m->hw_handler_name && (m->current_pg == pgpath->pg)) {
983 if (queue_work(kmpath_handlerd, &pgpath->activate_path.work))
984 m->pg_init_in_progress++;
985 }
986
987 dm_path_uevent(DM_UEVENT_PATH_REINSTATED, m->ti,
988 pgpath->path.dev->name, m->nr_valid_paths);
989
990 schedule_work(&m->trigger_event);
991
992out:
993 spin_unlock_irqrestore(&m->lock, flags);
994 if (run_queue)
995 dm_table_run_md_queue_async(m->ti->table);
994
995 return r;
996}
997
998/*
999 * Fail or reinstate all paths that match the provided struct dm_dev.
1000 */
1001static int action_dev(struct multipath *m, struct dm_dev *dev,

--- 559 unchanged lines hidden (view full) ---

1561 if (r == -ENOTCONN && !fatal_signal_pending(current)) {
1562 spin_lock_irqsave(&m->lock, flags);
1563 if (!m->current_pg) {
1564 /* Path status changed, redo selection */
1565 __choose_pgpath(m, 0);
1566 }
1567 if (m->pg_init_required)
1568 __pg_init_all_paths(m);
996
997 return r;
998}
999
1000/*
1001 * Fail or reinstate all paths that match the provided struct dm_dev.
1002 */
1003static int action_dev(struct multipath *m, struct dm_dev *dev,

--- 559 unchanged lines hidden (view full) ---

1563 if (r == -ENOTCONN && !fatal_signal_pending(current)) {
1564 spin_lock_irqsave(&m->lock, flags);
1565 if (!m->current_pg) {
1566 /* Path status changed, redo selection */
1567 __choose_pgpath(m, 0);
1568 }
1569 if (m->pg_init_required)
1570 __pg_init_all_paths(m);
1569 dm_table_run_md_queue_async(m->ti->table);
1570 spin_unlock_irqrestore(&m->lock, flags);
1571 spin_unlock_irqrestore(&m->lock, flags);
1572 dm_table_run_md_queue_async(m->ti->table);
1571 }
1572
1573 return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);
1574}
1575
1576static int multipath_iterate_devices(struct dm_target *ti,
1577 iterate_devices_callout_fn fn, void *data)
1578{

--- 174 unchanged lines hidden ---
1573 }
1574
1575 return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);
1576}
1577
1578static int multipath_iterate_devices(struct dm_target *ti,
1579 iterate_devices_callout_fn fn, void *data)
1580{

--- 174 unchanged lines hidden ---