aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_state.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-05-31 07:07:24 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 10:57:49 -0500
commitd942ae44537669418a7cbfd916531d30513dbca8 (patch)
treeb5828318e7ffe375b3d709c634c3430292d9f376 /drivers/block/drbd/drbd_state.c
parent4dbdae3ec9c75f570e2f128fd25b49ff1fa2a4de (diff)
drbd: Fixes from the 8.3 development branch
* commit 'ae57a0a': drbd: Only print sanitize state's warnings, if the state change happens drbd: we should write meta data updates with FLUSH FUA drbd: fix limit define, we support 1 PiByte now drbd: fix log message argument order drbd: Typo in user-visible message. drbd: Make "(rcv|snd)buf-size" and "ping-timeout" available for the proxy, too. drbd: Allow keywords to be used in multiple config sections. drbd: fix typos in comments. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_state.c')
-rw-r--r--drivers/block/drbd/drbd_state.c56
1 files changed, 41 insertions, 15 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
index 8c9d0348736d..2cf69b25f1e7 100644
--- a/drivers/block/drbd/drbd_state.c
+++ b/drivers/block/drbd/drbd_state.c
@@ -37,6 +37,15 @@ struct after_state_chg_work {
37 struct completion *done; 37 struct completion *done;
38}; 38};
39 39
40enum sanitize_state_warnings {
41 NO_WARNING,
42 ABORTED_ONLINE_VERIFY,
43 ABORTED_RESYNC,
44 CONNECTION_LOST_NEGOTIATING,
45 IMPLICITLY_UPGRADED_DISK,
46 IMPLICITLY_UPGRADED_PDSK,
47};
48
40static int w_after_state_ch(struct drbd_work *w, int unused); 49static int w_after_state_ch(struct drbd_work *w, int unused);
41static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, 50static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
42 union drbd_state ns, enum chg_state_flags flags); 51 union drbd_state ns, enum chg_state_flags flags);
@@ -44,7 +53,7 @@ static enum drbd_state_rv is_valid_state(struct drbd_conf *, union drbd_state);
44static enum drbd_state_rv is_valid_soft_transition(union drbd_state, union drbd_state); 53static enum drbd_state_rv is_valid_soft_transition(union drbd_state, union drbd_state);
45static enum drbd_state_rv is_valid_transition(union drbd_state os, union drbd_state ns); 54static enum drbd_state_rv is_valid_transition(union drbd_state os, union drbd_state ns);
46static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns, 55static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns,
47 const char **warn_sync_abort); 56 enum sanitize_state_warnings *warn);
48 57
49static inline bool is_susp(union drbd_state s) 58static inline bool is_susp(union drbd_state s)
50{ 59{
@@ -656,6 +665,21 @@ is_valid_transition(union drbd_state os, union drbd_state ns)
656 return rv; 665 return rv;
657} 666}
658 667
668static void print_sanitize_warnings(struct drbd_conf *mdev, enum sanitize_state_warnings warn)
669{
670 static const char *msg_table[] = {
671 [NO_WARNING] = "",
672 [ABORTED_ONLINE_VERIFY] = "Online-verify aborted.",
673 [ABORTED_RESYNC] = "Resync aborted.",
674 [CONNECTION_LOST_NEGOTIATING] = "Connection lost while negotiating, no data!",
675 [IMPLICITLY_UPGRADED_DISK] = "Implicitly upgraded disk",
676 [IMPLICITLY_UPGRADED_PDSK] = "Implicitly upgraded pdsk",
677 };
678
679 if (warn != NO_WARNING)
680 dev_warn(DEV, "%s\n", msg_table[warn]);
681}
682
659/** 683/**
660 * sanitize_state() - Resolves implicitly necessary additional changes to a state transition 684 * sanitize_state() - Resolves implicitly necessary additional changes to a state transition
661 * @mdev: DRBD device. 685 * @mdev: DRBD device.
@@ -667,11 +691,14 @@ is_valid_transition(union drbd_state os, union drbd_state ns)
667 * to D_UNKNOWN. This rule and many more along those lines are in this function. 691 * to D_UNKNOWN. This rule and many more along those lines are in this function.
668 */ 692 */
669static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns, 693static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns,
670 const char **warn_sync_abort) 694 enum sanitize_state_warnings *warn)
671{ 695{
672 enum drbd_fencing_p fp; 696 enum drbd_fencing_p fp;
673 enum drbd_disk_state disk_min, disk_max, pdsk_min, pdsk_max; 697 enum drbd_disk_state disk_min, disk_max, pdsk_min, pdsk_max;
674 698
699 if (warn)
700 *warn = NO_WARNING;
701
675 fp = FP_DONT_CARE; 702 fp = FP_DONT_CARE;
676 if (get_ldev(mdev)) { 703 if (get_ldev(mdev)) {
677 rcu_read_lock(); 704 rcu_read_lock();
@@ -695,10 +722,9 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
695 /* An implication of the disk states onto the connection state */ 722 /* An implication of the disk states onto the connection state */
696 /* Abort resync if a disk fails/detaches */ 723 /* Abort resync if a disk fails/detaches */
697 if (ns.conn > C_CONNECTED && (ns.disk <= D_FAILED || ns.pdsk <= D_FAILED)) { 724 if (ns.conn > C_CONNECTED && (ns.disk <= D_FAILED || ns.pdsk <= D_FAILED)) {
698 if (warn_sync_abort) 725 if (warn)
699 *warn_sync_abort = 726 *warn = ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T ?
700 ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T ? 727 ABORTED_ONLINE_VERIFY : ABORTED_RESYNC;
701 "Online-verify" : "Resync";
702 ns.conn = C_CONNECTED; 728 ns.conn = C_CONNECTED;
703 } 729 }
704 730
@@ -709,7 +735,8 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
709 ns.disk = mdev->new_state_tmp.disk; 735 ns.disk = mdev->new_state_tmp.disk;
710 ns.pdsk = mdev->new_state_tmp.pdsk; 736 ns.pdsk = mdev->new_state_tmp.pdsk;
711 } else { 737 } else {
712 dev_alert(DEV, "Connection lost while negotiating, no data!\n"); 738 if (warn)
739 *warn = CONNECTION_LOST_NEGOTIATING;
713 ns.disk = D_DISKLESS; 740 ns.disk = D_DISKLESS;
714 ns.pdsk = D_UNKNOWN; 741 ns.pdsk = D_UNKNOWN;
715 } 742 }
@@ -791,16 +818,16 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
791 ns.disk = disk_max; 818 ns.disk = disk_max;
792 819
793 if (ns.disk < disk_min) { 820 if (ns.disk < disk_min) {
794 dev_warn(DEV, "Implicitly set disk from %s to %s\n", 821 if (warn)
795 drbd_disk_str(ns.disk), drbd_disk_str(disk_min)); 822 *warn = IMPLICITLY_UPGRADED_DISK;
796 ns.disk = disk_min; 823 ns.disk = disk_min;
797 } 824 }
798 if (ns.pdsk > pdsk_max) 825 if (ns.pdsk > pdsk_max)
799 ns.pdsk = pdsk_max; 826 ns.pdsk = pdsk_max;
800 827
801 if (ns.pdsk < pdsk_min) { 828 if (ns.pdsk < pdsk_min) {
802 dev_warn(DEV, "Implicitly set pdsk from %s to %s\n", 829 if (warn)
803 drbd_disk_str(ns.pdsk), drbd_disk_str(pdsk_min)); 830 *warn = IMPLICITLY_UPGRADED_PDSK;
804 ns.pdsk = pdsk_min; 831 ns.pdsk = pdsk_min;
805 } 832 }
806 833
@@ -875,12 +902,12 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
875{ 902{
876 union drbd_state os; 903 union drbd_state os;
877 enum drbd_state_rv rv = SS_SUCCESS; 904 enum drbd_state_rv rv = SS_SUCCESS;
878 const char *warn_sync_abort = NULL; 905 enum sanitize_state_warnings ssw;
879 struct after_state_chg_work *ascw; 906 struct after_state_chg_work *ascw;
880 907
881 os = drbd_read_state(mdev); 908 os = drbd_read_state(mdev);
882 909
883 ns = sanitize_state(mdev, ns, &warn_sync_abort); 910 ns = sanitize_state(mdev, ns, &ssw);
884 if (ns.i == os.i) 911 if (ns.i == os.i)
885 return SS_NOTHING_TO_DO; 912 return SS_NOTHING_TO_DO;
886 913
@@ -909,8 +936,7 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
909 return rv; 936 return rv;
910 } 937 }
911 938
912 if (warn_sync_abort) 939 print_sanitize_warnings(mdev, ssw);
913 dev_warn(DEV, "%s aborted.\n", warn_sync_abort);
914 940
915 drbd_pr_state_change(mdev, os, ns, flags); 941 drbd_pr_state_change(mdev, os, ns, flags);
916 942