* \param curgrant - is the current grant claimed by the client
* \param want - is how much grant space the client would like to have
* \param left - is the remaining free space with granted space taken out
+ * \param conservative - is how server grants, if true, a certain amount, else
+ * server will grant as client requested.
*/
static long ofd_grant(struct obd_export *exp, obd_size curgrant,
- obd_size want, obd_size left)
+ obd_size want, obd_size left, bool conservative)
{
struct obd_device *obd = exp->exp_obd;
struct ofd_device *ofd = ofd_exp(exp);
if (curgrant >= want || curgrant >= fed->fed_grant + grant_chunk)
RETURN(0);
- if (!obd->obd_recovering)
+ if (obd->obd_recovering)
+ conservative = false;
+
+ if (conservative)
/* don't grant more than 1/8th of the remaining free space in
* one chunk */
left >>= 3;
if (!grant)
RETURN(0);
- /* Limit to ofd_grant_chunk() if client is not reconnecting */
- if ((grant > grant_chunk) && (!obd->obd_recovering))
+ /* Limit to ofd_grant_chunk() if not reconnect/recovery */
+ if ((grant > grant_chunk) && conservative)
grant = grant_chunk;
ofd->ofd_tot_granted += grant;
* \param env - is the lu environment provided by the caller
* \param exp - is the client's export which is reconnecting
* \param want - is how much the client would like to get
+ * \param conservative - is how server grants to client, if true server will
+ * only grant certain amount, else server will grant client requested
+ * amount.
*/
long ofd_grant_connect(const struct lu_env *env, struct obd_export *exp,
- obd_size want)
+ obd_size want, bool conservative)
{
struct ofd_device *ofd = ofd_exp(exp);
struct filter_export_data *fed = &exp->exp_filter_data;
}
ofd_grant(exp, ofd_grant_to_cli(exp, ofd, (obd_size)fed->fed_grant),
- want, left);
+ want, left, conservative);
/* return to client its current grant */
grant = ofd_grant_to_cli(exp, ofd, (obd_size)fed->fed_grant);
ofd_grant_shrink(exp, oa, left);
else
/* grant more space back to the client if possible */
- oa->o_grant = ofd_grant(exp, oa->o_grant, oa->o_undirty, left);
+ oa->o_grant = ofd_grant(exp, oa->o_grant, oa->o_undirty, left,
+ true);
spin_unlock(&ofd->ofd_grant_lock);
}
/* grant more space (twice as much as needed for this request) for
* precreate purpose if possible */
- ofd_grant(exp, fed->fed_grant, wanted * 2, left);
+ ofd_grant(exp, fed->fed_grant, wanted * 2, left, true);
spin_unlock(&ofd->ofd_grant_lock);
RETURN(0);
}
static int ofd_parse_connect_data(const struct lu_env *env,
struct obd_export *exp,
- struct obd_connect_data *data)
+ struct obd_connect_data *data,
+ bool new_connection)
{
struct ofd_device *ofd = ofd_exp(exp);
struct filter_export_data *fed = &exp->exp_filter_data;
}
if (exp_connect_flags(exp) & OBD_CONNECT_GRANT)
- data->ocd_grant = ofd_grant_connect(env, exp, data->ocd_grant);
+ data->ocd_grant = ofd_grant_connect(env, exp, data->ocd_grant,
+ new_connection);
if (data->ocd_connect_flags & OBD_CONNECT_INDEX) {
struct lr_server_data *lsd = &ofd->ofd_lut.lut_lsd;
}
ofd_info_init(env, exp);
- rc = ofd_parse_connect_data(env, exp, data);
+ rc = ofd_parse_connect_data(env, exp, data, false);
if (rc == 0)
ofd_export_stats_init(ofd, exp, localdata);
ofd_info_init(env, exp);
- rc = ofd_parse_connect_data(env, exp, data);
+ rc = ofd_parse_connect_data(env, exp, data, true);
if (rc)
GOTO(out, rc);
cli->cl_avail_grant = ocd->ocd_grant - cli->cl_dirty;
if (cli->cl_avail_grant < 0) {
- CWARN("%s: available grant < 0, the OSS is probably not running"
- " with patch from bug20278 (%ld) \n",
- cli->cl_import->imp_obd->obd_name, cli->cl_avail_grant);
- /* workaround for 1.6 servers which do not have
- * the patch from bug20278 */
- cli->cl_avail_grant = ocd->ocd_grant;
+ CWARN("%s: available grant < 0: avail/ocd/dirty %ld/%u/%ld\n",
+ cli->cl_import->imp_obd->obd_name, cli->cl_avail_grant,
+ ocd->ocd_grant, cli->cl_dirty);
+ /* workaround for servers which do not have the patch from
+ * LU-2679 */
+ cli->cl_avail_grant = ocd->ocd_grant;
}
/* determine the appropriate chunk size used by osc_extent. */