提交 d942ae44 编写于 作者: P Philipp Reisner

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: NPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: NLars Ellenberg <lars.ellenberg@linbit.com>
上级 4dbdae3e
...@@ -372,11 +372,11 @@ struct p_connection_features { ...@@ -372,11 +372,11 @@ struct p_connection_features {
u32 protocol_max; u32 protocol_max;
/* should be more than enough for future enhancements /* should be more than enough for future enhancements
* for now, feature_flags and the reserverd array shall be zero. * for now, feature_flags and the reserved array shall be zero.
*/ */
u32 _pad; u32 _pad;
u64 reserverd[7]; u64 reserved[7];
} __packed; } __packed;
struct p_barrier { struct p_barrier {
...@@ -914,7 +914,7 @@ struct drbd_conf { ...@@ -914,7 +914,7 @@ struct drbd_conf {
atomic_t ap_bio_cnt; /* Requests we need to complete */ atomic_t ap_bio_cnt; /* Requests we need to complete */
atomic_t ap_pending_cnt; /* AP data packets on the wire, ack expected */ atomic_t ap_pending_cnt; /* AP data packets on the wire, ack expected */
atomic_t rs_pending_cnt; /* RS request/data packets on the wire */ atomic_t rs_pending_cnt; /* RS request/data packets on the wire */
atomic_t unacked_cnt; /* Need to send replys for */ atomic_t unacked_cnt; /* Need to send replies for */
atomic_t local_cnt; /* Waiting for local completion */ atomic_t local_cnt; /* Waiting for local completion */
/* Interval tree of pending local requests */ /* Interval tree of pending local requests */
...@@ -2153,7 +2153,7 @@ static inline int drbd_state_is_stable(struct drbd_conf *mdev) ...@@ -2153,7 +2153,7 @@ static inline int drbd_state_is_stable(struct drbd_conf *mdev)
/* disk state is stable as well. */ /* disk state is stable as well. */
break; break;
/* no new io accepted during tansitional states */ /* no new io accepted during transitional states */
case D_ATTACHING: case D_ATTACHING:
case D_FAILED: case D_FAILED:
case D_NEGOTIATING: case D_NEGOTIATING:
...@@ -2217,7 +2217,7 @@ static inline void inc_ap_bio(struct drbd_conf *mdev) ...@@ -2217,7 +2217,7 @@ static inline void inc_ap_bio(struct drbd_conf *mdev)
/* we wait here /* we wait here
* as long as the device is suspended * as long as the device is suspended
* until the bitmap is no longer on the fly during connection * until the bitmap is no longer on the fly during connection
* handshake as long as we would exeed the max_buffer limit. * handshake as long as we would exceed the max_buffer limit.
* *
* to avoid races with the reconnect code, * to avoid races with the reconnect code,
* we need to atomic_inc within the spinlock. */ * we need to atomic_inc within the spinlock. */
......
...@@ -37,6 +37,15 @@ struct after_state_chg_work { ...@@ -37,6 +37,15 @@ struct after_state_chg_work {
struct completion *done; struct completion *done;
}; };
enum sanitize_state_warnings {
NO_WARNING,
ABORTED_ONLINE_VERIFY,
ABORTED_RESYNC,
CONNECTION_LOST_NEGOTIATING,
IMPLICITLY_UPGRADED_DISK,
IMPLICITLY_UPGRADED_PDSK,
};
static int w_after_state_ch(struct drbd_work *w, int unused); static int w_after_state_ch(struct drbd_work *w, int unused);
static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
union drbd_state ns, enum chg_state_flags flags); 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); ...@@ -44,7 +53,7 @@ static enum drbd_state_rv is_valid_state(struct drbd_conf *, union drbd_state);
static enum drbd_state_rv is_valid_soft_transition(union drbd_state, union drbd_state); static enum drbd_state_rv is_valid_soft_transition(union drbd_state, union drbd_state);
static enum drbd_state_rv is_valid_transition(union drbd_state os, union drbd_state ns); static enum drbd_state_rv is_valid_transition(union drbd_state os, union drbd_state ns);
static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns, static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns,
const char **warn_sync_abort); enum sanitize_state_warnings *warn);
static inline bool is_susp(union drbd_state s) static inline bool is_susp(union drbd_state s)
{ {
...@@ -656,6 +665,21 @@ is_valid_transition(union drbd_state os, union drbd_state ns) ...@@ -656,6 +665,21 @@ is_valid_transition(union drbd_state os, union drbd_state ns)
return rv; return rv;
} }
static void print_sanitize_warnings(struct drbd_conf *mdev, enum sanitize_state_warnings warn)
{
static const char *msg_table[] = {
[NO_WARNING] = "",
[ABORTED_ONLINE_VERIFY] = "Online-verify aborted.",
[ABORTED_RESYNC] = "Resync aborted.",
[CONNECTION_LOST_NEGOTIATING] = "Connection lost while negotiating, no data!",
[IMPLICITLY_UPGRADED_DISK] = "Implicitly upgraded disk",
[IMPLICITLY_UPGRADED_PDSK] = "Implicitly upgraded pdsk",
};
if (warn != NO_WARNING)
dev_warn(DEV, "%s\n", msg_table[warn]);
}
/** /**
* sanitize_state() - Resolves implicitly necessary additional changes to a state transition * sanitize_state() - Resolves implicitly necessary additional changes to a state transition
* @mdev: DRBD device. * @mdev: DRBD device.
...@@ -667,11 +691,14 @@ is_valid_transition(union drbd_state os, union drbd_state ns) ...@@ -667,11 +691,14 @@ is_valid_transition(union drbd_state os, union drbd_state ns)
* to D_UNKNOWN. This rule and many more along those lines are in this function. * to D_UNKNOWN. This rule and many more along those lines are in this function.
*/ */
static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns, static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns,
const char **warn_sync_abort) enum sanitize_state_warnings *warn)
{ {
enum drbd_fencing_p fp; enum drbd_fencing_p fp;
enum drbd_disk_state disk_min, disk_max, pdsk_min, pdsk_max; enum drbd_disk_state disk_min, disk_max, pdsk_min, pdsk_max;
if (warn)
*warn = NO_WARNING;
fp = FP_DONT_CARE; fp = FP_DONT_CARE;
if (get_ldev(mdev)) { if (get_ldev(mdev)) {
rcu_read_lock(); rcu_read_lock();
...@@ -695,10 +722,9 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ...@@ -695,10 +722,9 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
/* An implication of the disk states onto the connection state */ /* An implication of the disk states onto the connection state */
/* Abort resync if a disk fails/detaches */ /* Abort resync if a disk fails/detaches */
if (ns.conn > C_CONNECTED && (ns.disk <= D_FAILED || ns.pdsk <= D_FAILED)) { if (ns.conn > C_CONNECTED && (ns.disk <= D_FAILED || ns.pdsk <= D_FAILED)) {
if (warn_sync_abort) if (warn)
*warn_sync_abort = *warn = ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T ?
ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T ? ABORTED_ONLINE_VERIFY : ABORTED_RESYNC;
"Online-verify" : "Resync";
ns.conn = C_CONNECTED; ns.conn = C_CONNECTED;
} }
...@@ -709,7 +735,8 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ...@@ -709,7 +735,8 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
ns.disk = mdev->new_state_tmp.disk; ns.disk = mdev->new_state_tmp.disk;
ns.pdsk = mdev->new_state_tmp.pdsk; ns.pdsk = mdev->new_state_tmp.pdsk;
} else { } else {
dev_alert(DEV, "Connection lost while negotiating, no data!\n"); if (warn)
*warn = CONNECTION_LOST_NEGOTIATING;
ns.disk = D_DISKLESS; ns.disk = D_DISKLESS;
ns.pdsk = D_UNKNOWN; ns.pdsk = D_UNKNOWN;
} }
...@@ -791,16 +818,16 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ...@@ -791,16 +818,16 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
ns.disk = disk_max; ns.disk = disk_max;
if (ns.disk < disk_min) { if (ns.disk < disk_min) {
dev_warn(DEV, "Implicitly set disk from %s to %s\n", if (warn)
drbd_disk_str(ns.disk), drbd_disk_str(disk_min)); *warn = IMPLICITLY_UPGRADED_DISK;
ns.disk = disk_min; ns.disk = disk_min;
} }
if (ns.pdsk > pdsk_max) if (ns.pdsk > pdsk_max)
ns.pdsk = pdsk_max; ns.pdsk = pdsk_max;
if (ns.pdsk < pdsk_min) { if (ns.pdsk < pdsk_min) {
dev_warn(DEV, "Implicitly set pdsk from %s to %s\n", if (warn)
drbd_disk_str(ns.pdsk), drbd_disk_str(pdsk_min)); *warn = IMPLICITLY_UPGRADED_PDSK;
ns.pdsk = pdsk_min; ns.pdsk = pdsk_min;
} }
...@@ -875,12 +902,12 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns, ...@@ -875,12 +902,12 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
{ {
union drbd_state os; union drbd_state os;
enum drbd_state_rv rv = SS_SUCCESS; enum drbd_state_rv rv = SS_SUCCESS;
const char *warn_sync_abort = NULL; enum sanitize_state_warnings ssw;
struct after_state_chg_work *ascw; struct after_state_chg_work *ascw;
os = drbd_read_state(mdev); os = drbd_read_state(mdev);
ns = sanitize_state(mdev, ns, &warn_sync_abort); ns = sanitize_state(mdev, ns, &ssw);
if (ns.i == os.i) if (ns.i == os.i)
return SS_NOTHING_TO_DO; return SS_NOTHING_TO_DO;
...@@ -909,8 +936,7 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns, ...@@ -909,8 +936,7 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
return rv; return rv;
} }
if (warn_sync_abort) print_sanitize_warnings(mdev, ssw);
dev_warn(DEV, "%s aborted.\n", warn_sync_abort);
drbd_pr_state_change(mdev, os, ns, flags); drbd_pr_state_change(mdev, os, ns, flags);
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
* is 1 PiB, currently. */ * is 1 PiB, currently. */
/* DRBD_MAX_SECTORS */ /* DRBD_MAX_SECTORS */
#define DRBD_DISK_SIZE_MIN 0 #define DRBD_DISK_SIZE_MIN 0
#define DRBD_DISK_SIZE_MAX (16 * (2LLU << 30)) #define DRBD_DISK_SIZE_MAX (1 * (2LLU << 40))
#define DRBD_DISK_SIZE_DEF 0 /* = disabled = no user size... */ #define DRBD_DISK_SIZE_DEF 0 /* = disabled = no user size... */
#define DRBD_DISK_SIZE_SCALE 's' /* sectors */ #define DRBD_DISK_SIZE_SCALE 's' /* sectors */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册