Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-9127 target: tgt_cb_last_committed is too noisy
[fs/lustre-release.git]
/
lustre
/
target
/
tgt_lastrcvd.c
diff --git
a/lustre/target/tgt_lastrcvd.c
b/lustre/target/tgt_lastrcvd.c
index
c3811cd
..
ea70037
100644
(file)
--- a/
lustre/target/tgt_lastrcvd.c
+++ b/
lustre/target/tgt_lastrcvd.c
@@
-23,7
+23,7
@@
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 201
5
, Intel Corporation.
+ * Copyright (c) 2011, 201
6
, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-804,14
+804,19
@@
static void tgt_cb_last_committed(struct lu_env *env, struct thandle *th,
} else {
spin_unlock(&ccb->llcc_tgt->lut_translock);
}
} else {
spin_unlock(&ccb->llcc_tgt->lut_translock);
}
+
+ CDEBUG(D_HA, "%s: transno %lld is committed\n",
+ ccb->llcc_tgt->lut_obd->obd_name, ccb->llcc_transno);
+
out:
class_export_cb_put(ccb->llcc_exp);
out:
class_export_cb_put(ccb->llcc_exp);
- if (ccb->llcc_transno)
- CDEBUG(D_HA, "%s: transno %lld is committed\n",
- ccb->llcc_tgt->lut_obd->obd_name, ccb->llcc_transno);
OBD_FREE_PTR(ccb);
}
OBD_FREE_PTR(ccb);
}
+/**
+ * Add commit callback function, it returns a non-zero value to inform
+ * caller to use sync transaction if necessary.
+ */
int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *tgt,
struct obd_export *exp, __u64 transno)
{
int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *tgt,
struct obd_export *exp, __u64 transno)
{
@@
-842,7
+847,9
@@
int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *tgt,
/* report failure to force synchronous operation */
return -EPERM;
/* report failure to force synchronous operation */
return -EPERM;
- return rc;
+ /* if exp_need_sync is set, return non-zero value to force
+ * a sync transaction. */
+ return rc ? rc : exp->exp_need_sync;
}
struct tgt_new_client_callback {
}
struct tgt_new_client_callback {
@@
-1073,6
+1080,9
@@
int tgt_client_del(const struct lu_env *env, struct obd_export *exp)
if (exp->exp_flags & OBD_OPT_FAILOVER)
RETURN(0);
if (exp->exp_flags & OBD_OPT_FAILOVER)
RETURN(0);
+ if (OBD_FAIL_CHECK(OBD_FAIL_TGT_CLIENT_DEL))
+ RETURN(0);
+
/* Make sure the server's last_transno is up to date.
* This should be done before zeroing client slot so last_transno will
* be in server data or in client data in case of failure */
/* Make sure the server's last_transno is up to date.
* This should be done before zeroing client slot so last_transno will
* be in server data or in client data in case of failure */
@@
-1334,7
+1344,11
@@
static int tgt_last_rcvd_update(const struct lu_env *env, struct lu_target *tgt,
if (!lw_client) {
tti->tti_off = ted->ted_lr_off;
if (!lw_client) {
tti->tti_off = ted->ted_lr_off;
- rc = tgt_client_data_write(env, tgt, ted->ted_lcd, &tti->tti_off, th);
+ if (CFS_FAIL_CHECK(OBD_FAIL_TGT_RCVD_EIO))
+ rc = -EIO;
+ else
+ rc = tgt_client_data_write(env, tgt, ted->ted_lcd,
+ &tti->tti_off, th);
if (rc < 0) {
mutex_unlock(&ted->ted_lcd_lock);
RETURN(rc);
if (rc < 0) {
mutex_unlock(&ted->ted_lcd_lock);
RETURN(rc);