port att24108 and att24644 of bz19778 to HEAD.
b=19778
i=johann
i=tianzy
i=shadow
extern int lprocfs_wr_ping(struct file *file, const char *buffer,
unsigned long count, void *data);
+extern int lprocfs_rd_quota_resend_count(char *page, char **start, off_t off,
+ int count, int *eof, void *data);
+extern int lprocfs_wr_quota_resend_count(struct file *file, const char *buffer,
+ unsigned long count, void *data);
+
/* Statfs helpers */
extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
int count, int *eof, void *data);
struct semaphore fo_init_lock; /* group initialization lock */
int fo_committed_group;
+#define CLIENT_QUOTA_DEFAULT_RESENDS 10
spinlock_t fo_objidlock; /* protect fo_lastobjid */
struct lu_client_seq *cl_seq;
atomic_t cl_resends; /* resend count */
+ atomic_t cl_quota_resends; /* quota related resend count */
};
#define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid)
cli->cl_cksum_type = cli->cl_supp_cksum_types = OBD_CKSUM_CRC32;
#endif
atomic_set(&cli->cl_resends, OSC_DEFAULT_RESENDS);
+ atomic_set(&cli->cl_quota_resends, CLIENT_QUOTA_DEFAULT_RESENDS);
/* This value may be changed at connect time in
ptlrpc_connect_interpret. */
{ "mds_conn_uuid", lprocfs_rd_conn_uuid, 0, 0 },
{ "max_rpcs_in_flight", mdc_rd_max_rpcs_in_flight,
mdc_wr_max_rpcs_in_flight, 0 },
+ { "quota_resend_count", lprocfs_rd_quota_resend_count,
+ lprocfs_wr_quota_resend_count, 0},
{ "timeouts", lprocfs_rd_timeouts, 0, 0 },
{ "import", lprocfs_rd_import, 0, 0 },
{ "state", lprocfs_rd_state, 0, 0 },
return rc;
}
+int lprocfs_rd_quota_resend_count(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+
+ return snprintf(page, count, "%u\n",
+ atomic_read(&obd->u.cli.cl_quota_resends));
+}
+
+int lprocfs_wr_quota_resend_count(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 0)
+ return -EINVAL;
+
+ atomic_set(&obd->u.cli.cl_quota_resends, val);
+
+ return count;
+}
+
/* See also ptlrpc_lprocfs_rd_timeouts */
int lprocfs_rd_timeouts(char *page, char **start, off_t off, int count,
int *eof, void *data)
EXPORT_SYMBOL(lprocfs_rd_kbytesavail);
EXPORT_SYMBOL(lprocfs_rd_filestotal);
EXPORT_SYMBOL(lprocfs_rd_filesfree);
+EXPORT_SYMBOL(lprocfs_rd_quota_resend_count);
+EXPORT_SYMBOL(lprocfs_wr_quota_resend_count);
EXPORT_SYMBOL(lprocfs_write_helper);
EXPORT_SYMBOL(lprocfs_write_frac_helper);
{ "checksums", osc_rd_checksum, osc_wr_checksum, 0 },
{ "checksum_type", osc_rd_checksum_type, osc_wd_checksum_type, 0 },
{ "resend_count", osc_rd_resend_count, osc_wr_resend_count, 0},
+ { "quota_resend_count", lprocfs_rd_quota_resend_count,
+ lprocfs_wr_quota_resend_count, 0},
{ "timeouts", lprocfs_rd_timeouts, 0, 0 },
{ "contention_seconds", osc_rd_contention_seconds,
osc_wr_contention_seconds, 0 },
struct ptlrpc_request *req;
struct obd_quotactl *oqc;
const struct req_format *rf;
- int ver, opc, rc;
+ int ver, opc, rc, resends = 0;
ENTRY;
if (!strcmp(exp->exp_obd->obd_type->typ_name, LUSTRE_MDC_NAME)) {
RETURN(-EINVAL);
}
+restart_request:
+
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), rf, ver, opc);
if (req == NULL)
RETURN(-ENOMEM);
*oqc = *oqctl;
ptlrpc_request_set_replen(req);
+ ptlrpc_at_set_req_timeout(req);
+ req->rq_no_resend = 1;
rc = ptlrpc_queue_wait(req);
if (rc) {
EXIT;
out:
ptlrpc_req_finished(req);
+
+ if (client_quota_recoverable_error(rc)) {
+ resends++;
+ if (!client_quota_should_resend(resends, &exp->exp_obd->u.cli)) {
+ CERROR("too many resend retries, returning error\n");
+ RETURN(-EIO);
+ }
+
+ goto restart_request;
+ }
+
return rc;
}
int lov_quota_check(struct obd_device *unused, struct obd_export *exp,
struct obd_quotactl *oqctl);
int client_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk);
+
+static inline int client_quota_recoverable_error(int rc)
+{
+ return (rc == -ETIMEDOUT || rc == -EAGAIN);
+}
+
+static inline int client_quota_should_resend(int resend, struct client_obd *cli)
+{
+ return atomic_read(&cli->cl_quota_resends) ?
+ atomic_read(&cli->cl_quota_resends) > resend : 1;
+}
+
#endif
up(&dquot->dq_sem);
lustre_dqput(dquot);
+ up(&mds->mds_qonoff_sem);
/* the usages in admin quota file is inaccurate */
dqblk->dqb_curinodes = 0;
dqblk->dqb_curspace = 0;
rc = mds_get_space(obd, oqctl);
EXIT;
-
+ return rc;
out:
up(&mds->mds_qonoff_sem);
return rc;
remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="9 10 11 18b 21"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="9 10 11 18b 21 29"
QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
}
run_test_with_stat 30 "hard limit updates should not reset grace times ================"
+test_29()
+{
+ local BLK_LIMIT=$((100 * 1024 * 1024)) # 100G
+ local timeout
+ local pid
+ local resends
+
+ if at_is_enabled; then
+ timeout=$(at_max_get client)
+ at_max_set 10 client
+ else
+ timeout=$(lctl get_param -n timeout)
+ lctl set_param timeout=10
+ fi
+
+ resends=$(lctl get_param -n mdc.${FSNAME}-*.quota_resend_count | head -1)
+
+ #define OBD_FAIL_MDS_QUOTACTL_NET 0x12e
+ lustre_fail mds 0x12e
+
+ $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR & pid=$!
+
+ echo "sleeping for $((10 * resends + 5)) seconds"
+ sleep $((10 * resends + 5))
+ ps -p $pid && error "lfs hadn't finished by timeout"
+ wait $pid && error "succeeded, but should have failed"
+
+ lustre_fail mds 0
+
+ if at_is_enabled; then
+ at_max_set $timeout client
+ else
+ lctl set_param timeout=$timeout
+ fi
+
+ resetquota -u $TSTUSR
+}
+run_test_with_stat 29 "unhandled quotactls must not hang lustre client (19778) ========"
+
# turn off quota
quota_fini()
{